nf-core_modules/modules/fgbio/fastqtobam/main.nf
Matthias De Smet 36049bf544
Fgbio/fastqtobam (#1980)
* fix samtools stats thread usage

* fix samtools stats thread usage (#1975)

* fix samtools stats thread usage

* fix checksums

* Fix/samtools flagstat (#1979)

* fix samtools stats thread usage

* flagstat: fix threads

* Update busco to v5.4.3 and tar small files (#1970)

* Update busco to v5.4.3 and tar small files

* Fix file contain strings

* Swap md5sums to contains for variable files

* Simplify and generalize module

* add test.yml

* Update modules/fgbio/fastqtobam/meta.yml

Co-authored-by: Moritz E. Beber <midnighter@posteo.net>

* add support + tests for cram output

* more tweaks

* update test.yml

* prettier

* try to fix tests

* fix tests

* prettier

* drop checksum for cram

Co-authored-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>
Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
2022-09-05 11:57:55 +02:00

43 lines
1.4 KiB
Text

process FGBIO_FASTQTOBAM {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::fgbio=2.0.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/fgbio:2.0.2--hdfd78af_0' :
'quay.io/biocontainers/fgbio:2.0.2--hdfd78af_0' }"
input:
tuple val(meta), path(reads)
output:
tuple val(meta), path("*.bam") , emit: bam , optional: true
tuple val(meta), path("*.cram"), emit: cram, optional: true
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 sample_name = args.contains("--sample") ? "" : "--sample ${prefix}"
def library_name = args.contains("--library") ? "" : "--library ${prefix}"
def output = prefix =~ /\.(bam|cram)$/ ? prefix : "${prefix}.bam"
"""
fgbio \\
--tmp-dir=. \\
FastqToBam \\
${args} \\
--input ${reads} \\
--output ${output} \\
${sample_name} \\
${library_name}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
fgbio: \$( echo \$(fgbio --version 2>&1 | tr -d '[:cntrl:]' ) | sed -e 's/^.*Version: //;s/\\[.*\$//')
END_VERSIONS
"""
}