aboutsummaryrefslogtreecommitdiff
path: root/scripts/ctl_analysis.R
blob: 24a86a87818797d0d6bd4187f8fa93c72babff3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
library(ctl)

# The genotypes.csv file containing the genotype matrix is stored individuals (rows) x genetic marker (columns):

args = commandArgs(trailingOnly=TRUE)

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]
}




genotypes <- read.csv(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")


ctls <- CTLscan(geno,traits,strategy=input$strategy,
	nperm=input$nperms,parametric =input$parametric,
	nthreads=6,verbose=TRUE)



#output matrix significant CTL interactions with 4 columns: trait, marker, trait, lod
sign <- CTLsignificant(ctls,significance = input$significance)

# add plots 


json_data <- list(significance=signs,
	images=lists("image_1":"image_location"),
	network_figure_location="/location")