nf-core_modules/modules/elprep/merge/main.nf

44 lines
1.3 KiB
Text
Raw Normal View History

2022-04-13 10:51:17 +00:00
process ELPREP_MERGE {
tag "$meta.id"
2022-04-19 09:27:55 +00:00
label 'process_low'
2022-04-13 10:51:17 +00:00
conda (params.enable_conda ? "bioconda::elprep=5.1.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/elprep:5.1.2--he881be0_0':
'quay.io/biocontainers/elprep:5.1.2--he881be0_0' }"
input:
tuple val(meta), path(bam)
output:
2022-04-22 10:36:32 +00:00
tuple val(meta), path("output/**.{bam,sam}") , emit: bam
path "versions.yml" , emit: versions
2022-04-13 10:51:17 +00:00
when:
task.ext.when == null || task.ext.when
script:
2022-04-22 09:39:22 +00:00
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = args.contains("--output-type sam") ? "sam" : "bam"
def single_end = meta.single_end ? " --single-end" : ""
2022-04-13 10:51:17 +00:00
"""
# create directory and move all input so elprep can find and merge them before splitting
mkdir input
mv ${bam} input/
elprep merge \\
input/ \\
2022-04-22 10:36:32 +00:00
output/${prefix}.${suffix} \\
2022-04-13 10:51:17 +00:00
$args \\
2022-04-22 09:39:22 +00:00
${single_end} \\
2022-04-13 10:51:17 +00:00
--nr-of-threads $task.cpus
cat <<-END_VERSIONS > versions.yml
"${task.process}":
elprep: \$(elprep 2>&1 | head -n2 | tail -n1 |sed 's/^.*version //;s/ compiled.*\$//')
END_VERSIONS
"""
}