nf-core_modules/modules/ivar/consensus/main.nf
Harshil Patel bb90e4fb78
Remove bcftools and ivar module customisations (#1217)
* Remove customisation from bcftools modules

* Add save_mpileup option to bcftools/mpileup

* Remove params.save_mpileup from ivar/consensus

* Update meta.ymls
2022-01-18 16:04:56 +00:00

43 lines
1.3 KiB
Text

process IVAR_CONSENSUS {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::ivar=1.3.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ivar:1.3.1--h089eab3_0' :
'quay.io/biocontainers/ivar:1.3.1--h089eab3_0' }"
input:
tuple val(meta), path(bam)
path fasta
val save_mpileup
output:
tuple val(meta), path("*.fa") , emit: fasta
tuple val(meta), path("*.qual.txt"), emit: qual
tuple val(meta), path("*.mpileup") , optional:true, emit: mpileup
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def mpileup = save_mpileup ? "| tee ${prefix}.mpileup" : ""
"""
samtools \\
mpileup \\
--reference $fasta \\
$args2 \\
$bam \\
$mpileup \\
| ivar \\
consensus \\
$args \\
-p $prefix
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ivar: \$(echo \$(ivar version 2>&1) | sed 's/^.*iVar version //; s/ .*\$//')
END_VERSIONS
"""
}