-
Notifications
You must be signed in to change notification settings - Fork 10
/
remove-fastq-reads-from-blast.cwl
116 lines (111 loc) · 3.25 KB
/
remove-fastq-reads-from-blast.cwl
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
class: Workflow
cwlVersion: v1.2
doc: This workflow clean up vectros from fastq files
label: FASTQ Vector Removal
requirements:
InlineJavascriptRequirement: {}
StepInputExpressionRequirement: {}
SubworkflowFeatureRequirement: {}
ShellCommandRequirement: {}
ScatterFeatureRequirement: {}
inputs:
blastdir: Directory
tax_pickle: File
tax_id: int
fastq1: File
fastq2: File?
threads: int
outputs:
fastq1_output:
outputSource: create_clean_fastq/output
type: File
fastq2_output:
outputSource: create_clean_fastq/output2
type: File?
fastqc1_html:
outputSource: fastqc1/out_html
type: File[]
fastqc1_zip:
outputSource: fastqc1/out_zip
type: File[]
fastqc2_html:
outputSource: fastqc2/out_html
type: File[]?
fastqc2_zip:
outputSource: fastqc2/out_zip
type: File[]?
steps:
contaminated_reads:
label: Get contaminated read IDs
run: ../../tools/python/filter-blastout-query.cwl
in:
blastdir: blastdir
tax_pickle: tax_pickle
tax_id: tax_id
out: { default: "contaminated.ids" }
out: [ output ]
create_clean_fastq:
label: Creates clean FASTQ
run: ../../tools/bbmap/filterbyname.cwl
in:
in: fastq1
in2: fastq2
out:
valueFrom: |
${
var nameroot = inputs.in.nameroot;
if (nameroot.endsWith(".fastq")){
nameroot = nameroot.replace(".fastq", "");
}else if (nameroot.endsWith(".fq")){
nameroot = nameroot.replace(".fq", "");
}
if (nameroot.endsWith("_1")){
nameroot = nameroot.replace('_1', '_noCont_1.fastq.gz');
}else if (nameroot.includes("_R1_")){
nameroot = nameroot.substring(1, nameroot.indexOf("_R1_")) + '_noCont_1.fastq.gz';
} else{
nameroot = nameroot + '_noCont.fastq.gz';
}
return nameroot;
}
out2:
valueFrom: |
${
if (inputs.in2 != null){
var nameroot = inputs.in2.nameroot;
if (nameroot.endsWith(".fastq")){
nameroot = nameroot.replace(".fastq", "");
}else if (nameroot.endsWith(".fq")){
nameroot = nameroot.replace(".fq", "");
}
if (nameroot.endsWith("_2")){
nameroot = nameroot.replace('_2', '_noCont_2.fastq.gz');
}else if (nameroot.includes("_R2_")){
nameroot = nameroot.substring(1, nameroot.indexOf("_R2_")) + '_noCont_2.fastq.gz';
}
return nameroot;
}
return null;
}
names: contaminated_reads/output
include: {default: "f"}
out: [output, output2]
fastqc1:
run: ../../tools/fastqc/fastqc.cwl
label: fastqc
in:
fastq:
source: create_clean_fastq/output
valueFrom: ${ return [ self ]; }
threads: threads
out: [ out_html, out_zip ]
fastqc2:
run: ../../tools/fastqc/fastqc.cwl
when: $(inputs.fastq[0] != null)
label: fastqc
in:
fastq:
source: create_clean_fastq/output2
valueFrom: ${ return [ self ]; }
threads: threads
out: [ out_html, out_zip ]