Skip to content

Commit e984aee

Browse files
authored
Merge pull request #150 from sjackman/bandage
Add bandage
2 parents 30f5a45 + f84f160 commit e984aee

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

flowcraft/generator/components/assembly_processing.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,37 @@ def __init__(self, **kwargs):
230230
}
231231
}
232232

233+
class Bandage(Process):
234+
"""Visualize the assembly using Bandage
235+
236+
This process is set with:
237+
238+
- ``input_type``: assembly
239+
- ``output_type``: none
240+
- ``ptype``: post_assembly
241+
242+
"""
243+
244+
def __init__(self, **kwargs):
245+
super().__init__(**kwargs)
246+
247+
self.input_type = "fasta"
248+
self.output_type = None
249+
250+
self.params = {
251+
"reference": {
252+
"default": "null",
253+
"description": "Align the assembly to this reference genome using BLAST"
254+
},
255+
}
256+
257+
self.directives = {
258+
"bandage": {
259+
"container": "flowcraft/bandage",
260+
"version": "0.8.1"
261+
}
262+
}
263+
233264
class Quast(Process):
234265
"""Assess assembly quality using QUAST
235266

flowcraft/generator/engine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"abyss": assembly.Abyss,
5959
"abricate": annotation.Abricate,
6060
"assembly_mapping": ap.AssemblyMapping,
61+
"bandage": ap.Bandage,
6162
"bowtie": mapping.Bowtie,
6263
"card_rgi": annotation.CardRgi,
6364
"check_coverage": readsqc.CheckCoverage,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
if (params.reference{{param_id}} != null) {
2+
process bandage_{{pid}} {
3+
{% include "post.txt" ignore missing %}
4+
5+
tag { sample_id }
6+
publishDir "reports/assembly/bandage_{{pid}}/$sample_id"
7+
8+
input:
9+
set sample_id, file(assembly) from {{input_channel}}
10+
file reference from Channel.fromPath(params.reference{{param_id}})
11+
12+
output:
13+
file "*.png *.svg"
14+
{% with task_name="bandage" %}
15+
{%- include "compiler_channels.txt" ignore missing -%}
16+
{% endwith %}
17+
18+
script:
19+
"""
20+
time Bandage image $assembly ${assembly}.png >>.command.log 2>&1
21+
time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1
22+
time Bandage image $assembly ${assembly}.ref.png --query $reference >>.command.log 2>&1
23+
time Bandage image $assembly ${assembly}.ref.svg --query $reference >>.command.log 2>&1
24+
"""
25+
}
26+
} else {
27+
process bandage_{{pid}} {
28+
{% include "post.txt" ignore missing %}
29+
30+
tag { sample_id }
31+
publishDir "reports/assembly/bandage_{{pid}}/$sample_id"
32+
33+
input:
34+
set sample_id, file(assembly) from {{input_channel}}
35+
36+
output:
37+
file "*.png *.svg"
38+
{% with task_name="bandage" %}
39+
{%- include "compiler_channels.txt" ignore missing -%}
40+
{% endwith %}
41+
42+
script:
43+
"""
44+
time Bandage image $assembly ${assembly}.png >>.command.log 2>&1
45+
time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1
46+
"""
47+
}
48+
}

0 commit comments

Comments
 (0)