aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-23 12:47:27 +0300
committerAlexander Kabui2021-09-23 12:47:27 +0300
commit4a8e40f7331f61ba8b7038e8ad48f86018ac7dc6 (patch)
treecf0a0983561179bee5786079acbb18be52db586f
parent95620e1aef5a9c56875845769d58d2aab20dacca (diff)
downloadgenenetwork3-4a8e40f7331f61ba8b7038e8ad48f86018ac7dc6.tar.gz
pass json file path as an arg
-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 73d0e3f..53b59d5 100644
--- a/scripts/wgcna_analysis.R
+++ b/scripts/wgcna_analysis.R
@@ -7,11 +7,20 @@ library(rjson)
options(stringsAsFactors = FALSE);
imgDir = Sys.getenv("GENERATED_IMAGE_DIR")
-
# 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) {
+ stop("Argument for the file location is requires", call.=FALSE)
+} else {
+ # default output file
+ json_file_path = args[1]
+}
-results <- fromJSON(file = "file_path.json")
+results <- fromJSON(file = json_file_path)
# parse the json data input