-
Notifications
You must be signed in to change notification settings - Fork 1
/
saige-association-testing.wdl
221 lines (172 loc) · 4.18 KB
/
saige-association-testing.wdl
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
task split_vcf {
File inFile
Int chr
Int? mem
Int cpu
Int preempt
Int disk
File inFileIndex
command <<<
bcftools view -r chr${chr} ${inFile} |bgzip > chr${chr}.vcf.gz
bcftools index chr${chr}.vcf.gz
>>>
output {
File vcf = "chr${chr}.vcf.gz"
File vcf_ind= "chr${chr}.vcf.gz.csi"
}
runtime {
disks: "local-disk ${disk} HDD"
cpu: "${cpu}"
memory: "${mem} GB"
preemptible: "${preempt}"
docker: "vandhanak/bcftools:1.3.1"
}
}
task fit_null {
# input data
# flags and fields
String phenotype
String trait_type
String? covariate_list
String covariate_line = if defined(covariate_list) then '--covarColList=' + covariate_list else ''
String id_col
# files
File covariates_file
File inbed
File inbim
File infam
# runtime parameters
Int cpu
Int disk
Int mem
Int preempt
command <<<
basename=$(basename ${inbed} .bed)
directory=$(dirname ${inbed})
plink_path="$directory"/"$basename"
step1_fitNULLGLMM.R \
--plinkFile=$plink_path \
--phenoFile=${covariates_file} \
--phenoCol=${phenotype} \
${covariate_line} \
--invNormalize=F \
--sampleIDColinphenoFile=${id_col} \
--traitType=quantitative \
--nThreads=${cpu} \
--outputPrefix=step1
>>>
output {
File gmmat = "step1.rda"
File variance_ratio = "step1.varianceRatio.txt"
}
runtime {
disks: "local-disk ${disk} HDD"
cpu: "${cpu}"
memory: "${mem} GB"
preemptible: "${preempt}"
docker: "finngen/saige:0.39.1.fg"
}
}
task spa {
# input files
File inVCF
File inVCF_index
# input options
Int chr
File samples
File varianceRatio
File gmmat
String genotype
# runtime parameters
Int cpu
Int disk
Int mem
Int preempt
command <<<
step2_SPAtests.R \
--vcfFile=${inVCF} \
--vcfFileIndex=${inVCF_index} \
--vcfField=${genotype} \
--chrom=chr${chr} \
--minMAF=0.01 \
--minMAC=1 \
--sampleFile=${samples} \
--GMMATmodelFile=${gmmat} \
--varianceRatioFile=${varianceRatio} \
--SAIGEOutputFile=${chr}.saige2.out.SAIGE.txt.gz \
--numLinesOutput=2 \
--IsOutputAFinCaseCtrl=TRUE
>>>
output {
File sum_stat="${chr}.saige2.out.SAIGE.txt.gz"
}
runtime {
disks: "local-disk ${disk} HDD"
cpu: "${cpu}"
memory: "${mem} GB"
preemptible: "${preempt}"
docker: "finngen/saige:0.39.1.fg"
}
}
workflow saige {
# input files
File covariates_file
String phenotype
File inbed
File inbim
File infam
File samples
File inVCF
File inVCF_index
# input options
String? covariate_list
Int chr
String genotype
String id_col
# runtime parameters
Int? cpu = 4
Int? disk = 100
Int? mem = 32
Int? preempt = 3
call split_vcf {
input:
cpu=cpu,
mem=mem,
preempt=preempt,
disk=disk,
chr=chr,
inFile=inVCF,
inFileIndex=inVCF_index
}
call fit_null {
input:
covariates_file=covariates_file,
phenotype=phenotype,
inbed=inbed,
inbim=inbim,
infam=infam,
covariate_list=covariate_list,
id_col=id_col,
cpu=cpu,
mem=mem,
preempt=preempt,
disk=disk
}
call spa {
input:
inVCF=split_vcf.vcf,
inVCF_index=split_vcf.vcf_ind,
chr=chr,
samples=samples,
varianceRatio=fit_null.variance_ratio,
gmmat=fit_null.gmmat,
genotype=genotype,
cpu=cpu,
mem=mem,
preempt=preempt,
disk=disk
}
output{
File sum_stats = spa.sum_stat
}
}