From 4a8e40f7331f61ba8b7038e8ad48f86018ac7dc6 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 23 Sep 2021 12:47:27 +0300 Subject: pass json file path as an arg --- scripts/wgcna_analysis.R | 13 +++++++++++-- 1 file 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 -- cgit v1.2.3