-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFastQC.wdl
138 lines (120 loc) · 3.18 KB
/
FastQC.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
## script to run fastqc and
version 1.0
workflow Fastqc {
input {
File f1
File? f2
String sampleName
Int? cpu = 1
# Adaptor (check documentation)
File? adap
Boolean runTrimmomatic
String settings = ":2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36"
}
String mode = if defined(f2) then "PE" else "SE"
call fastqc as fastq1 {
input: f1=f1,
f2=f2,
cpu=cpu,
mode=mode
}
if (runTrimmomatic){
call trim_PE {
input: f1=f1,
f2=f2,
cpu=cpu,
sampleName=sampleName,
adap=adap,
settings=settings,
mode=mode
}
call fastqc as fastq2 {
input: f1=trim_PE.out_p1,
f2=trim_PE.out_p2,
cpu=cpu,
mode=mode
}
}
output {
File pre_html = fastq1.html
File pre_zip = fastq1.zip
File? post_html = fastq2.html
File? post_zip = fastq2.zip
File? trim_f1 = trim_PE.out_p1
File? trim_f2 = trim_PE.out_p2
}
}
task trim_PE {
input {
File f1
File? f2
Int? cpu=1
Int? machine_mem_gb
Int? requested_disk
Int? preemptible_attempts
File? adap
String sampleName
String mode
String settings = ":2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36"
}
Int disk_space_gb=ceil(3*(size(f1, "GB")+size(f2, "GB")))
File adap_def = select_first([adap,"/opt/trimmomatic/adapters/TruSeq3-PE.fa"])
String p1 = sampleName + "Trim_R1.fq.gz"
String p2 = sampleName + "Trim_R2.fq.gz"
String u1 = sampleName + "Trim_unpaired_R1.fq.gz"
String u2 = sampleName + "Trim_unpaired_R2.fq.gz"
command <<<
if [ ~{mode} == "PE" ]; then
trimmomatic PE -threads ~{cpu} -phred33 ~{f1} ~{f2} \
~{p1} ~{u1} ~{p2} ~{u2} ILLUMINACLIP:~{adap_def}~{settings}
else
trimmomatic SE -threads ~{cpu} -phred33 ~{f1} ~{p1} ILLUMINACLIP:~{adap_def}~{settings}
fi
>>>
output {
File out_p1 = "~{p1}"
File? out_p2 = "~{p2}"
File out_u1 = "~{u1}"
File? out_u2 = "~{u2}"
}
runtime {
docker: "bmwlee/usyd_trimmomatic:0.36"
memory: select_first([machine_mem_gb, 4]) + " GB"
cpu: cpu
disks: "local-disk " + disk_space_gb + " HDD"
preemptible: select_first([preemptible_attempts, 3])
}
}
task fastqc {
input {
File f1
File? f2
Int? cpu
Int? machine_mem_gb
Int? preemptible_attempts
String mode
Int? requested_disk
}
# Disk space calculation
Float f2size = if (mode == "PE") then size(f2, "GB") else 0.0
Int predicted_disk = ceil(3*(size(f1, "GB")+f2size))
Int disk_space_gb = select_first([requested_disk,predicted_disk])
command <<<
f2comm=""
if [ mode == "PE" ]; then
f2comm="~{f2}"
fi
fastqc -t ~{cpu} --outdir $PWD ~{f1} $f2comm
>>>
output {
File html = glob("*html")[0]
File zip = glob("*zip")[0]
}
runtime {
docker: "biocontainers/fastqc:v0.11.5_cv2"
memory: select_first([machine_mem_gb, 4]) + " GB"
cpu: cpu
disks: "local-disk " + disk_space_gb + " HDD"
preemptible: select_first([preemptible_attempts, 3])
}
}