aboutsummaryrefslogtreecommitdiff
path: root/scripts/wgcna_analysis.R
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/wgcna_analysis.R')
-rw-r--r--scripts/wgcna_analysis.R13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R
index 53b59d5..86ddffb 100644
--- a/scripts/wgcna_analysis.R
+++ b/scripts/wgcna_analysis.R
@@ -14,7 +14,7 @@ imgDir = Sys.getenv("GENERATED_IMAGE_DIR")
args = commandArgs(trailingOnly=TRUE)
if (length(args)==0) {
- stop("Argument for the file location is requires", call.=FALSE)
+ stop("Argument for the file location is required", call.=FALSE)
} else {
# default output file
json_file_path = args[1]
@@ -92,7 +92,6 @@ 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]]],
@@ -102,3 +101,13 @@ addGuide = TRUE, guideHang = 0.05)
+
+json_data <- list(ModEigens=network$MEs,soft_threshold=sft$fitIndices,
+ blockGenes =network$blockGenes[[1]],
+ net_colors =network$colors,
+ net_unmerged=network$unmergedColors,
+ imageLoc=imageLoc)
+
+json_data <- toJSON(json_data)
+
+write(json_data,"./output.json") \ No newline at end of file