Skip to content

Commit 661e38b

Browse files
committed
Add porechop
1 parent b2cb1ad commit 661e38b

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resolution
2222

2323
- Added component `abyss`.
2424
- Added component `bandage`.
25+
- Added component `porechop`.
2526
- Added component `unicycler`.
2627

2728
### Minor/Other changes

flowcraft/generator/components/reads_quality_control.py

+34
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,37 @@ def __init__(self, **kwargs):
433433
self.status_channels = [
434434
"downsample_fastq"
435435
]
436+
437+
class Porechop(Process):
438+
"""Porechop trims adapters from Oxford Nanopore reads.
439+
440+
This process is set with:
441+
442+
- ``input_type``: fastq
443+
- ``output_type``: fastq
444+
- ``ptype``: pre_assembly
445+
"""
446+
447+
def __init__(self, **kwargs):
448+
super().__init__(**kwargs)
449+
450+
self.input_type = "fastq"
451+
self.output_type = "fastq"
452+
453+
self.link_end.append({"link": "raw_long_reads", "alias": "raw_long_reads"})
454+
self.link_start.append("long_reads")
455+
456+
self.params = {
457+
"long_reads": {
458+
"default": "null",
459+
"description": "FASTQ or FASTA file of long reads"
460+
},
461+
}
462+
463+
self.directives = {
464+
"porechop": {
465+
"cpus": 4,
466+
"container": "quay.io/biocontainers/porechop",
467+
"version": "0.2.3_seqan2.1.1--py36h2d50403_3"
468+
}
469+
}

flowcraft/generator/engine.py

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"momps": typing.Momps,
8989
"patho_typing": typing.PathoTyping,
9090
"pilon": ap.Pilon,
91+
"porechop": readsqc.Porechop,
9192
"process_skesa": ap.ProcessSkesa,
9293
"process_spades": ap.ProcessSpades,
9394
"progressive_mauve":alignment.ProgressiveMauve,
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// True when a raw_long_reads secondary channel is connected to this component.
2+
has_raw_long_reads_{{pid}} = binding.hasVariable('raw_long_reads_{{pid}}')
3+
4+
process porechop_{{pid}} {
5+
{% include "post.txt" ignore missing %}
6+
7+
publishDir "results/porechop_{{pid}}", pattern: "*.fastq.gz"
8+
publishDir "reports/porechop_{{pid}}", pattern: "*.log"
9+
10+
tag { sample_id }
11+
12+
input:
13+
set sample_id, file(fastq_pair) from {{input_channel}}
14+
file raw_long_reads from has_raw_long_reads{{pid}} ? raw_long_reads_{{pid}} :
15+
params.long_reads{{param_id}} ? Channel.fromPath(params.long_reads{{param_id}}) :
16+
17+
output:
18+
set sample_id, file(fastq_pair) into {{output_channel}}
19+
file "${sample_id}.fastq.gz" into long_reads_{{pid}}
20+
{% with task_name="porechop" %}
21+
{%- include "compiler_channels.txt" ignore missing -%}
22+
{% endwith %}
23+
24+
script:
25+
"time porechop -t $task.cpus --format fastq.gz -i ${long_reads} -o ${sample_id}.fastq.gz >${sample_id}.log"
26+
}
27+
28+
{{ forks }}

0 commit comments

Comments
 (0)