Skip to content

Commit b2cb1ad

Browse files
committed
unicycler: Add parameter --long_reads
1 parent 97b50cd commit b2cb1ad

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resolution
1616
- The `abyss` and `spades` components emit GFA in a secondary channel.
1717
- The new `bandage` component can accept either FASTA from a primary channel
1818
or GFA from a secondary channel.
19+
- The new `unicycler` component can accept long reads from a secondary channel.
1920

2021
### New components
2122

flowcraft/generator/components/assembly.py

+9
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,17 @@ def __init__(self, **kwargs):
236236

237237
self.input_type = "fastq"
238238
self.output_type = "fasta"
239+
240+
self.link_end.append({"link": "long_reads", "alias": "long_reads"})
239241
self.link_start.append("gfa1")
240242

243+
self.params = {
244+
"long_reads": {
245+
"default": "null",
246+
"description": "FASTQ or FASTA file of long reads"
247+
},
248+
}
249+
241250
self.directives = {"unicycler": {
242251
"cpus": 4,
243252
"container": "quay.io/biocontainers/unicycler",

flowcraft/generator/templates/unicycler.nf

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// True when a long_reads secondary channel is connected to this component.
2+
has_long_reads_{{pid}} = binding.hasVariable('long_reads_{{pid}}')
3+
14
process unicycler_{{pid}} {
25
{% include "post.txt" ignore missing %}
36

@@ -7,6 +10,9 @@ process unicycler_{{pid}} {
710

811
input:
912
set sample_id, file(fastq_pair) from {{input_channel}}
13+
file long_reads from has_long_reads_{{pid}} ? long_reads_{{pid}} :
14+
params.long_reads{{param_id}} ? Channel.fromPath(params.long_reads{{param_id}}) :
15+
Channel.value("NA")
1016

1117
output:
1218
set sample_id, file('assembly.fasta') into {{output_channel}}
@@ -16,7 +22,10 @@ process unicycler_{{pid}} {
1622
{% endwith %}
1723

1824
script:
19-
"unicycler -t $task.cpus -o . --no_correct --no_pilon -1 ${fastq_pair[0]} -2 ${fastq_pair[1]}"
25+
command = "unicycler -t $task.cpus -o . --no_correct --no_pilon -1 ${fastq_pair[0]} -2 ${fastq_pair[1]}"
26+
if (params.long_reads{{param_id}})
27+
command += " -l ${long_reads}"
28+
command
2029
}
2130

2231
{{forks}}

0 commit comments

Comments
 (0)