From 5eecd54d9f45cf17041497878f7b65a7b656a758 Mon Sep 17 00:00:00 2001 From: Princy Parsana Date: Tue, 12 Feb 2019 16:58:21 -0500 Subject: [PATCH] wgcna module comparison before and after pc correction --- src/wgcna_comparison.R | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/wgcna_comparison.R diff --git a/src/wgcna_comparison.R b/src/wgcna_comparison.R new file mode 100644 index 0000000..7be57b5 --- /dev/null +++ b/src/wgcna_comparison.R @@ -0,0 +1,33 @@ +source("../src/config.R") +source("../src/functions.R") + +## inputArguments +# inputargs <- commandArgs(TRUE) +# dat.fn <- inputargs[1] +# TOMType <- inputargs[2] +# save.fn <- inputargs[3] + +signed_wgcna_fn <- dir(path = "/work-zfs/abattle4/parsana/networks_correction/networks", all.files=T, recursive=T, full.names = T) +signed_wgcna_fn <- signed_wgcna_fn[grep("signed_", signed_wgcna_fn)] +signed_wgcna_fn <- signed_wgcna_fn[grep(paste(c("raw", "rin", "mc", "/pc/"), collapse = "|"), signed_wgcna_fn)] +signed_wgcna_fn <- signed_wgcna_fn[c(3,4,1,2)] + +print(signed_wgcna_fn) +modulesize_all <- lapply(signed_wgcna_fn, function(x){ + load(x) + size_alltiss <- sapply(dat.net, function(y) { + size_thistiss <- lapply(y, function(z) table(z$colors)) + #size_thistiss <- table(y[[50]]$colors) + size_thistiss + }) + size_alltiss + }) + +names(modulesize_all) <- c("uncorrected", "rin", "mc", "pc") + +num_modules <- lapply(modulesize_all, function(x){ + this_num_mod <- sapply(x, length) + this_num_mod + }) + +saveRDS(modulesize_all, file = "../results/wgcna_module_size.Rds")