-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrqcfilter.wdl
More file actions
82 lines (73 loc) · 2.85 KB
/
Copy pathrqcfilter.wdl
File metadata and controls
82 lines (73 loc) · 2.85 KB
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
version 1.0
import "shortReadsqc.wdl" as srqc
import "longReadsqc.wdl" as lrqc
import "sra2fastq.wdl" as sra
workflow rqcfilter{
input {
Array[File]? input_files
Array[File]? input_fq1
Array[File]? input_fq2
Array[String]? accessions
File? reference
String proj
Boolean interleaved
Boolean shortRead
Boolean? chastityfilter_flag
Boolean? filterbytile_flag
}
Boolean has_accessions = defined(accessions) && length(select_first([accessions, []])) > 0
if (has_accessions) {
call sra.sra as sra2fastq {
input:
accessions = select_first([accessions, []])
}
}
Boolean is_shortReads = select_first([sra2fastq.isIllumina, shortRead])
Boolean is_interleaved = if (has_accessions) then false else interleaved
Boolean is_Pacbio = select_first([sra2fastq.isPacBio, !shortRead])
Boolean unsupported_platform = !(is_shortReads) && !(is_Pacbio)
if (unsupported_platform) {
call UnsupportedPlatformNotice
}
if (is_shortReads) {
call srqc.ShortReadsQC {
input:
input_files = input_files,
input_fq1 = if is_interleaved then [] else select_first([sra2fastq.output_fq1, input_fq1]),
input_fq2 = if is_interleaved then [] else select_first([sra2fastq.output_fq2, input_fq2]),
interleaved = is_interleaved,
proj = proj,
chastityfilter_flag = if (has_accessions) then false else chastityfilter_flag,
filterbytile_flag = if (has_accessions) then false else filterbytile_flag
}
}
if (is_Pacbio) {
call lrqc.LongReadsQC {
input:
file = select_first([sra2fastq.outputFiles, input_files])[0],
proj = proj,
reference = reference
}
}
output {
Array[String]? sra_fastq_files = sra2fastq.outputFiles
String? unsupported_platform_msg = UnsupportedPlatformNotice.msg
File? filtered_final = if (is_shortReads) then ShortReadsQC.filtered_final else LongReadsQC.filtered_final
File? filtered_stats_final = if (is_shortReads) then ShortReadsQC.filtered_stats_final else LongReadsQC.filtered_stats1
File? filtered_stats2_final = if (is_shortReads) then ShortReadsQC.filtered_stats2_final else LongReadsQC.filtered_stats2
File? rqc_info = if (is_shortReads) then ShortReadsQC.rqc_info else LongReadsQC.rqc_info
File? stats = if (is_shortReads) then ShortReadsQC.qa_json else LongReadsQC.stats
}
}
task UnsupportedPlatformNotice {
command {
echo "ERROR: Only Illumina and PacBio sequencing platforms are supported at this time." >&2
}
output {
String msg = read_string(stderr())
}
runtime {
memory: "1 GiB"
cpu: 1
}
}