diff options
Diffstat (limited to 'scripts/wgcna_analysis.R')
-rw-r--r-- | scripts/wgcna_analysis.R | 18 |
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) - - - - - - |