/
workflow.cwl
executable file
·69 lines (63 loc) · 1.83 KB
/
workflow.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
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.0
requirements:
SubworkflowFeatureRequirement: {}
ScatterFeatureRequirement: {}
inputs:
clusters:
type: Directory
label: A directory of directories
doc: |
Each sub-directory should contain a single protein (aa.fa) and a single
nucleotide sequence (nt.fa) file. The name of the sub-directory will be
preserved.
outputs:
results:
type: File[]
outputSource: alignment/results
names:
type: string[]
outputSource: extract_clusters/names
steps:
extract_clusters:
in:
clusters: clusters
out: [ proteins, nucleotides, names ]
run:
class: ExpressionTool
requirements: { InlineJavascriptRequirement: {}}
inputs:
clusters: Directory
outputs:
proteins: File[]
nucleotides: File[]
names: string[]
expression: |
${ var proteins = [];
var nucleotides = [];
var names = [];
inputs.clusters.listing.forEach(function (item) {
if (item.class == "Directory") {
names.push(item.basename);
item.listing.forEach(function (item2) {
if (item2.basename.startsWith("nt")) {
nucleotides.push(item2);
} else if (item2.basename.startsWith("aa")) {
proteins.push(item2);
};
});
};
});
return { "proteins": proteins,
"nucleotides": nucleotides,
"names": names };
}
alignment:
run: per_cluster_workflow.cwl
in:
proteins_to_align: extract_clusters/proteins
nucleotides: extract_clusters/nucleotides
out: [ results ]
scatter: [ proteins_to_align, nucleotides ]
scatterMethod: dotproduct