about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-23 14:22:14 +0300
committerAlexander Kabui2021-09-23 14:22:14 +0300
commit9216b6ae956b5c78a9b6d21dbd40b6df1e111264 (patch)
tree11fb8e7b222a6b65584b58c6afadbb751136d142
parent655343aded3ece533f267bd9fd16aadf0cefff02 (diff)
downloadgenenetwork3-9216b6ae956b5c78a9b6d21dbd40b6df1e111264.tar.gz
validate required output
-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