nf-core_modules/modules/cnvkit/batch/main.nf
Florian De Temmerman 1455498152
CNVkit: Make targets file optional when running in WGS mode (#1030)
* Make targets.bed optional when running in wgs mode

* added test for cram

* Update test_data_config with new reference.cnn

* Update main.nf to allow tumor-only running

Still need a unit-test for this. Almost ready, but needs this file as input https://github.com/nf-core/test-datasets/blob/modules/data/generic/cnn/reference.cnn

* re-writing previous changes, but now it wont crash the entire CI-setup

* fixing overlooked merge conflict

* last overlooked merge-conflict

* move all files to batch subfolder

* adding an optional input for a reference file (needed when running germline and tumoronly)

* minor typo

* update meta.yml

* aligning code, renaming cnvkit to cnvkit_batch, renaming tumorbam to tumor, normalbam to normal

* Update pytest_modules.yml

Co-authored-by: EC2 Default User <ec2-user@ip-172-31-21-198.us-west-2.compute.internal>
Co-authored-by: Lasse Folkersen <lassefolkersen@gmail.com>
Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-11-21 19:56:57 +00:00

63 lines
2 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process CNVKIT_BATCH {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::cnvkit=0.9.9' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/cnvkit:0.9.9--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0"
}
input:
tuple val(meta), path(tumor), path(normal)
path fasta
path targets
path reference
output:
tuple val(meta), path("*.bed"), emit: bed
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
path "versions.yml" , emit: versions
script:
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"
}
"""
cnvkit.py \\
batch \\
$tumor \\
$normal_args \\
$fasta_args \\
$reference_args \\
$target_args \\
--processes ${task.cpus} \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(cnvkit.py version | sed -e "s/cnvkit v//g")
END_VERSIONS
"""
}