Skip to content

Commit 9a7c109

Browse files
mvdbeekmr-c
authored andcommitted
Refresh bamtools_stats.cwl from source, keep copy and explicitly test loading invalid schema ref
1 parent e18e725 commit 9a7c109

File tree

3 files changed

+191
-11
lines changed

3 files changed

+191
-11
lines changed

schema_salad/tests/test_examples.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ def test_print_rdf() -> None:
5656
)
5757

5858

59+
def test_print_rdf_invalid_external_ref() -> None:
60+
"""Test --print-rdf when document references unfetchable external schema."""
61+
schema_path = get_data("tests/test_schema/CommonWorkflowLanguage.yml")
62+
document_path = get_data(
63+
"tests/test_real_cwl/bio-cwl-tools/bamtools_stats_invalid_schema_ref.cwl"
64+
)
65+
assert schema_path and document_path
66+
assert 0 == schema_salad.main.main(
67+
argsl=["--print-rdf", schema_path, document_path]
68+
)
69+
70+
5971
def test_print_pre_schema() -> None:
6072
"""Test --print-pre only schema."""
6173
schema_path = get_data("tests/test_schema/CommonWorkflowLanguage.yml")

schema_salad/tests/test_real_cwl/bio-cwl-tools/bamtools_stats.cwl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ cwlVersion: v1.0
33
class: CommandLineTool
44

55
requirements:
6-
- class: InlineJavascriptRequirement
7-
- class: ShellCommandRequirement
6+
InlineJavascriptRequirement: {}
7+
ShellCommandRequirement: {}
88

99
hints:
10-
- class: DockerRequirement
11-
dockerPull: biowardrobe2/bamtools:v2.4.1
12-
- class: SoftwareRequirement
13-
packages:
14-
bamtools:
15-
specs: [ "http://identifiers.org/biotools/bamtools" ]
16-
version: [ "2.4.1" ]
10+
DockerRequirement:
11+
dockerPull: biowardrobe2/bamtools:v2.4.1
12+
SoftwareRequirement:
13+
packages:
14+
bamtools:
15+
specs: [ "http://identifiers.org/biotools/bamtools" ]
16+
version: [ "2.4.1" ]
1717

1818
inputs:
1919

@@ -127,7 +127,7 @@ $namespaces:
127127
s: http://schema.org/
128128

129129
$schemas:
130-
- http://schema.org/version/9.0/schemaorg-current-http.rdf
130+
- https://github.com/schemaorg/schemaorg/raw/main/data/releases/11.01/schemaorg-current-http.rdf
131131

132132
s:name: "bamtools_stats"
133133
s:license: http://www.apache.org/licenses/LICENSE-2.0
@@ -165,4 +165,4 @@ s:creator:
165165
doc: |
166166
Tool runs `bamtools stats' to calculate general alignment statistics from the input BAM file
167167
168-
`-insert` parameter is not implemented
168+
`-insert` parameter is not implemented
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/usr/bin/env cwl-runner
2+
cwlVersion: v1.0
3+
class: CommandLineTool
4+
5+
requirements:
6+
- class: InlineJavascriptRequirement
7+
- class: ShellCommandRequirement
8+
9+
hints:
10+
- class: DockerRequirement
11+
dockerPull: biowardrobe2/bamtools:v2.4.1
12+
- class: SoftwareRequirement
13+
packages:
14+
bamtools:
15+
specs: [ "http://identifiers.org/biotools/bamtools" ]
16+
version: [ "2.4.1" ]
17+
18+
inputs:
19+
20+
bam_file:
21+
type:
22+
- File
23+
inputBinding:
24+
position: 2
25+
prefix: -in
26+
doc: |
27+
the input BAM file
28+
29+
outputs:
30+
31+
log_file:
32+
type: File
33+
outputBinding:
34+
glob: "stats.log"
35+
36+
total_reads_number:
37+
type: int
38+
outputBinding:
39+
loadContents: true
40+
glob: "stats.log"
41+
outputEval: |
42+
${
43+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
44+
var totalReads = parseInt(s.substring ( s.indexOf("Totalreads")+11, s.indexOf("\t", (s.indexOf("Totalreads"))) ));
45+
return totalReads;
46+
}
47+
48+
mapped_reads_number:
49+
type: int
50+
outputBinding:
51+
loadContents: true
52+
glob: "stats.log"
53+
outputEval: |
54+
${
55+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
56+
var mappedreads = parseInt(s.substring ( s.indexOf("Mappedreads")+12, s.indexOf("\t", (s.indexOf("Mappedreads"))) ));
57+
return mappedreads;
58+
}
59+
60+
forward_strand_reads_number:
61+
type: int
62+
outputBinding:
63+
loadContents: true
64+
glob: "stats.log"
65+
outputEval: |
66+
${
67+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
68+
var forwardstrand = parseInt(s.substring ( s.indexOf("Forwardstrand")+14, s.indexOf("\t", (s.indexOf("Forwardstrand"))) ));
69+
return forwardstrand;
70+
}
71+
72+
reverse_strand_reads_number:
73+
type: int
74+
outputBinding:
75+
loadContents: true
76+
glob: "stats.log"
77+
outputEval: |
78+
${
79+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
80+
var reversestrand = parseInt(s.substring ( s.indexOf("Reversestrand")+14, s.indexOf("\t", (s.indexOf("Reversestrand"))) ));
81+
return reversestrand;
82+
}
83+
84+
failed_QC_reads_number:
85+
type: int
86+
outputBinding:
87+
loadContents: true
88+
glob: "stats.log"
89+
outputEval: |
90+
${
91+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
92+
var failedQC = parseInt(s.substring ( s.indexOf("FailedQC")+9, s.indexOf("\t", (s.indexOf("FailedQC"))) ));
93+
return failedQC;
94+
}
95+
96+
duplicate_reads_number:
97+
type: int
98+
outputBinding:
99+
loadContents: true
100+
glob: "stats.log"
101+
outputEval: |
102+
${
103+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
104+
var duplicates = parseInt(s.substring ( s.indexOf("Duplicates")+11, s.indexOf("\t", (s.indexOf("Duplicates"))) ));
105+
return duplicates;
106+
}
107+
108+
pairedend_reads_number:
109+
type: int
110+
outputBinding:
111+
loadContents: true
112+
glob: "stats.log"
113+
outputEval: |
114+
${
115+
var s = self[0].contents.replace(/ /g,'').replace(/ *\([^)]*\) */g,'');
116+
var pairedendreads = parseInt(s.substring ( s.indexOf("Paired-endreads")+16, s.indexOf("\t", (s.indexOf("Paired-endreads"))) ));
117+
return pairedendreads;
118+
}
119+
120+
baseCommand: [bamtools, stats]
121+
arguments:
122+
- valueFrom: $('> ' + 'stats.log')
123+
position: 1000
124+
shellQuote: false
125+
126+
$namespaces:
127+
s: http://schema.org/
128+
129+
$schemas:
130+
- http://schema.org/version/9.0/schemaorg-current-http.rdf
131+
132+
s:name: "bamtools_stats"
133+
s:license: http://www.apache.org/licenses/LICENSE-2.0
134+
135+
s:isPartOf:
136+
class: s:CreativeWork
137+
s:name: Common Workflow Language
138+
s:url: http://commonwl.org/
139+
140+
s:creator:
141+
- class: s:Organization
142+
s:legalName: "Cincinnati Children's Hospital Medical Center"
143+
s:location:
144+
- class: s:PostalAddress
145+
s:addressCountry: "USA"
146+
s:addressLocality: "Cincinnati"
147+
s:addressRegion: "OH"
148+
s:postalCode: "45229"
149+
s:streetAddress: "3333 Burnet Ave"
150+
s:telephone: "+1(513)636-4200"
151+
s:logo: "https://www.cincinnatichildrens.org/-/media/cincinnati%20childrens/global%20shared/childrens-logo-new.png"
152+
s:department:
153+
- class: s:Organization
154+
s:legalName: "Allergy and Immunology"
155+
s:department:
156+
- class: s:Organization
157+
s:legalName: "Barski Research Lab"
158+
s:member:
159+
- class: s:Person
160+
s:name: Michael Kotliar
161+
s:email: mailto:[email protected]
162+
s:sameAs:
163+
- id: http://orcid.org/0000-0002-6486-3898
164+
165+
doc: |
166+
Tool runs `bamtools stats' to calculate general alignment statistics from the input BAM file
167+
168+
`-insert` parameter is not implemented

0 commit comments

Comments
 (0)