diff options
author | Alexander Kabui | 2021-09-14 23:40:17 +0300 |
---|---|---|
committer | Alexander Kabui | 2021-09-14 23:40:17 +0300 |
commit | 49b852baa46c0f06caa2f0621b18d521cf334483 (patch) | |
tree | e800d34f48ec2c14b87d30247dc815360cb272bb | |
parent | b32f4ee074d55d8ab78863d4c5acc652ec9cd839 (diff) | |
download | genenetwork3-49b852baa46c0f06caa2f0621b18d521cf334483.tar.gz |
function to generate rand str for image
-rw-r--r-- | scripts/wgcna_analysis.R | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R index 65ff36e..efe0336 100644 --- a/scripts/wgcna_analysis.R +++ b/scripts/wgcna_analysis.R @@ -1,7 +1,9 @@ # initial workspace setup library(WGCNA); -stringsAsFactors = FALSE +library(stringi); + +options(stringsAsFactors = FALSE); # load expression data **assumes csv format row(traits)(columns info+samples) @@ -64,8 +66,18 @@ mergedColors = labels2colors(net$colors) # generate random name for png && save the image location +genImageRandStr <- function(prefix){ + + randStr <- paste(prefix,stri_rand_strings(1, 9, pattern = "[A-Za-z0-9]"),sep="_") + + return(paste(randStr,".png",sep="")) +} + + + +png(genImageRandStr,width=1000,height=600,type='cairo-png') + -png("WGCNAoutput.png",width=1000,height=600,type='cairo-png') plotDendroAndColors(network$dendrograms[[1]],mergedColors[net$blockGenes[[1]]], "Module colors", |