mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
dc95e67e15
* add bamsormadup * fix yaml * add test.yml * Update tests/modules/biobambam/bamsormadup/test.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * test meta.yaml: remove md5sums * Tool bamsormadup: - add (optional) reference input - add bam index ouput - add cram output option - make metrics output: more general * fix input and output formats * update input file description * drop sam output, goes against nf-core regs; add input check for cram files * fix typo * Update modules/biobambam/bamsormadup/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * improve ref fasta name * fix if else shorthand * fix syntax error * kind of fix tests * set fixed suffix for metrics file to keep it in line with picard and bammarkduplicates2 * fix command line * update test.yml * add support for multiple input bams * Update modules/biobambam/bamsormadup/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/biobambam/bamsormadup/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update tests/modules/biobambam/bamsormadup/test.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
46 lines
1.6 KiB
Text
46 lines
1.6 KiB
Text
process BIOBAMBAM_BAMSORMADUP {
|
|
tag "$meta.id"
|
|
label "process_medium"
|
|
|
|
conda (params.enable_conda ? "bioconda::biobambam=2.0.183" : null)
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/biobambam:2.0.183--h9f5acd7_1' : 'quay.io/biocontainers/biobambam:2.0.183--h9f5acd7_1'}"
|
|
|
|
input:
|
|
tuple val(meta), path(bams)
|
|
path(fasta)
|
|
|
|
output:
|
|
tuple val(meta), path("*.{bam,cram}") ,emit: bam
|
|
tuple val(meta), path("*.bam.bai") ,optional:true, emit: bam_index
|
|
tuple val(meta), path("*.metrics.txt") ,emit: metrics
|
|
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 suffix = args.contains("outputformat=cram") ? "cram" : "bam"
|
|
def input_string = bams.join(" I=")
|
|
|
|
if (args.contains("outputformat=cram") && reference == null) error "Reference required for CRAM output."
|
|
|
|
"""
|
|
bamcat \\
|
|
I=${input_string} \\
|
|
level=0 \\
|
|
| bamsormadup \\
|
|
$args \\
|
|
M=${prefix}.metrics.txt \\
|
|
tmpfile=$prefix \\
|
|
threads=$task.cpus \\
|
|
> ${prefix}.${suffix}
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
"${task.process}":
|
|
bamcat: \$(echo \$(bamsormadup --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
|
|
bamsormadup: \$(echo \$(bamsormadup --version 2>&1) | sed 's/^This is biobambam2 version //; s/..biobambam2 is .*\$//' )
|
|
END_VERSIONS
|
|
"""
|
|
}
|