nf-core_modules/modules/flye/main.nf
Júlia Mir Pedrol bd0fa881f6
Add new module: Flye (#1164)
* changing mv by gzip

* changing mv by gzip

* first module creation

* add test.yml

* add flye to pyestes_modules.yml

* update flye module

* delete functions.nf

* generate test.yml

* fix contains from test.yml

* test file assembly_info.txt with regex

* check that file contains at least contig_1

* fix typo in contains

* update version

* split fastq file for raw runs

* use asm-coverage to reduce memory usage

* fix module name error

* add genome-size

* decrease coverage

* change test data for raw runs

* add coverage and genome size

* Apply comments from code review

Co-authored-by: SusiJo <43847534+SusiJo@users.noreply.github.com>

* after many trys, add a stub run

* remove md5sum for stub run

* Apply suggestions from code review

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* fix review comments

* Apply suggestions from code review

Co-authored-by: SusiJo <43847534+SusiJo@users.noreply.github.com>

* no hardcoded version in stub run

* Update modules/flye/main.nf

Co-authored-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>

Co-authored-by: SusiJo <43847534+SusiJo@users.noreply.github.com>
Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
Co-authored-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>
2022-06-30 22:45:55 +02:00

68 lines
2.3 KiB
Text

process FLYE {
tag "$meta.id"
label 'process_high'
conda (params.enable_conda ? "bioconda::flye=2.9" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/flye:2.9--py39h6935b12_1' :
'quay.io/biocontainers/flye:2.9--py39h6935b12_1' }"
input:
tuple val(meta), path(reads)
val mode
output:
tuple val(meta), path("*.fasta.gz"), emit: fasta
tuple val(meta), path("*.gfa.gz") , emit: gfa
tuple val(meta), path("*.gv.gz") , emit: gv
tuple val(meta), path("*.txt") , emit: txt
tuple val(meta), path("*.log") , emit: log
tuple val(meta), path("*.json") , emit: json
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def valid_mode = ["--pacbio-raw", "--pacbio-corr", "--pacbio-hifi", "--nano-raw", "--nano-corr", "--nano-hq"]
if ( !valid_mode.contains(mode) ) { error "Unrecognised mode to run Flye. Options: ${valid_mode.join(', ')}" }
"""
flye \\
$mode \\
$reads \\
--out-dir . \\
--threads \\
$task.cpus \\
$args
gzip -c assembly.fasta > ${prefix}.assembly.fasta.gz
gzip -c assembly_graph.gfa > ${prefix}.assembly_graph.gfa.gz
gzip -c assembly_graph.gv > ${prefix}.assembly_graph.gv.gz
mv assembly_info.txt ${prefix}.assembly_info.txt
mv flye.log ${prefix}.flye.log
mv params.json ${prefix}.params.json
cat <<-END_VERSIONS > versions.yml
"${task.process}":
flye: \$( flye --version )
END_VERSIONS
"""
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo stub > assembly.fasta | gzip -c assembly.fasta > ${prefix}.assembly.fasta.gz
echo stub > assembly_graph.gfa | gzip -c assembly_graph.gfa > ${prefix}.assembly_graph.gfa.gz
echo stub > assembly_graph.gv | gzip -c assembly_graph.gv > ${prefix}.assembly_graph.gv.gz
echo contig_1 > ${prefix}.assembly_info.txt
echo stub > ${prefix}.flye.log
echo stub > ${prefix}.params.json
cat <<-END_VERSIONS > versions.yml
"${task.process}":
flye: \$( flye --version )
END_VERSIONS
"""
}