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
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ resolution
- Added component `bandage`.
- Added component `unicycler`.
- Added component `prokka`.
- Added component `bcalm`.

### Minor/Other changes

Expand Down
42 changes: 42 additions & 0 deletions flowcraft/generator/components/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@
except ImportError:
from flowcraft.generator.process import Process

class Bcalm(Process):
"""Bcalm process template interface

This process is set with:

- ``input_type``: fastq
- ``output_type``: assembly
- ``ptype``: assembly

"""

def __init__(self, **kwargs):

super().__init__(**kwargs)

self.input_type = "fastq"
self.output_type = "fasta"

self.params = {
"bcalmKmerSize": {
"default": 31,
"description":
"size of a kmer"
},
"clearInput": {
"default": "false",
"description":
"Permanently removes temporary input files. This option "
"is only useful to remove temporary files in large "
"workflows and prevents nextflow's resume functionality. "
"Use with caution."
}
}

self.directives = {"bcalm": {
"cpus": 4,
"memory": "{ 5.GB * task.attempt }",
"container": "quay.io/biocontainers/bcalm",
"version": "2.2.0--hd28b015_2",
"scratch": "true"
}}


class Spades(Process):
"""Spades process template interface
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,
"bcalm": assembly.Bcalm,
"bandage": ap.Bandage,
"bowtie": mapping.Bowtie,
"card_rgi": annotation.CardRgi,
Expand Down
38 changes: 38 additions & 0 deletions flowcraft/generator/templates/bcalm.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Check parameter
if ( !params.bcalmKmerSize{{ param_id }}.toString().isNumber() ){
exit 1, "'bcalmKmerSize{{ param_id }}' parameter must be a number. Provided value: '${params.bcalmKmes%rSize{{ param_id }}}'"
}

// Clear
clear = params.clearInput{{ param_id }} ? "true" : "false"
checkpointClear_{{ pid }} = Channel.value(clear)

process bcalm_{{ pid }} {
{% include "post.txt" ignore missing %}

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

input:
set sample_id, file(fastq) from {{input_channel}}
val KmerSize from Channel.value(params.bcalmKmerSize{{param_id}})

output:
file "*.unitig.fa"
{% with task_name="bcalm" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}

script:
"""
{
bcalm -in $fastq -out unitig -kmer-size $KmerSize"

if [ "$clear" = "true" ];
then
find . -type f -print | egrep "work/.*(h5)|(glue)" | xargs -L 1 rm
fi
}
"""
}