From 7ba5a5554845a5e08da40cf1c00853c1c798f7b6 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 14:54:58 +0300 Subject: minor fix:read input data from json file --- scripts/ctl_analysis.R | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts') 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, -- cgit v1.2.3