forked from YPARK/gtex-fqtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtil.matrix.qtl.R
executable file
·34 lines (27 loc) · 958 Bytes
/
Util.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
library(MatrixEQTL)
make.s.data <- function(mat, row.names, col.names) {
stopifnot(is.matrix(mat))
ret <- SlicedData$new()
ret$CreateFromMatrix(mat)
rownames(ret) <- row.names
colnames(ret) <- col.names
return(ret)
}
run.matrix.qtl <- function(X, Y, C, snp.names, individuals, me.out.file) {
n.tis <- dim(Y)[2]
n.covar <- dim(C)[2]
y.data <- make.s.data(t(Y), as.character(1:n.tis), individuals)
x.data <- make.s.data(t(X), snp.names, individuals)
if(is.null(C)){
c.data <- SlicedData$new()
} else {
c.data <- make.s.data(t(C), as.character(1:n.covar), individuals)
}
me <- Matrix_eQTL_engine(snps = x.data,
gene = y.data,
cvrt = c.data,
pvOutputThreshold = 1,
noFDRsaveMemory = TRUE,
output_file_name = me.out.file)
return(me)
}