Skip to content

Commit e2a05df

Browse files
committed
Support draft-3 long form input arrays
1 parent 5a2f23a commit e2a05df

File tree

4 files changed

+659
-11
lines changed

4 files changed

+659
-11
lines changed

cwlupgrader/main.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -586,18 +586,20 @@ def input_output_clean(document: Dict[str, Any]) -> None:
586586
if "$import" in param:
587587
meta = True
588588
if not meta:
589-
for index2, param in enumerate(document[param_type]):
589+
for index2, param2 in enumerate(document[param_type]):
590590
with SourceLine(document[param_type], index2, Exception):
591-
param_id = param.pop("id").lstrip("#")
592-
if "type" in param:
593-
param["type"] = shorten_type(param["type"])
594-
array_type_raise_sf(param)
595-
if "description" in param:
596-
param["doc"] = param.pop("description")
597-
if len(param) > 1:
598-
new_section[param_id] = sort_input_or_output(param)
591+
param_id = param2.pop("id").lstrip("#")
592+
if "type" in param2:
593+
param2["type"] = shorten_type(param2["type"])
594+
array_type_raise_sf(param2)
595+
if "description" in param2:
596+
param2["doc"] = param2.pop("description")
597+
if len(param2) > 1:
598+
new_section[param_id] = sort_input_or_output(param2)
599+
elif "type" in param2 and isinstance(param2["type"], str):
600+
new_section[param_id] = param2.popitem()[1]
599601
else:
600-
new_section[param_id] = param.popitem()[1]
602+
new_section[param_id] = param2
601603
document[param_type] = new_section
602604

603605

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
#!/usr/bin/env cwl-runner
2+
3+
# Source: https://github.com/jorvis/GALES/blob/cc869204cdb004a7c952900692a97b4edd228e6d/cwl/tools/attributor-prok-cheetah.cwl
4+
# Copyright (c) 2016 Joshua Orvis
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
cwlVersion: "cwl:draft-3"
25+
26+
class: CommandLineTool
27+
baseCommand: attributor
28+
29+
requirements:
30+
- class: InlineJavascriptRequirement
31+
- class: CreateFileRequirement
32+
fileDef:
33+
- filename: attributor.config
34+
fileContent: |
35+
general:
36+
default_product_name: hypothetical protein
37+
allow_attributes_from_multiple_sources: No
38+
debugging_polypeptide_limit: 0
39+
indexes:
40+
coding_hmm_lib: $(inputs.hmm_attribute_lookup_file.path)
41+
uniref100: $(inputs.blast_attribute_lookup_file.path)
42+
input:
43+
polypeptide_fasta: $(inputs.polypeptide_fasta.path)
44+
gff3: $(inputs.source_gff3.path)
45+
order:
46+
- coding_hmm_lib__equivalog
47+
- rapsearch2__trusted_full_full
48+
- coding_hmm_lib__equivalog_domain
49+
- rapsearch2__trusted_partial_full
50+
- coding_hmm_lib__subfamily
51+
- coding_hmm_lib__superfamily
52+
- coding_hmm_lib__subfamily_domain
53+
- coding_hmm_lib__domain
54+
- coding_hmm_lib__pfam
55+
- rapsearch2__trusted_full_partial
56+
- rapsearch2__all_full_full
57+
- tmhmm
58+
#- lipoprotein_motif
59+
- coding_hmm_lib__hypothetical_equivalog
60+
evidence:
61+
- label: coding_hmm_lib__equivalog
62+
type: HMMer3_htab
63+
path: ${
64+
var r = "";
65+
for (var i = 0; i < inputs.hmm_files.length; i++) {
66+
if (i > 0) {
67+
r += ",";
68+
}
69+
r += inputs.hmm_files[i].path.replace('file://','');
70+
}
71+
return r;
72+
}
73+
class: equivalog
74+
index: coding_hmm_lib
75+
76+
- label: coding_hmm_lib__equivalog_domain
77+
type: HMMer3_htab
78+
path: ${
79+
var r = "";
80+
for (var i = 0; i < inputs.hmm_files.length; i++) {
81+
if (i > 0) {
82+
r += ",";
83+
}
84+
r += inputs.hmm_files[i].path.replace('file://','');
85+
}
86+
return r;
87+
}
88+
class: equivalog_domain
89+
index: coding_hmm_lib
90+
91+
- label: coding_hmm_lib__subfamily
92+
type: HMMer3_htab
93+
path: ${
94+
var r = "";
95+
for (var i = 0; i < inputs.hmm_files.length; i++) {
96+
if (i > 0) {
97+
r += ",";
98+
}
99+
r += inputs.hmm_files[i].path.replace('file://','');
100+
}
101+
return r;
102+
}
103+
class: subfamily
104+
index: coding_hmm_lib
105+
append_text: family protein
106+
107+
- label: coding_hmm_lib__superfamily
108+
type: HMMer3_htab
109+
path: ${
110+
var r = "";
111+
for (var i = 0; i < inputs.hmm_files.length; i++) {
112+
if (i > 0) {
113+
r += ",";
114+
}
115+
r += inputs.hmm_files[i].path.replace('file://','');
116+
}
117+
return r;
118+
}
119+
class: superfamily
120+
index: coding_hmm_lib
121+
append_text: family protein
122+
123+
- label: coding_hmm_lib__subfamily_domain
124+
type: HMMer3_htab
125+
path: ${
126+
var r = "";
127+
for (var i = 0; i < inputs.hmm_files.length; i++) {
128+
if (i > 0) {
129+
r += ",";
130+
}
131+
r += inputs.hmm_files[i].path.replace('file://','');
132+
}
133+
return r;
134+
}
135+
class: subfamily_domain
136+
index: coding_hmm_lib
137+
append_text: domain protein
138+
139+
- label: coding_hmm_lib__domain
140+
type: HMMer3_htab
141+
path: ${
142+
var r = "";
143+
for (var i = 0; i < inputs.hmm_files.length; i++) {
144+
if (i > 0) {
145+
r += ",";
146+
}
147+
r += inputs.hmm_files[i].path.replace('file://','');
148+
}
149+
return r;
150+
}
151+
class: domain
152+
index: coding_hmm_lib
153+
append_text: domain protein
154+
155+
- label: coding_hmm_lib__pfam
156+
type: HMMer3_htab
157+
path: ${
158+
var r = "";
159+
for (var i = 0; i < inputs.hmm_files.length; i++) {
160+
if (i > 0) {
161+
r += ",";
162+
}
163+
r += inputs.hmm_files[i].path.replace('file://','');
164+
}
165+
return r;
166+
}
167+
class: pfam
168+
index: coding_hmm_lib
169+
append_text: family protein
170+
171+
- label: coding_hmm_lib__hypothetical_equivalog
172+
type: HMMer3_htab
173+
path: ${
174+
var r = "";
175+
for (var i = 0; i < inputs.hmm_files.length; i++) {
176+
if (i > 0) {
177+
r += ",";
178+
}
179+
r += inputs.hmm_files[i].path.replace('file://','');
180+
}
181+
return r;
182+
}
183+
class: hypoth_equivalog
184+
index: coding_hmm_lib
185+
186+
- label: rapsearch2__trusted_full_full
187+
type: RAPSearch2_m8
188+
path: ${
189+
var r = "";
190+
for (var i = 0; i < inputs.m8_files.length; i++) {
191+
if (i > 0) {
192+
r += ",";
193+
}
194+
r += inputs.m8_files[i].path.replace('file://','');
195+
}
196+
return r;
197+
}
198+
class: trusted
199+
index: uniref100
200+
query_cov: 80%
201+
match_cov: 80%
202+
percent_identity_cutoff: 50%
203+
204+
- label: rapsearch2__trusted_partial_full
205+
type: RAPSearch2_m8
206+
path: ${
207+
var r = "";
208+
for (var i = 0; i < inputs.m8_files.length; i++) {
209+
if (i > 0) {
210+
r += ",";
211+
}
212+
r += inputs.m8_files[i].path.replace('file://','');
213+
}
214+
return r;
215+
}
216+
class: trusted
217+
index: uniref100
218+
match_cov: 80%
219+
percent_identity_cutoff: 50%
220+
append_text: domain protein
221+
222+
- label: rapsearch2__trusted_full_partial
223+
type: RAPSearch2_m8
224+
path: ${
225+
var r = "";
226+
for (var i = 0; i < inputs.m8_files.length; i++) {
227+
if (i > 0) {
228+
r += ",";
229+
}
230+
r += inputs.m8_files[i].path.replace('file://','');
231+
}
232+
return r;
233+
}
234+
class: trusted
235+
index: uniref100
236+
query_cov: 80%
237+
percent_identity_cutoff: 50%
238+
append_text: domain protein
239+
240+
- label: rapsearch2__all_full_full
241+
type: RAPSearch2_m8
242+
path: ${
243+
var r = "";
244+
for (var i = 0; i < inputs.m8_files.length; i++) {
245+
if (i > 0) {
246+
r += ",";
247+
}
248+
r += inputs.m8_files[i].path.replace('file://','');
249+
}
250+
return r;
251+
}
252+
index: uniref100
253+
query_cov: 80%
254+
match_cov: 80%
255+
percent_identity_cutoff: 50%
256+
prepend_text: putative
257+
258+
- label: tmhmm
259+
type: TMHMM
260+
product_name: putative integral membrane protein
261+
min_helical_spans: 5
262+
path: ${
263+
var r = "";
264+
for (var i = 0; i < inputs.tmhmm_files.length; i++) {
265+
if (i > 0) {
266+
r += ",";
267+
}
268+
r += inputs.tmhmm_files[i].path.replace('file://','');
269+
}
270+
return r;
271+
}
272+
273+
hints:
274+
- class: DockerRequirement
275+
dockerPull: jorvis/gales-gce
276+
277+
inputs:
278+
- id: config_file
279+
type: string
280+
inputBinding:
281+
prefix: -c
282+
separate: true
283+
position: 1
284+
- id: output_base
285+
type: string
286+
inputBinding:
287+
position: 2
288+
prefix: -o
289+
separate: true
290+
- id: output_format
291+
type: string
292+
inputBinding:
293+
position: 3
294+
prefix: -f
295+
separate: true
296+
- id: hmm_attribute_lookup_file
297+
type: File
298+
- id: blast_attribute_lookup_file
299+
type: File
300+
- id: polypeptide_fasta
301+
type: File
302+
- id: source_gff3
303+
type: File
304+
- id: hmm_files
305+
type:
306+
type: array
307+
items: File
308+
- id: m8_files
309+
type:
310+
type: array
311+
items: File
312+
- id: tmhmm_files
313+
type:
314+
type: array
315+
items: File
316+
317+
318+
outputs:
319+
- id: output_files
320+
type:
321+
type: array
322+
items: File
323+
outputBinding:
324+
glob: $(inputs.output_base + '*')
325+
- id: the_config
326+
type: File
327+
outputBinding:
328+
glob: 'attributor.config'

0 commit comments

Comments
 (0)