Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions flowcraft/generator/components/assembly_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,37 @@ def __init__(self, **kwargs):
}
}

class Bandage(Process):
"""Visualize the assembly using Bandage

This process is set with:

- ``input_type``: assembly
- ``output_type``: none
- ``ptype``: post_assembly

"""

def __init__(self, **kwargs):
super().__init__(**kwargs)

self.input_type = "fasta"
self.output_type = None

self.params = {
"reference": {
"default": "null",
"description": "Align the assembly to this reference genome using BLAST"
},
}

self.directives = {
"bandage": {
"container": "flowcraft/bandage",
"version": "0.8.1"
}
}

class Quast(Process):
"""Assess assembly quality using QUAST

Expand Down
1 change: 1 addition & 0 deletions flowcraft/generator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"abyss": assembly.Abyss,
"abricate": annotation.Abricate,
"assembly_mapping": ap.AssemblyMapping,
"bandage": ap.Bandage,
"bowtie": mapping.Bowtie,
"card_rgi": annotation.CardRgi,
"check_coverage": readsqc.CheckCoverage,
Expand Down
48 changes: 48 additions & 0 deletions flowcraft/generator/templates/bandage.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
if (params.reference{{param_id}} != null) {
process bandage_{{pid}} {
{% include "post.txt" ignore missing %}

tag { sample_id }
publishDir "reports/assembly/bandage_{{pid}}/$sample_id"

input:
set sample_id, file(assembly) from {{input_channel}}
file reference from Channel.fromPath(params.reference{{param_id}})

output:
file "*.png *.svg"
{% with task_name="bandage" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}

script:
"""
time Bandage image $assembly ${assembly}.png >>.command.log 2>&1
time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1
time Bandage image $assembly ${assembly}.ref.png --query $reference >>.command.log 2>&1
time Bandage image $assembly ${assembly}.ref.svg --query $reference >>.command.log 2>&1
"""
}
} else {
process bandage_{{pid}} {
{% include "post.txt" ignore missing %}

tag { sample_id }
publishDir "reports/assembly/bandage_{{pid}}/$sample_id"

input:
set sample_id, file(assembly) from {{input_channel}}

output:
file "*.png *.svg"
{% with task_name="bandage" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}

script:
"""
time Bandage image $assembly ${assembly}.png >>.command.log 2>&1
time Bandage image $assembly ${assembly}.svg >>.command.log 2>&1
"""
}
}