Skip to content

Commit ce5dee3

Browse files
authored
Merge pull request #149 from natir/bcalm
Add bcalm to flowcraft
2 parents 8853ed6 + c63e7b8 commit ce5dee3

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ resolution
2323
- Added component `bandage`.
2424
- Added component `unicycler`.
2525
- Added component `prokka`.
26+
- Added component `bcalm`.
2627

2728
### Minor/Other changes
2829

flowcraft/generator/components/assembly.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,48 @@
44
except ImportError:
55
from flowcraft.generator.process import Process
66

7+
class Bcalm(Process):
8+
"""Bcalm process template interface
9+
10+
This process is set with:
11+
12+
- ``input_type``: fastq
13+
- ``output_type``: assembly
14+
- ``ptype``: assembly
15+
16+
"""
17+
18+
def __init__(self, **kwargs):
19+
20+
super().__init__(**kwargs)
21+
22+
self.input_type = "fastq"
23+
self.output_type = "fasta"
24+
25+
self.params = {
26+
"bcalmKmerSize": {
27+
"default": 31,
28+
"description":
29+
"size of a kmer"
30+
},
31+
"clearInput": {
32+
"default": "false",
33+
"description":
34+
"Permanently removes temporary input files. This option "
35+
"is only useful to remove temporary files in large "
36+
"workflows and prevents nextflow's resume functionality. "
37+
"Use with caution."
38+
}
39+
}
40+
41+
self.directives = {"bcalm": {
42+
"cpus": 4,
43+
"memory": "{ 5.GB * task.attempt }",
44+
"container": "quay.io/biocontainers/bcalm",
45+
"version": "2.2.0--hd28b015_2",
46+
"scratch": "true"
47+
}}
48+
749

850
class Spades(Process):
951
"""Spades process template interface

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+
"bcalm": assembly.Bcalm,
6162
"bandage": ap.Bandage,
6263
"bowtie": mapping.Bowtie,
6364
"card_rgi": annotation.CardRgi,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Check parameter
2+
if ( !params.bcalmKmerSize{{ param_id }}.toString().isNumber() ){
3+
exit 1, "'bcalmKmerSize{{ param_id }}' parameter must be a number. Provided value: '${params.bcalmKmes%rSize{{ param_id }}}'"
4+
}
5+
6+
// Clear
7+
clear = params.clearInput{{ param_id }} ? "true" : "false"
8+
checkpointClear_{{ pid }} = Channel.value(clear)
9+
10+
process bcalm_{{ pid }} {
11+
{% include "post.txt" ignore missing %}
12+
13+
tag { sample_id }
14+
publishDir "reports/assembly/quast_{{pid}}/$sample_id"
15+
16+
input:
17+
set sample_id, file(fastq) from {{input_channel}}
18+
val KmerSize from Channel.value(params.bcalmKmerSize{{param_id}})
19+
20+
output:
21+
file "*.unitig.fa"
22+
{% with task_name="bcalm" %}
23+
{%- include "compiler_channels.txt" ignore missing -%}
24+
{% endwith %}
25+
26+
script:
27+
"""
28+
{
29+
bcalm -in $fastq -out unitig -kmer-size $KmerSize"
30+
31+
if [ "$clear" = "true" ];
32+
then
33+
find . -type f -print | egrep "work/.*(h5)|(glue)" | xargs -L 1 rm
34+
fi
35+
}
36+
"""
37+
}
38+

0 commit comments

Comments
 (0)