From 95620e1aef5a9c56875845769d58d2aab20dacca Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 23 Sep 2021 12:37:51 +0300 Subject: pass other variables from user input for network constr --- scripts/wgcna_analysis.R | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R index d0ba91a..73d0e3f 100644 --- a/scripts/wgcna_analysis.R +++ b/scripts/wgcna_analysis.R @@ -13,12 +13,19 @@ imgDir = Sys.getenv("GENERATED_IMAGE_DIR") results <- fromJSON(file = "file_path.json") -# trait_sample_data <- results$trait_sample_data -trait_sample_data <- do.call(rbind, results$trait_sample_data) +# parse the json data input + +minModuleSize <-results$minModuleSize + +TOMtype <-results$TOMtype + +corType <-results$corType +# + +trait_sample_data <- do.call(rbind, results$trait_sample_data) dataExpr <- data.frame(apply(trait_sample_data, 2, function(x) as.numeric(as.character(x)))) -# trait_sample_data <- as.data.frame(t(results$trait_sample_data)) # transform expressionData dataExpr <- data.frame(t(dataExpr)) @@ -49,18 +56,18 @@ sft <- pickSoftThreshold(dataExpr, powerVector = powers, verbose = 5) # pass user options network <- blockwiseModules(dataExpr, #similarity matrix options - corType = "pearson", + corType = corType, #adjacency matrix options power = 5, networkType = "unsigned", #TOM options - TOMtype = "unsigned", + TOMtype = TOMtype, #module indentification - minmodulesSize = 30, - deepSplit = 5, + minmodulesSize = minModuleSize, + deepSplit = 3, PamRespectsDendro = FALSE ) @@ -76,7 +83,7 @@ genImageRandStr <- function(prefix){ mergedColors <- labels2colors(network$colors) imageLoc <- file.path(imgDir,genImageRandStr("WGCNAoutput")) - +imageLoc png(imageLoc,width=1000,height=600,type='cairo-png') plotDendroAndColors(network$dendrograms[[1]],mergedColors[network$blockGenes[[1]]], -- cgit v1.2.3