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
18 changes: 17 additions & 1 deletion flowcraft/generator/components/metagenomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ def __init__(self, **kwargs):
"'default', megahit will use the default k-mer lengths. "
"(default: $params.megahitKmers)"
},
"fastg": {
"default": "false",
"description":
"Converts megahit intermediate contigs to fastg"

},
"clearInput": {
"default": "false",
"description":
Expand All @@ -155,7 +161,17 @@ def __init__(self, **kwargs):
"container": "flowcraft/megahit",
"version": "1.1.3-0.1",
"scratch": "true"
}}
},
"megahit_fastg": {
"container": "flowcraft/megahit",
"version": "1.1.3-0.1",
}
}

self.status_channels = [
"megahit",
"megahit_fastg"
]


class Metaspades(Process):
Expand Down
33 changes: 32 additions & 1 deletion flowcraft/generator/templates/megahit.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ process megahit_{{ pid }} {

output:
set sample_id, file('*megahit*.fasta') into {{ output_channel }}
set sample_id, file('megahit/intermediate_contigs/k*.contigs.fa') into IN_fastg{{ pid }}
{% with task_name="megahit" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}
Expand All @@ -31,8 +32,38 @@ process megahit_{{ pid }} {
template "megahit.py"

}
IN_fastg = Channel.create()

{{ forks }}
fastg = params.fastg{{ param_id }} ? "true" : "false"
if (fastg) {
process megahit_fastg_{{ pid }}{

// Send POST request to platform
{% include "post.txt" ignore missing %}

tag { sample_id }
publishDir "results/assembly/megahit_{{ pid }}/$sample_id", pattern: "*.fastg"

input:
set sample_id, file(kmer_files) from IN_fastg{{ pid }}

output:
file "*.fastg"
{% with task_name="megahit_fastg" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}

script:
"""
for kmer_file in ${kmer_files};
do
echo \$kmer_file
k=\$(echo \$kmer_file | cut -d '.' -f 1);
echo \$k
megahit_toolkit contig2fastg \$k \$kmer_file > \$kmer_file'.fastg';
done
"""
}
}

{{ forks }}
4 changes: 4 additions & 0 deletions flowcraft/generator/templates/spades.nf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ process spades_{{ pid }} {

tag { sample_id }
publishDir 'results/assembly/spades_{{ pid }}/', pattern: '*_spades*.fasta', mode: 'copy'
publishDir "reports/assembly/spades_{{ pid }}/$sample_id", pattern: "*.gfa", mode: "copy"
publishDir "reports/assembly/spades_{{ pid }}/$sample_id", pattern: "*.fastg", mode: "copy"

input:
set sample_id, file(fastq_pair), max_len from {{ input_channel }}.join(SIDE_max_len_{{ pid }})
Expand All @@ -33,6 +35,8 @@ process spades_{{ pid }} {

output:
set sample_id, file('*_spades*.fasta') into {{ output_channel }}
file "*.fastg"
file "*.gfa"
{% with task_name="spades" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}
Expand Down