Skip to content

Commit 30f5a45

Browse files
authored
Merge pull request #147 from sjackman/quast
Add quast
2 parents cdd881c + 6286b5d commit 30f5a45

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

flowcraft/generator/components/assembly_processing.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,38 @@ def __init__(self, **kwargs):
229229
"version": "1.22.0-1"
230230
}
231231
}
232+
233+
class Quast(Process):
234+
"""Assess assembly quality using QUAST
235+
236+
This process is set with:
237+
238+
- ``input_type``: assembly
239+
- ``output_type``: tsv
240+
- ``ptype``: post_assembly
241+
242+
"""
243+
244+
def __init__(self, **kwargs):
245+
super().__init__(**kwargs)
246+
247+
self.input_type = "fasta"
248+
self.output_type = "tsv"
249+
250+
self.params = {
251+
"reference": {
252+
"default": "null",
253+
"description": "Compare the assembly to this reference genome"
254+
},
255+
"genomeSizeBp": {
256+
"default": "null",
257+
"description": "Expected genome size (bp)"
258+
},
259+
}
260+
261+
self.directives = {
262+
"quast": {
263+
"container": "quay.io/biocontainers/quast",
264+
"version": "5.0.0--py27pl526ha92aebf_1"
265+
}
266+
}

flowcraft/generator/engine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"process_spades": ap.ProcessSpades,
9292
"progressive_mauve":alignment.ProgressiveMauve,
9393
#"prokka": annotation.Prokka,
94+
"quast": ap.Quast,
9495
"raxml": phylogeny.Raxml,
9596
"reads_download": downloads.DownloadReads,
9697
"remove_host": meta.RemoveHost,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
if (params.reference{{param_id}} == null && params.genomeSizeBp{{param_id}} == null)
2+
exit 1, "Specify at least one of reference or genomeSizeBp"
3+
if (params.reference{{param_id}} != null && params.genomeSizeBp{{param_id}} != null)
4+
exit 1, "Specify only one of reference or genomeSizeBp"
5+
6+
if (params.reference{{param_id}} != null) {
7+
process quast_{{pid}} {
8+
{% include "post.txt" ignore missing %}
9+
10+
tag { sample_id }
11+
publishDir "results/assembly/quast_{{pid}}/$sample_id", pattern: "*.tsv"
12+
publishDir "reports/assembly/quast_{{pid}}/$sample_id"
13+
14+
input:
15+
set sample_id, file(assembly) from {{input_channel}}
16+
file reference from Channel.fromPath(params.reference{{param_id}})
17+
18+
output:
19+
file "*"
20+
{% with task_name="quast" %}
21+
{%- include "compiler_channels.txt" ignore missing -%}
22+
{% endwith %}
23+
24+
script:
25+
"/usr/bin/time -v quast -o . -r $reference -s $assembly -l $sample_id -t $task.cpus >> .command.log 2>&1"
26+
}
27+
} else if (params.genomeSizeBp{{param_id}} != null) {
28+
process quast_{{pid}} {
29+
{% include "post.txt" ignore missing %}
30+
31+
tag { sample_id }
32+
publishDir "results/assembly/quast_{{pid}}/$sample_id", pattern: "*.tsv"
33+
publishDir "reports/assembly/quast_{{pid}}/$sample_id"
34+
35+
input:
36+
set sample_id, file(assembly) from {{input_channel}}
37+
val genomeSizeBp from Channel.value(params.genomeSizeBp{{param_id}})
38+
39+
output:
40+
file "*"
41+
{% with task_name="quast" %}
42+
{%- include "compiler_channels.txt" ignore missing -%}
43+
{% endwith %}
44+
45+
script:
46+
"/usr/bin/time -v quast -o . --est-ref-size=$genomeSizeBp -s $assembly -l $sample_id -t $task.cpus >> .command.log 2>&1"
47+
}
48+
}

0 commit comments

Comments
 (0)