-
Notifications
You must be signed in to change notification settings - Fork 44
Update to Innuca's recipe modules #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 12 commits
49cf9f2
971e155
7a31fd5
75b6a6d
7c8c9a7
2bdc6b1
7dad2fd
4163c48
06a0788
1a9242a
577ed47
10ee738
3e9c331
b3ad2da
aca2fc8
3303be8
a4f6745
e64efc9
75e5ea7
e62ee23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,16 @@ | |
|
||
|
||
class Bowtie(Process): | ||
"""bowtie2 to align short paired-end sequencing reads to long reference sequences | ||
""" | ||
bowtie2 to align short paired-end sequencing reads to long reference sequences | ||
cimendes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This process is set with: | ||
|
||
- ``input_type``: fastq | ||
- ``output_type``: bam | ||
- ``ptype``: mapping | ||
|
||
""" | ||
""" | ||
|
||
def __init__(self, **kwargs): | ||
|
||
|
@@ -65,7 +66,8 @@ def __init__(self, **kwargs): | |
|
||
|
||
class RetrieveMapped(Process): | ||
"""Samtools process to to align short paired-end sequencing reads to | ||
""" | ||
Samtools process to to align short paired-end sequencing reads to | ||
long reference sequences | ||
|
||
This process is set with: | ||
|
@@ -74,7 +76,7 @@ class RetrieveMapped(Process): | |
- ``output_type``: fastq | ||
- ``ptype``: mapping | ||
|
||
""" | ||
""" | ||
|
||
def __init__(self, **kwargs): | ||
|
||
|
@@ -108,3 +110,64 @@ def __init__(self, **kwargs): | |
self.status_channels = [ | ||
"retrieve_mapped" | ||
] | ||
|
||
|
||
class InsertSize(Process): | ||
""" | ||
Determines the sequencing insert size by reads mapping | ||
to an assembly file | ||
|
||
This process is set with: | ||
|
||
- ``input_type``: fasta | ||
- ``output_type``: | ||
cimendes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- ``ptype``: mapping | ||
|
||
It contains one **secondary channel link end**: | ||
|
||
- ``MAIN_fq`` (alias: ``_MAIN_assembly``): Receives the FastQ files | ||
from the last process with ``fastq`` output type. | ||
|
||
""" | ||
|
||
def __init__(self, **kwargs): | ||
|
||
super().__init__(**kwargs) | ||
|
||
self.input_type = "fasta" | ||
self.output_type = None | ||
|
||
self.link_end.append({"link": "__fastq", "alias": "_LAST_fastq"}) | ||
|
||
self.params = { | ||
"distribution_plot": { | ||
"default": "false", | ||
"description": "Produces a distribution plot of the insert sizes." | ||
}, | ||
"clearInput": { | ||
"default": "false", | ||
"description": | ||
"Permanently removes temporary input files. This option " | ||
"is only useful to remove temporary files in large " | ||
"workflows and prevents nextflow's resume functionality. " | ||
"Use with caution." | ||
} | ||
} | ||
|
||
self.directives = { | ||
"assembly_mapping_statistics": { | ||
"container": "flowcraft/bowtie2_samtools", | ||
"version": "1.0.0-1", | ||
"memory": "{1.Gb*task.cpus*task.attempt}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed with @miguelpmachado, to me this seems like enforcing an intrusive behavior that will easily fail in some setups. However in this case it seems better because default |
||
"cpus": 1 | ||
}, | ||
"insert_size": { | ||
"container": "flowcraft/plotly", | ||
"version": "3.5.0-1" | ||
} | ||
} | ||
|
||
self.status_channels = [ | ||
"assembly_mapping_statistics", | ||
"insert_size" | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
IN_plot{{ pid }} = params.distribution_plot{{ param_id }} ? "True" : "False" | ||
|
||
|
||
process assembly_mapping_statistics_{{ pid }} { | ||
|
||
// Send POST request to platform | ||
{% include "post.txt" ignore missing %} | ||
|
||
tag { sample_id } | ||
|
||
input: | ||
set sample_id, file(assembly), file(fastq) from {{ input_channel }}.join(_LAST_fastq_{{ pid }}) | ||
|
||
output: | ||
set sample_id, file("samtools_stats.txt") into IN_insert_size_{{ pid }} | ||
{% with task_name="assembly_mapping_statistics" %} | ||
{%- include "compiler_channels.txt" ignore missing -%} | ||
{% endwith %} | ||
|
||
script: | ||
""" | ||
{ | ||
echo [DEBUG] BUILDING BOWTIE INDEX FOR ASSEMBLY: $assembly >> .command.log 2>&1 | ||
bowtie2-build --threads ${task.cpus} $assembly genome_index >> .command.log 2>&1 | ||
|
||
echo [DEBUG] MAPPING READS FROM $fastq >> .command.log 2>&1 | ||
bowtie2 -q --very-fast --threads ${task.cpus} -x genome_index -1 ${fastq[0]} -2 ${fastq[1]} \ | ||
--fr -I 0 -X 2000 --no-discordant --no-mixed --no-unal -S alignment.sam >> .command.log 2>&1 | ||
|
||
echo [DEBUG] GET STATISTICS FROM SAM: alignment.sam | ||
samtools stats alignment.sam > samtools_stats.txt | ||
|
||
if [ -f "alignment.sam" ] && [ -f "samtools_stats.txt" ] | ||
then | ||
echo pass > .status | ||
else | ||
echo fail > .status | ||
fi | ||
|
||
echo -n "" > .report.json | ||
echo -n "" > .versions | ||
} || { | ||
echo fail > .status | ||
} | ||
""" | ||
} | ||
|
||
|
||
process insert_size_{{ pid }} { | ||
|
||
// Send POST request to platform | ||
{% include "post.txt" ignore missing %} | ||
|
||
tag { sample_id } | ||
|
||
publishDir "results/assembly/insert_size_{{ pid }}/" | ||
|
||
input: | ||
set sample_id, file(sam_stats) from IN_insert_size_{{ pid }} | ||
val plot from IN_plot{{ pid }} | ||
|
||
output: | ||
file ("*insert_size_report.tab") | ||
file ("*insert_size_distribution.html") optional true | ||
{% with task_name="insert_size" %} | ||
{%- include "compiler_channels.txt" ignore missing -%} | ||
{% endwith %} | ||
|
||
script: | ||
template "insert_size.py" | ||
cimendes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
// If a species is not provided, it bypasses the species verification | ||
if (params.mlstSpecies{{ param_id }} == null){ | ||
IN_expected_species_{{ pid }} = Channel.value("PASS") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} else { | ||
IN_expected_species_{{ pid }} = Channel.value(params.mlstSpecies{{ param_id }}) | ||
} | ||
|
||
process mlst_{{ pid }} { | ||
|
||
|
@@ -10,6 +16,7 @@ process mlst_{{ pid }} { | |
|
||
input: | ||
set sample_id, file(assembly) from {{ input_channel }} | ||
val expected_species from IN_expected_species_{{ pid }} | ||
|
||
output: | ||
file '*.mlst.txt' into LOG_mlst_{{ pid }} | ||
|
@@ -19,30 +26,8 @@ process mlst_{{ pid }} { | |
{% endwith %} | ||
|
||
script: | ||
""" | ||
{ | ||
expectedSpecies=${params.mlstSpecies{{ param_id }}} | ||
mlst $assembly >> ${sample_id}.mlst.txt | ||
mlstSpecies=\$(cat *.mlst.txt | cut -f2) | ||
json_str="{'expectedSpecies':\'\$expectedSpecies\',\ | ||
'species':'\$mlstSpecies',\ | ||
'st':'\$(cat *.mlst.txt | cut -f3)',\ | ||
'tableRow':[{'sample':'${sample_id}','data':[\ | ||
{'header':'MLST species','value':'\$mlstSpecies','table':'typing'},\ | ||
{'header':'MLST ST','value':'\$(cat *.mlst.txt | cut -f3)','table':'typing'}]}]}" | ||
echo \$json_str > .report.json | ||
|
||
if [ ! \$mlstSpecies = \$expectedSpecies ]; | ||
then | ||
printf fail > .status | ||
else | ||
printf pass > .status | ||
fi | ||
|
||
} || { | ||
printf fail > .status | ||
} | ||
""" | ||
template "run_mlst.py" | ||
cimendes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
} | ||
|
||
process compile_mlst_{{ pid }} { | ||
|
Uh oh!
There was an error while loading. Please reload this page.