Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions R_scripts/summarize_results.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
library('Matrix')
source('R_scripts/evaluate.R')

thisFile <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
return(normalizePath(sys.frames()[[1]]$ofile))
}
}
baseDirectory <- dirname(thisFile())

source(paste(sep="/",baseDirectory,'R_scripts/evaluate.R'))

get.mean.and.lh <- function(mat) {
ret <- list()
Expand Down Expand Up @@ -62,7 +77,7 @@ sum.net <- function(betas, betas.resc, comb.confs, IN, cc.file, th=0.5) {
cat('A total of', length(gp$pred.has.na), 'predictors contained NA and were removed.\n')
cat('A total of', length(gp$pred.is.const), 'predictors were constant and were removed.\n')
cat('A total of', length(unique(unlist(gp$pred.groups))), 'predictors formed', length(gp$pred.groups), 'groups.\n')
source('R_scripts/evaluate.R')
source(paste(sep="/",baseDirectory,'R_scripts/evaluate.R'))
cc.aupr <- aupr(comb.confs, p.mat, eval.on.subset=TRUE)
cat('AUPR is', cc.aupr, '\n')

Expand Down
18 changes: 17 additions & 1 deletion R_scripts/vis_res_tfa.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
library('Matrix')
source('R_scripts/priors.R')

# Get the directory in which inferelator.R sits
thisFile <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
return(normalizePath(sys.frames()[[1]]$ofile))
}
}
baseDirectory <- dirname(thisFile())

source(paste(sep="/",baseDirectory,'R_scripts/priors.R'))

ChristophsPR <- function(ord.idx, gs) {
prec <- cumsum(gs[ord.idx]) / cumsum(rep(1, length(ord.idx)))
Expand Down
39 changes: 27 additions & 12 deletions inferelator.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,32 @@ library('Matrix')
rm(list=ls())
gc()

source('R_scripts/utils.R')
source('R_scripts/design_and_response.R')
source('R_scripts/priors.R')
source('R_scripts/mi_and_clr.R')
source('R_scripts/bayesianRegression.R')
source('R_scripts/men.R')
source('R_scripts/evaluate.R')
source('R_scripts/tfa.R')
source('R_scripts/group_predictors.R')
source('R_scripts/summarize_results.R')
source('R_scripts/vis_tfs_and_targets.R')
# Get the directory in which inferelator.R sits
thisFile <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
needle <- "--file="
match <- grep(needle, cmdArgs)
if (length(match) > 0) {
# Rscript
return(normalizePath(sub(needle, "", cmdArgs[match])))
} else {
# 'source'd via R console
return(normalizePath(sys.frames()[[1]]$ofile))
}
}
baseDirectory <- dirname(thisFile())

source(paste(sep="/", baseDirectory, 'R_scripts/utils.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/design_and_response.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/priors.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/mi_and_clr.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/bayesianRegression.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/men.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/evaluate.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/tfa.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/group_predictors.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/summarize_results.R'))
source(paste(sep="/", baseDirectory, 'R_scripts/vis_tfs_and_targets.R'))


date.time.str <- format(Sys.time(), "%Y-%m-%d_%H-%M-%S")
Expand Down Expand Up @@ -429,7 +444,7 @@ PROCTIME <- proc.time() - start.proc.time
save(PARS, IN, SEED, PROCTIME, file = paste(PARS$save.to.dir, "/params_and_input.RData", sep=""))

# generate network report and visualize TFs and targets
source('R_scripts/net_report_new.R')
source(paste(sep="/", baseDirectory, 'R_scripts/net_report_new.R'))
Sys.sleep(2)
for (ccf in list.files(PARS$save.to.dir, pattern='combinedconf_*', full.names=TRUE)) {
if (PARS$output.report) {
Expand Down