Skip to content

Commit

Permalink
Add porechop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjackman committed Oct 23, 2018
1 parent b2cb1ad commit c341b37
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ resolution

- Added component `abyss`.
- Added component `bandage`.
- Added component `porechop`.
- Added component `unicycler`.

### Minor/Other changes
Expand Down
34 changes: 34 additions & 0 deletions flowcraft/generator/components/reads_quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,37 @@ def __init__(self, **kwargs):
self.status_channels = [
"downsample_fastq"
]

class Porechop(Process):
"""Porechop trims adapters from Oxford Nanopore reads.
This process is set with:
- ``input_type``: fastq
- ``output_type``: fastq
- ``ptype``: pre_assembly
"""

def __init__(self, **kwargs):
super().__init__(**kwargs)

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

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

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

self.directives = {
"porechop": {
"cpus": 4,
"container": "quay.io/biocontainers/porechop",
"version": "0.2.3_seqan2.1.1--py36h2d50403_3"
}
}
1 change: 1 addition & 0 deletions flowcraft/generator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"momps": typing.Momps,
"patho_typing": typing.PathoTyping,
"pilon": ap.Pilon,
"porechop": readsqc.Porechop,
"process_skesa": ap.ProcessSkesa,
"process_spades": ap.ProcessSpades,
"progressive_mauve":alignment.ProgressiveMauve,
Expand Down
28 changes: 28 additions & 0 deletions flowcraft/generator/templates/porechop.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// True when a raw_long_reads secondary channel is connected to this component.
has_raw_long_reads_{{pid}} = binding.hasVariable('raw_long_reads_{{pid}}')

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

publishDir "results/porechop_{{pid}}", pattern: "*.fastq.gz"
publishDir "reports/porechop_{{pid}}", pattern: "*.log"

tag { sample_id }

input:
set sample_id, file(fastq_pair) from {{input_channel}}
file raw_long_reads from has_raw_long_reads_{{pid}} ? raw_long_reads_{{pid}} :
Channel.fromPath(params.long_reads{{param_id}})

output:
set sample_id, file(fastq_pair) into {{output_channel}}
file "${sample_id}.fastq.gz" into long_reads_{{pid}}
{% with task_name="porechop" %}
{%- include "compiler_channels.txt" ignore missing -%}
{% endwith %}

script:
"time porechop -t $task.cpus --format fastq.gz -i ${raw_long_reads} -o ${sample_id}.fastq.gz >${sample_id}.log"
}

{{ forks }}

0 comments on commit c341b37

Please sign in to comment.