aboutsummaryrefslogtreecommitdiff
path: root/scripts/ctl_analysis.R
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-13 14:54:58 +0300
committerBonfaceKilz2022-01-22 09:23:14 +0300
commit7ba5a5554845a5e08da40cf1c00853c1c798f7b6 (patch)
tree07eb7a026807e12eab0528031e69800d31632585 /scripts/ctl_analysis.R
parent541af4ab39c911102fb89beedaa430e282bdb529 (diff)
downloadgenenetwork3-7ba5a5554845a5e08da40cf1c00853c1c798f7b6.tar.gz
minor fix:read input data from json file
Diffstat (limited to 'scripts/ctl_analysis.R')
-rw-r--r--scripts/ctl_analysis.R13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/ctl_analysis.R b/scripts/ctl_analysis.R
index 24a86a8..738ad04 100644
--- a/scripts/ctl_analysis.R
+++ b/scripts/ctl_analysis.R
@@ -1,4 +1,7 @@
library(ctl)
+library(rjson)
+
+options(stringsAsFactors = FALSE);
# The genotypes.csv file containing the genotype matrix is stored individuals (rows) x genetic marker (columns):
@@ -8,16 +11,16 @@ if (length(args)==0) {
stop("Argument for the geno and pheno file location is required", call.=FALSE)
} else {
# default output file
- geno_file = args[1]
- pheno_file = args[2]
+ json_file_path = args[1]
}
+# add validation for the files
+input <- fromJSON(file = json_file_path)
-
-genotypes <- read.csv(geno_file,row.names=1, header=FALSE, sep="\t")
+genotypes <- read.csv(input$geno_file,row.names=1, header=FALSE, sep="\t")
# The phenotypes.csv file containing individuals (rows) x traits (columns) measurements:
-traits <- read.csv(pheno_file,row.names=1, header=FALSE, sep="\t")
+traits <- read.csv(input$pheno_file,row.names=1, header=FALSE, sep="\t")
ctls <- CTLscan(geno,traits,strategy=input$strategy,