2021-02-15 13:33:44 +00:00
|
|
|
process MOSDEPTH {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
2022-02-09 12:45:55 +00:00
|
|
|
conda (params.enable_conda ? 'bioconda::mosdepth=0.3.3' : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-02-09 12:45:55 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/mosdepth:0.3.3--hdfd78af_1' :
|
|
|
|
'quay.io/biocontainers/mosdepth:0.3.3--hdfd78af_1'}"
|
2021-02-15 13:33:44 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam), path(bai)
|
|
|
|
path bed
|
2022-05-24 09:47:58 +00:00
|
|
|
path fasta
|
2021-02-15 13:33:44 +00:00
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path('*.global.dist.txt') , emit: global_txt
|
2022-02-09 12:45:55 +00:00
|
|
|
tuple val(meta), path('*.region.dist.txt') , emit: regions_txt , optional:true
|
2021-02-15 13:33:44 +00:00
|
|
|
tuple val(meta), path('*.summary.txt') , emit: summary_txt
|
2022-05-24 09:47:58 +00:00
|
|
|
tuple val(meta), path('*.per-base.d4') , emit: per_base_d4 , optional:true
|
2022-02-09 12:45:55 +00:00
|
|
|
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed, optional:true
|
|
|
|
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi, optional:true
|
|
|
|
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed , optional:true
|
|
|
|
tuple val(meta), path('*.regions.bed.gz.csi') , emit: regions_csi , optional:true
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-02-15 13:33:44 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-02-15 13:33:44 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
2021-12-02 12:39:55 +00:00
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2022-05-24 09:47:58 +00:00
|
|
|
def reference = fasta ? "--fasta ${fasta}" : ""
|
|
|
|
def interval = bed ? "--by ${bed}" : ""
|
2022-05-24 10:43:49 +00:00
|
|
|
if (bed && args.contains("--by")) {
|
2022-05-24 10:25:31 +00:00
|
|
|
exit 1, "--by can only be specified once."
|
|
|
|
}
|
2022-05-24 09:47:58 +00:00
|
|
|
|
2021-02-15 13:33:44 +00:00
|
|
|
"""
|
|
|
|
mosdepth \\
|
2022-05-24 09:47:58 +00:00
|
|
|
--threads ${task.cpus} \\
|
2021-02-15 13:33:44 +00:00
|
|
|
$interval \\
|
2022-05-24 09:47:58 +00:00
|
|
|
$reference \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-02-15 13:33:44 +00:00
|
|
|
$prefix \\
|
|
|
|
$bam
|
2022-02-09 12:45:55 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
2022-05-24 10:16:03 +00:00
|
|
|
|
|
|
|
stub:
|
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
|
"""
|
|
|
|
touch ${prefix}.global.dist.txt
|
|
|
|
touch ${prefix}.region.dist.txt
|
|
|
|
touch ${prefix}.summary.txt
|
|
|
|
touch ${prefix}.per-base.d4
|
|
|
|
touch ${prefix}.per-base.bed.gz
|
|
|
|
touch ${prefix}.per-base.bed.gz.csi
|
|
|
|
touch ${prefix}.regions.bed.gz
|
|
|
|
touch ${prefix}.regions.bed.gz.csi
|
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
2021-02-15 13:33:44 +00:00
|
|
|
}
|