about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-15 02:13:03 +0300
committerAlexander Kabui2021-09-15 02:13:03 +0300
commite0f25dedea08842820424ced51af9af0c7eaab4b (patch)
treed8a9e90ca50d55a4c9c8482fd79ed192b678eac8
parent56092341abe9579b995ff6105722154183b31d22 (diff)
downloadgenenetwork3-e0f25dedea08842820424ced51af9af0c7eaab4b.tar.gz
Fetch IMAGE_DIR env and add img location
-rw-r--r--scripts/wgcna_analysis.R18
1 files changed, 8 insertions, 10 deletions
diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R
index 16a44fd..54650df 100644
--- a/scripts/wgcna_analysis.R
+++ b/scripts/wgcna_analysis.R
@@ -1,10 +1,14 @@
 # initial workspace setup
 
+
+# todo pass required input data here
 library(WGCNA);
 library(stringi);
 
 options(stringsAsFactors = FALSE);
 
+imgDir = Sys.getenv("GENERATED_IMAGE_DIR")
+
 # load expression data **assumes csv format row(traits)(columns info+samples)
 
 wgcnaRawData <- read.csv(file = "wgcna_data.csv")
@@ -33,7 +37,7 @@ dataExpr <- dataExpr[gsg$goodSamples, gsg$goodGenes]
 
 # network constructions and modules
 
-# choose softthreshhold (Calculate soft threshold if the user specified the)
+# choose softthreshhold (Calculate soft threshold)
 
 powers <- c(c(1:10), seq(from = 12, to=20, by=2)) 
 sft <- pickSoftThreshold(dataExpr, powerVector = powers, verbose = 5)
@@ -65,12 +69,12 @@ genImageRandStr <- function(prefix){
 	return(paste(randStr,".png",sep=""))
 }
 
+mergedColors <- labels2colors(net$colors)
 
-mergedColors = labels2colors(net$colors)
-
-png(genImageRandStr,width=1000,height=600,type='cairo-png')
+imageLoc <- file.path(imgDir,genImageRandStr("WGCNAoutput"))
 
 
+png(imageLoc,width=1000,height=600,type='cairo-png')
 
 plotDendroAndColors(network$dendrograms[[1]],mergedColors[net$blockGenes[[1]]],
 "Module colors",
@@ -79,9 +83,3 @@ addGuide = TRUE, guideHang = 0.05)
 
 
 
-
-
-
-
-
-