Skip to content

Commit

Permalink
unicycler: Add parameter --long_reads
Browse files Browse the repository at this point in the history
  • Loading branch information
sjackman committed Oct 22, 2018
1 parent 97b50cd commit b2cb1ad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ resolution
- The `abyss` and `spades` components emit GFA in a secondary channel.
- The new `bandage` component can accept either FASTA from a primary channel
or GFA from a secondary channel.
- The new `unicycler` component can accept long reads from a secondary channel.

### New components

Expand Down
9 changes: 9 additions & 0 deletions flowcraft/generator/components/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,17 @@ def __init__(self, **kwargs):

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

self.link_end.append({"link": "long_reads", "alias": "long_reads"})
self.link_start.append("gfa1")

self.params = {
"long_reads": {
"default": "null",
"description": "FASTQ or FASTA file of long reads"
},
}

self.directives = {"unicycler": {
"cpus": 4,
"container": "quay.io/biocontainers/unicycler",
Expand Down
11 changes: 10 additions & 1 deletion flowcraft/generator/templates/unicycler.nf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// True when a long_reads secondary channel is connected to this component.
has_long_reads_{{pid}} = binding.hasVariable('long_reads_{{pid}}')

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

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

input:
set sample_id, file(fastq_pair) from {{input_channel}}
file long_reads from has_long_reads_{{pid}} ? long_reads_{{pid}} :
params.long_reads{{param_id}} ? Channel.fromPath(params.long_reads{{param_id}}) :
Channel.value("NA")

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

script:
"unicycler -t $task.cpus -o . --no_correct --no_pilon -1 ${fastq_pair[0]} -2 ${fastq_pair[1]}"
command = "unicycler -t $task.cpus -o . --no_correct --no_pilon -1 ${fastq_pair[0]} -2 ${fastq_pair[1]}"
if (params.long_reads{{param_id}})
command += " -l ${long_reads}"
command
}

{{forks}}

0 comments on commit b2cb1ad

Please sign in to comment.