-
Notifications
You must be signed in to change notification settings - Fork 0
/
preprocess_vcf.cwl
120 lines (109 loc) · 3.3 KB
/
preprocess_vcf.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
117
118
119
120
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow
doc: |
This workflow will perform preprocessing steps on VCFs for the OxoG/Variantbam/Annotation workflow.
dct:creator:
foaf:name: "Solomon Shorser"
foaf:mbox: "solomon.shorser@oicr.on.ca"
requirements:
- class: SchemaDefRequirement
types:
- $import: PreprocessedFilesType.yaml
- class: ScatterFeatureRequirement
- class: StepInputExpressionRequirement
- class: MultipleInputFeatureRequirement
- class: InlineJavascriptRequirement
expressionLib:
- { $include: ./preprocess_util.js }
- class: SubworkflowFeatureRequirement
inputs:
- id: vcfdir
type: Directory
doc: "The directory where the files are"
- id: filesToPreprocess
type: string[]
doc: "The files to process"
- id: ref
type: File
doc: "Reference file, used for normalized INDELs"
- id: out_dir
type: string
doc: "The name of the output directory"
# There are three output sets:
# - The merged VCFs.
# - The VCFs that are cleaned and normalized.
# - The SNVs that were extracted from INDELs (if there were any - usually there are none).
outputs:
preprocessedFiles:
type: "PreprocessedFilesType.yaml#PreprocessedFileset"
outputSource: populate_output_record/output_record
steps:
# TODO: Exclude MUSE files from PASS-filtering. MUSE files still need to be cleaned, but should
# not be PASS-filtered.
pass_filter:
doc: "Filter out non-PASS lines from the VCFs in filesToProcess."
in:
vcfdir: vcfdir
filesToFilter:
source: [ filesToPreprocess ]
valueFrom: |
${
var VCFs = []
for (var i in self)
{
if (self[i].toLowerCase().indexOf("muse") == -1)
{
VCFs.push(self[i]);
}
}
return VCFs;
}
run: pass-filter.cwl
out: [output]
clean:
doc: "Clean the VCFs."
run: clean_vcf.cwl
scatter: [vcf]
in:
vcf: pass_filter/output
out: [clean_vcf]
filter_for_indel:
doc: "Filters the input list and selects the INDEL VCFs."
in:
in_vcf: clean/clean_vcf
out: [out_vcf]
run:
class: ExpressionTool
inputs:
in_vcf: File[]
outputs:
out_vcf: File[]
expression: |
$({ out_vcf: filterForIndels(inputs.in_vcf) })
normalize:
doc: "Normalize the INDEL VCFs."
run: normalize.cwl
scatter: normalize/vcf
in:
vcf:
source: filter_for_indel/out_vcf
ref: ref
out: [normalized-vcf]
populate_output_record:
in:
normalizedVcfs: normalize/normalized-vcf
out:
[output_record]
run:
class: ExpressionTool
inputs:
normalizedVcfs: File[]
outputs:
output_record: "PreprocessedFilesType.yaml#PreprocessedFileset"
expression: |
$(
{output_record: {
"normalizedVcfs": inputs.normalizedVcfs
}}
)