2021-03-22 16:05:59 +00:00
|
|
|
// Import generic module functions
|
2021-09-27 08:41:24 +00:00
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
2021-03-22 16:05:59 +00:00
|
|
|
|
|
|
|
params.options = [:]
|
|
|
|
options = initOptions(params.options)
|
|
|
|
|
|
|
|
process PICARD_COLLECTWGSMETRICS {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
publishDir "${params.outdir}",
|
|
|
|
mode: params.publish_dir_mode,
|
2021-04-09 16:23:56 +00:00
|
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
2021-03-22 16:05:59 +00:00
|
|
|
|
2021-07-28 08:10:44 +00:00
|
|
|
conda (params.enable_conda ? 'bioconda::picard=2.25.7' : null)
|
2021-03-22 16:05:59 +00:00
|
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
2021-07-28 08:10:44 +00:00
|
|
|
container "https://depot.galaxyproject.org/singularity/picard:2.25.7--hdfd78af_0"
|
2021-03-22 16:05:59 +00:00
|
|
|
} else {
|
2021-07-28 08:10:44 +00:00
|
|
|
container "quay.io/biocontainers/picard:2.25.7--hdfd78af_0"
|
2021-03-22 16:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam), path(bai)
|
|
|
|
path fasta
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*_metrics"), emit: metrics
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-03-22 16:05:59 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
|
|
|
def avail_mem = 3
|
|
|
|
if (!task.memory) {
|
|
|
|
log.info '[Picard CollectWgsMetrics] 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 \\
|
|
|
|
CollectWgsMetrics \\
|
|
|
|
$options.args \\
|
|
|
|
INPUT=$bam \\
|
|
|
|
OUTPUT=${prefix}.CollectWgsMetrics.coverage_metrics \\
|
|
|
|
REFERENCE_SEQUENCE=$fasta
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
${getProcessName(task.process)}:
|
|
|
|
${getSoftwareName(task.process)}: \$(picard CollectWgsMetrics --version 2>&1 | grep -o 'Version.*' | cut -f2- -d:)
|
|
|
|
END_VERSIONS
|
2021-03-22 16:05:59 +00:00
|
|
|
"""
|
|
|
|
}
|