From 453570cbf22a92de72fa0401895c99a923831942 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 15:14:25 +0300 Subject: script modification : add debug statements --- scripts/wgcna_analysis.R | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'scripts/wgcna_analysis.R') diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R index 17b3537..a5cbbe3 100644 --- a/scripts/wgcna_analysis.R +++ b/scripts/wgcna_analysis.R @@ -6,11 +6,15 @@ library(rjson) options(stringsAsFactors = FALSE); -imgDir = Sys.getenv("GENERATED_IMAGE_DIR") +cat("Running the wgcna analysis script\n") + # load expression data **assumes from json files row(traits)(columns info+samples) # pass the file_path as arg # pass the file path to read json data + + + args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { @@ -21,6 +25,7 @@ if (length(args)==0) { } inputData <- fromJSON(file = json_file_path) +imgDir = inputData$TMPDIR trait_sample_data <- do.call(rbind, inputData$trait_sample_data) @@ -83,6 +88,11 @@ network <- blockwiseModules(dataExpr, +cat("Generated network \n") + +network + + genImageRandStr <- function(prefix){ randStr <- paste(prefix,stri_rand_strings(1, 9, pattern = "[A-Za-z0-9]"),sep="_") @@ -95,6 +105,10 @@ mergedColors <- labels2colors(network$colors) imageLoc <- file.path(imgDir,genImageRandStr("WGCNAoutput")) png(imageLoc,width=1000,height=600,type='cairo-png') + +cat("Generating the CLuster dendrogram\n") + + plotDendroAndColors(network$dendrograms[[1]],mergedColors[network$blockGenes[[1]]], "Module colors", dendroLabels = FALSE, hang = 0.03, -- cgit v1.2.3 From d1be5270b99959f99802a7704562eeaaeb504122 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 07:29:24 +0300 Subject: minor fixes for sript enable annotations --- scripts/wgcna_analysis.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/wgcna_analysis.R') diff --git a/scripts/wgcna_analysis.R b/scripts/wgcna_analysis.R index a5cbbe3..b0d25a9 100644 --- a/scripts/wgcna_analysis.R +++ b/scripts/wgcna_analysis.R @@ -13,8 +13,6 @@ cat("Running the wgcna analysis script\n") # pass the file path to read json data - - args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { @@ -100,6 +98,7 @@ genImageRandStr <- function(prefix){ return(paste(randStr,".png",sep="")) } + mergedColors <- labels2colors(network$colors) imageLoc <- file.path(imgDir,genImageRandStr("WGCNAoutput")) @@ -111,7 +110,7 @@ cat("Generating the CLuster dendrogram\n") plotDendroAndColors(network$dendrograms[[1]],mergedColors[network$blockGenes[[1]]], "Module colors", -dendroLabels = FALSE, hang = 0.03, +dendroLabels = NULL, hang = 0.03, addGuide = TRUE, guideHang = 0.05) -- cgit v1.2.3