-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_ggm.R
65 lines (51 loc) · 1.88 KB
/
run_ggm.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#' -----------------------------------------------------------------------------
#' Apply the network inference using different models on simulated data
#'
#' @author Johann Hawe <[email protected]>
#'
#' @date Tue Mar 26 10:45:32 2019
#' -----------------------------------------------------------------------------
log <- file(snakemake@log[[1]], open="wt")
sink(log)
sink(log, type="message")
# ------------------------------------------------------------------------------
print("Load libraries and source scripts")
library(GenomicRanges)
library(pheatmap)
library(doParallel)
library(igraph)
library(graph)
source("scripts/lib.R")
source("scripts/reg_net.R")
source("scripts/simulation/lib.R")
# ------------------------------------------------------------------------------
print("Get snakemake input and load data.")
# inputs
fdata <- snakemake@input$data
fppi_db <- snakemake@input$ppi_db
fcpg_context <- snakemake@input$cpg_context
# outputs
fout <- snakemake@output[[1]]
# params
threads <- snakemake@threads
sim_iter <- as.numeric(snakemake@params$iteration)
subset <- snakemake@wildcards$subset
# contains: simulations, ranges, priors, nodes, data, runs
load(fdata)
ppi_db <- readRDS(fppi_db)
# ------------------------------------------------------------------------------
# we generated several graphs, for which we all calculate models now
# apply over the different runs/iterations
run <- simulations[[sim_iter]]
# for this run, apply over all simulated graphs (different randomization
# degrees)
result <- run_ggm(run, priors, ranges,
fcpg_context, ppi_db, subset, threads)
print("Saving results.")
save(file=fout, result, subset)
# ------------------------------------------------------------------------------
print("SessionInfo:")
# ------------------------------------------------------------------------------
sessionInfo()
sink()
sink(type="message")