forked from YPARK/gtex-fqtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.matrix.qtl.R
executable file
·40 lines (30 loc) · 988 Bytes
/
run.matrix.qtl.R
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
38
39
40
#!/usr/bin/env Rscript
argv <- commandArgs(trailingOnly = TRUE)
if(length(argv) < 3) {
q()
}
y.file <- argv[1] # e.g., y.file = 'scratch/simulation/data/13125/3/0.2/3/10/1001-temp.y.txt.gz'
plink.hdr <- argv[2] # e.g., plink.hdr = 'scratch/simulation/data/13125/3/0.2/3/10/1001-temp'
me.out.file <- argv[3] # e.g., me.out.file = 'temp.me.txt'
covar.file <- NULL
if(length(argv) > 3) {
covar.file <- argv[4]
}
source('Sim.R')
source('Util.R')
source('Util.matrix.qtl.R')
## run MatrixEQTL
options(stringsAsFactors = FALSE)
library(fqtl)
plink <- read.plink(plink.hdr)
Y <- center(as.matrix(read.table(y.file)))
if(!is.null(covar.file)){
C <- center(as.matrix(read.table(covar.file)))
} else {
C <- NULL
}
snp.names <- plink$BIM[, 2]
individuals <- plink$FAM[, 1]
me <- run.matrix.qtl(X = center(plink$BED), Y, C, snp.names, individuals, me.out.file)
## eqtl.tab <- read.table(me$param$output_file_name, header = TRUE)
## system(paste('gzip', me.out.file))