Skip to content

Commit d2e4899

Browse files
authored
Merge pull request #139 from assemblerflow/assembly_graph
Assembly graph results
2 parents d0b3e10 + 16bcfb7 commit d2e4899

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

flowcraft/generator/components/metagenomics.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ def __init__(self, **kwargs):
139139
"'default', megahit will use the default k-mer lengths. "
140140
"(default: $params.megahitKmers)"
141141
},
142+
"fastg": {
143+
"default": "false",
144+
"description":
145+
"Converts megahit intermediate contigs to fastg"
146+
147+
},
142148
"clearInput": {
143149
"default": "false",
144150
"description":
@@ -155,7 +161,17 @@ def __init__(self, **kwargs):
155161
"container": "flowcraft/megahit",
156162
"version": "1.1.3-0.1",
157163
"scratch": "true"
158-
}}
164+
},
165+
"megahit_fastg": {
166+
"container": "flowcraft/megahit",
167+
"version": "1.1.3-0.1",
168+
}
169+
}
170+
171+
self.status_channels = [
172+
"megahit",
173+
"megahit_fastg"
174+
]
159175

160176

161177
class Metaspades(Process):

flowcraft/generator/templates/megahit.nf

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ process megahit_{{ pid }} {
2323

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

3334
}
35+
IN_fastg = Channel.create()
3436

35-
{{ forks }}
37+
fastg = params.fastg{{ param_id }} ? "true" : "false"
38+
if (fastg) {
39+
process megahit_fastg_{{ pid }}{
3640

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

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

47+
input:
48+
set sample_id, file(kmer_files) from IN_fastg{{ pid }}
49+
50+
output:
51+
file "*.fastg"
52+
{% with task_name="megahit_fastg" %}
53+
{%- include "compiler_channels.txt" ignore missing -%}
54+
{% endwith %}
55+
56+
script:
57+
"""
58+
for kmer_file in ${kmer_files};
59+
do
60+
echo \$kmer_file
61+
k=\$(echo \$kmer_file | cut -d '.' -f 1);
62+
echo \$k
63+
megahit_toolkit contig2fastg \$k \$kmer_file > \$kmer_file'.fastg';
64+
done
65+
"""
66+
}
67+
}
68+
69+
{{ forks }}

flowcraft/generator/templates/spades.nf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ process spades_{{ pid }} {
2424

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

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

3436
output:
3537
set sample_id, file('*_spades*.fasta') into {{ output_channel }}
38+
file "*.fastg"
39+
file "*.gfa"
3640
{% with task_name="spades" %}
3741
{%- include "compiler_channels.txt" ignore missing -%}
3842
{% endwith %}

0 commit comments

Comments
 (0)