From 8da922d6835097c53d6d434cf6661027b15399a8 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 14 Oct 2021 10:49:41 +0300 Subject: generate lineplot --- scripts/ctl_analysis.R | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/ctl_analysis.R b/scripts/ctl_analysis.R index 738ad04..d9a937f 100644 --- a/scripts/ctl_analysis.R +++ b/scripts/ctl_analysis.R @@ -8,7 +8,7 @@ options(stringsAsFactors = FALSE); args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { - stop("Argument for the geno and pheno file location is required", call.=FALSE) + stop("Argument for the data file", call.=FALSE) } else { # default output file json_file_path = args[1] @@ -28,13 +28,26 @@ ctls <- CTLscan(geno,traits,strategy=input$strategy, nthreads=6,verbose=TRUE) +# same function used in a different script:refactor +genImageRandStr <- function(prefix){ + + randStr <- paste(prefix,stri_rand_strings(1, 9, pattern = "[A-Za-z0-9]"),sep="_") + + return(paste(randStr,".png",sep="")) +} + #output matrix significant CTL interactions with 4 columns: trait, marker, trait, lod sign <- CTLsignificant(ctls,significance = input$significance) + +# Create the lineplot +imageLoc = file.path(imgDir,genImageRandStr("CTLline")) + +png(imageLoc,width=1000,height=600,type='cairo-png') -# add plots +lineplot(res, significance=input$significance) json_data <- list(significance=signs, - images=lists("image_1":"image_location"), + images=lists("image_1"=imageLoc), network_figure_location="/location") \ No newline at end of file -- cgit v1.2.3