aboutsummaryrefslogtreecommitdiff
path: root/scripts/ctl_analysis.R
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-14 10:49:41 +0300
committerBonfaceKilz2022-01-22 09:23:14 +0300
commit8da922d6835097c53d6d434cf6661027b15399a8 (patch)
tree1a52400b59b4aa7f9dd193a1b3c2e7c48b2b6ad1 /scripts/ctl_analysis.R
parent7ba5a5554845a5e08da40cf1c00853c1c798f7b6 (diff)
downloadgenenetwork3-8da922d6835097c53d6d434cf6661027b15399a8.tar.gz
generate lineplot
Diffstat (limited to 'scripts/ctl_analysis.R')
-rw-r--r--scripts/ctl_analysis.R19
1 files 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