2021-11-10 09:52:54 +00:00
|
|
|
process PICARD_COLLECTHSMETRICS {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
2022-04-29 05:47:24 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::picard=2.27.1" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-04-29 05:47:24 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/picard:2.27.1--hdfd78af_0' :
|
|
|
|
'quay.io/biocontainers/picard:2.27.1--hdfd78af_0' }"
|
2021-11-10 09:52:54 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam)
|
|
|
|
path fasta
|
|
|
|
path fai
|
|
|
|
path bait_intervals
|
|
|
|
path target_intervals
|
|
|
|
|
|
|
|
output:
|
2022-04-22 08:13:57 +00:00
|
|
|
tuple val(meta), path("*_metrics") , emit: metrics
|
|
|
|
path "versions.yml" , emit: versions
|
2021-11-10 09:52:54 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-11-10 09:52:54 +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}"
|
2021-11-10 09:52:54 +00:00
|
|
|
def reference = fasta ? "-R $fasta" : ""
|
|
|
|
|
|
|
|
def avail_mem = 3
|
|
|
|
if (!task.memory) {
|
|
|
|
log.info '[Picard CollectHsMetrics] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
|
|
|
|
} else {
|
|
|
|
avail_mem = task.memory.giga
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
picard \\
|
|
|
|
-Xmx${avail_mem}g \\
|
|
|
|
CollectHsMetrics \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-11-10 09:52:54 +00:00
|
|
|
$reference \\
|
2022-04-29 05:57:11 +00:00
|
|
|
--BAIT_INTERVALS $bait_intervals \\
|
|
|
|
--TARGET_INTERVALS $target_intervals \\
|
|
|
|
--INPUT $bam \\
|
|
|
|
--OUTPUT ${prefix}.CollectHsMetrics.coverage_metrics
|
2022-04-22 08:13:57 +00:00
|
|
|
|
2021-11-10 09:52:54 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
picard: \$(echo \$(picard CollectHsMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
|
2021-11-10 09:52:54 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
2022-03-28 15:48:39 +00:00
|
|
|
|
|
|
|
stub:
|
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
|
"""
|
2022-04-22 08:13:57 +00:00
|
|
|
touch ${prefix}.CollectHsMetrics.coverage_metrics
|
2022-03-28 15:48:39 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
|
|
|
picard: \$(echo \$(picard CollectHsMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
|
|
|
|
END_VERSIONS
|
|
|
|
"""
|
2021-11-10 09:52:54 +00:00
|
|
|
}
|