-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_matrixEqtl.R
77 lines (59 loc) · 2.22 KB
/
run_matrixEqtl.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
library(MatrixEQTL)
## 1 012 matrix
## 2 quant.norm tpm
## 3 covariates
## 4 snp pos
## 5 gene pos
## 6 cis distance
## 7 output file name
args <- commandArgs(trailingOnly = TRUE)
SNP_file_name<- args[1]
snps = SlicedData$new();
snps$fileDelimiter = "\t"; # the TAB character
snps$fileOmitCharacters = "NA"; # denote missing values;
snps$fileSkipRows = 1; # one row of column labels
snps$fileSkipColumns = 1; # one column of row labels
snps$fileSliceSize = 20000; # read file in slices of 2,000 rows
snps$LoadFile(SNP_file_name);
expression_file_name<- args[2]
gene = SlicedData$new();
gene$fileDelimiter = "\t"; # the TAB character
gene$fileOmitCharacters = "NA"; # denote missing values;
gene$fileSkipRows = 1; # one row of column labels
gene$fileSkipColumns = 1; # one column of row labels
gene$fileSliceSize = 2000; # read file in slices of 2,000 rows
gene$LoadFile(expression_file_name);
covariates_file_name<- args[3]
cvrt = SlicedData$new();
cvrt$fileDelimiter = "\t"; # the TAB character
cvrt$fileOmitCharacters = "NA"; # denote missing values;
cvrt$fileSkipRows = 1; # one row of column labels
cvrt$fileSkipColumns = 1; # one column of row labels
cvrt$LoadFile(covariates_file_name);
snps_location_file_name<- args[4]
gene_location_file_name<- args[5]
snpspos = read.table(snps_location_file_name, header = TRUE, stringsAsFactors = FALSE);
genepos = read.table(gene_location_file_name, header = TRUE, stringsAsFactors = FALSE);
cisDist<- as.numeric(args[6])
pvOutputThreshold_cis<-0.01
pvOutputThreshold_tra<-0
errorCovariance<-numeric()
useModel<-modelLINEAR
output_file_name_cis <- args[7]
save(snps,gene,cvrt,snpspos,genepos,file = "eQTL.input.Rdata")
me = Matrix_eQTL_main(
snps = snps,
gene = gene,
cvrt = cvrt,
pvOutputThreshold = pvOutputThreshold_tra,
useModel = useModel,
errorCovariance = errorCovariance,
verbose = TRUE,
output_file_name.cis = output_file_name_cis,
pvOutputThreshold.cis = pvOutputThreshold_cis,
snpspos = snpspos,
genepos = genepos,
cisDist = cisDist,
pvalue.hist = "qqplot",
min.pv.by.genesnp = FALSE,
noFDRsaveMemory = FALSE);