-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRNA_seq_callvariant.wdl
209 lines (173 loc) · 4.32 KB
/
RNA_seq_callvariant.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
workflow RNACallVariant {
String inputdir
String outputdir
Array[String] inputfirname
String? starpath
String star = select_first([starpath, "/home/tchen/Chentao/software/STAR-2.5.4b/bin/Linux_x86_64/STAR"])
String? picardpath
String picard = select_first([picardpath, "/home/tchen/Chentao/picard.jar"])
String? gatkpath
String gatk = select_first([gatkpath, "/home/tchen/Chentao/software/gatk-4.0.6.0/gatk"])
String starGenomeRefer
String gatkGenomeFastaRefer
Int? thread
Int Thread = select_first([thread, 8])
scatter (files in inputfirname) {
call star_mappint {
input:
STARS = star,
threads = Thread,
STARrefer = starGenomeRefer,
Inputdir = inputdir,
Outputdir = outputdir,
Filename = files
}
}
Array[File] mapbams = star_mappint.outbam
scatter (bam in mapbams) {
call picard_markduplicated {
input:
picards = picard,
bamfile = bam,
Filename = basename(bam, ".Aligned.sortedByCoord.out.bam"),
Outputdir = outputdir
}
}
Array[File] mardupbams = picard_markduplicated.markdupbam
scatter (splitbam in mardupbams) {
call SplitNigarReads {
input:
gatks = gatk,
ref = gatkGenomeFastaRefer,
Inputfile = splitbam,
Filename = basemane(splitbam, ".md.bam"),
Outputdir = outputdir
}
}
Array[File] splitbams = SplitNigarReads.split_bam
scatter (vcf_bam in splitbams) {
call HaplotypeCaller {
input:
gatks = gatk,
ref = gatkGenomeFastaRefer,
Inputfile = vcf_bam,
Outputdir = outputdir,
Filename = basename(vcf_bam, ".md.split.bam")
}
}
Array[File] vcfs = HaplotypeCaller.vcffile
scatter (filter_vcf in vcfs) {
call VariantFilteration {
input:
gatks = gatk,
ref = gatkGenomeFastaRefer,
Inputfile = filter_vcf,
Outputdir = outputdir,
Filename = basename(filter_vcf, ".vcf")
}
}
}
task star_mappint {
String STARS
Int threads
String STARrefer
String Inputdir
String Outputdir
String Filename
command <<<
${STARS} \
--runThreadN ${threads} \
--twopassMode Basic \
--genomeDir ${STARrefer} \
--readFilesIn ${Inputdir}${Filename}_1.clean.fq ${Inputdir}${Filename}_1.clean.fq \
--outFilterType BySJout \
--outFilterMultimapNmax 20 \
--alignSJoverhangMin 8 \
--alignSJDBoverhangMin 1 \
--outFilterMismatchNmax 999 \
--outFilterMismatchNoverReadLmax 0.04 \
--alignIntronMin 20 \
--alignIntronMax 1000000 \
--alignMatesGapMax 1000000 \
--outSAMstrandField intronMotif \
--outSAMattrRGline ID:${Filename} SM:${Filename} PL:illumina LB:${Filename} PU:${Filename} \
--outSAMtype BAM SortedByCoordinate \
--outFileNamePrefix ${Outputdir}${Filename}.
>>>
output {
File outbam = "*.out.bam"
}
}
task picard_markduplicated {
String picards
File bamfile
String Filename
String Outputdir
command <<<
java -jar ${picards} MarkDuplicates \
I=${bamfile} \
O=${Outputdir}${Filename}.md.bam \
M=${Outputdir}${Filename}.md.metrics.txt \
CREATE_INDEX=true
>>>
output {
File markdupbam = "${Outputdir}${Filename}.md.bam"
}
}
task SplitNigarReads {
String gatks
String ref
File Inputfile
String Outputdir
String Filename
command <<<
${gatks} SplitNCigarReads \
-R ${ref} \
-I ${Inputfile} \
-O ${Outputdir}${Filename}.md.split.bam
>>>
output {
File split_bam = "${Outputdir}${Filename}.md.split.bam"
}
}
task HaplotypeCaller {
String gatks
String ref
String Inputfile
String Outputdir
String Filename
command <<<
${gatks} HaplotypeCaller \
-R ${ref} \
--native-pair-hmm-threads 6 \
-I ${Inputfile} \
--dont-use-soft-clipped-bases true \
-stand-call-conf 20.0 \
-O ${Outputdir}${Filename}.vcf
>>>
output {
File vcffile = "${Outputdir}${Filename}.vcf"
}
}
task VariantFilteration {
String gatks
String ref
File Inputfile
String Outputdir
String Filename
command <<<
${gatks} VariantFiltration \
-R ${ref} \
-V ${Inputfile} \
-window 35 \
-cluster 3 \
--filter-name FS \
-filter "FS > 30.0" \
--filter-name QD \
-filter "QD < 2.0" \
-O ${Outputdir}${Filename}.filter.vcf
>>>
output {
File filtervcf = "${Outputdir}${Filename}.filter.vcf"
}
}