2021-03-22 22:27:30 +00:00
|
|
|
// Import generic module functions
|
2021-09-27 08:41:24 +00:00
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
2021-03-22 22:27:30 +00:00
|
|
|
|
|
|
|
params.options = [:]
|
2021-07-01 15:13:01 +00:00
|
|
|
options = initOptions(params.options)
|
2021-03-22 22:27:30 +00:00
|
|
|
|
2021-11-21 19:56:57 +00:00
|
|
|
process CNVKIT_BATCH {
|
2021-03-22 22:27:30 +00:00
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_low'
|
|
|
|
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 22:27:30 +00:00
|
|
|
|
2021-07-28 08:10:44 +00:00
|
|
|
conda (params.enable_conda ? 'bioconda::cnvkit=0.9.9' : null)
|
2021-03-22 22:27:30 +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/cnvkit:0.9.9--pyhdfd78af_0"
|
2021-03-22 22:27:30 +00:00
|
|
|
} else {
|
2021-07-28 08:10:44 +00:00
|
|
|
container "quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0"
|
2021-03-22 22:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
2021-11-21 19:56:57 +00:00
|
|
|
tuple val(meta), path(tumor), path(normal)
|
2021-07-01 15:13:01 +00:00
|
|
|
path fasta
|
2021-11-21 19:56:57 +00:00
|
|
|
path targets
|
|
|
|
path reference
|
2021-03-22 22:27:30 +00:00
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bed"), emit: bed
|
2021-11-21 19:56:57 +00:00
|
|
|
tuple val(meta), path("*.cnn"), emit: cnn, optional: true
|
|
|
|
tuple val(meta), path("*.cnr"), emit: cnr, optional: true
|
|
|
|
tuple val(meta), path("*.cns"), emit: cns, optional: true
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-03-22 22:27:30 +00:00
|
|
|
|
|
|
|
script:
|
2021-11-21 19:56:57 +00:00
|
|
|
normal_args = normal ? "--normal $normal" : ""
|
|
|
|
fasta_args = fasta ? "--fasta $fasta" : ""
|
|
|
|
reference_args = reference ? "--reference $reference" : ""
|
|
|
|
|
|
|
|
def target_args = ""
|
|
|
|
if (options.args.contains("--method wgs") || options.args.contains("-m wgs")) {
|
|
|
|
target_args = targets ? "--targets $targets" : ""
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
target_args = "--targets $targets"
|
|
|
|
}
|
|
|
|
|
2021-03-22 22:27:30 +00:00
|
|
|
"""
|
2021-07-01 15:13:01 +00:00
|
|
|
cnvkit.py \\
|
|
|
|
batch \\
|
2021-11-21 19:56:57 +00:00
|
|
|
$tumor \\
|
|
|
|
$normal_args \\
|
|
|
|
$fasta_args \\
|
|
|
|
$reference_args \\
|
|
|
|
$target_args \\
|
|
|
|
--processes ${task.cpus} \\
|
2021-03-22 22:27:30 +00:00
|
|
|
$options.args
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
${getProcessName(task.process)}:
|
|
|
|
${getSoftwareName(task.process)}: \$(cnvkit.py version | sed -e "s/cnvkit v//g")
|
|
|
|
END_VERSIONS
|
2021-03-22 22:27:30 +00:00
|
|
|
"""
|
|
|
|
}
|