nf-core_modules/modules/pear/main.nf
Júlia Mir Pedrol 9bda3dc7f0
Add new module: Pear (#1779)
* create pear module

* add command and tests

* remove md5sum from known empty file

* add force -f to gzip and gunzip to avoid problems with symbolic links

* apply suggestions from review
2022-07-15 10:28:31 +02:00

44 lines
1.6 KiB
Text

process PEAR {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::pear=0.9.6" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pear:0.9.6--h67092d7_8':
'quay.io/biocontainers/pear:0.9.6--h67092d7_8' }"
input:
tuple val(meta), path(reads)
output:
tuple val(meta), path("*.assembled.fastq.gz") , emit: assembled
tuple val(meta), path("*.unassembled.forward.fastq.gz"), path("*.unassembled.reverse.fastq.gz"), emit: unassembled
tuple val(meta), path("*.discarded.fastq.gz") , emit: discarded
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}"
"""
gunzip -f ${reads[0]}
gunzip -f ${reads[1]}
pear \\
-f ${reads[0].baseName} \\
-r ${reads[1].baseName} \\
-o $prefix \\
-j $task.cpus \\
$args
gzip -f ${prefix}.assembled.fastq
gzip -f ${prefix}.unassembled.forward.fastq
gzip -f ${prefix}.unassembled.reverse.fastq
gzip -f ${prefix}.discarded.fastq
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pear: \$(pear -h | grep 'PEAR v' | sed 's/PEAR v//' | sed 's/ .*//' ))
END_VERSIONS
"""
}