From 064712c4ea2b42a405a98e55a4aac81c3f79d3ff Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 09:11:45 +0200 Subject: [PATCH 01/19] added cram_bam conversion & tumor_only check --- modules/cnvkit/batch/main.nf | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 7c44d9f6..1ceb7072 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -5,7 +5,7 @@ process CNVKIT_BATCH { conda (params.enable_conda ? 'bioconda::cnvkit=0.9.9' : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/cnvkit:0.9.9--pyhdfd78af_0' : - 'quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0' }" + 'quay.io/biocontainers/mulled-v2-780d630a9bb6a0ff2e7b6f730906fd703e40e98f:304d1c5ab610f216e77c61420ebe85f1e7c5968a-0' }" input: tuple val(meta), path(tumor), path(normal) @@ -18,6 +18,8 @@ process CNVKIT_BATCH { 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 + tuple val(meta), path("*.pdf"), emit: pdf, optional: true + tuple val(meta), path("*.png"), emit: png, optional: true path "versions.yml" , emit: versions when: @@ -25,21 +27,42 @@ process CNVKIT_BATCH { script: def args = task.ext.args ?: '' - def normal_args = normal ? "--normal $normal" : "" - def fasta_args = fasta ? "--fasta $fasta" : "" + // execute samtools only when cram files are input + // input pair is assumed to have same extension if both exist + def is_cram = tumor.Extension == "cram" ? true : false + def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" + // do not run samtools on normal samples in tumor_only + def normal_exists = normal ? true: false + // tumor_only mode does not need fasta & target + // instead it requires a pre-computed reference which is built from fasta & target + def (normal_out, normal_args, fasta_args, target_args) = ["", "", "", ""] def reference_args = reference ? "--reference $reference" : "" - def target_args = "" + if (normal_exists){ + def normal_prefix = normal.BaseName + normal_out = is_cram ? "${normal_prefix}" + ".bam" : "${normal}" + normal_args = normal_prefix ? "--normal $normal_out" : "" + fasta_args = fasta ? "--fasta $fasta" : "" + } + if (args.contains("--method wgs") || args.contains("-m wgs")) { target_args = targets ? "--targets $targets" : "" } else { target_args = "--targets $targets" } + """ + if $is_cram; then + samtools view -T $fasta $tumor -@ $task.cpus -o $tumor_out + if $normal_exists; then + samtools view -T $fasta $normal -@ $task.cpus -o $normal_out + fi + fi + cnvkit.py \\ batch \\ - $tumor \\ + $tumor_out \\ $normal_args \\ $fasta_args \\ $reference_args \\ From 5a1297cc7d55de78cdb945977f8e963fe5ecde78 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 09:12:47 +0200 Subject: [PATCH 02/19] added optional pdf/png outputs --- modules/cnvkit/batch/meta.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/cnvkit/batch/meta.yml b/modules/cnvkit/batch/meta.yml index 474c55f2..03277e33 100644 --- a/modules/cnvkit/batch/meta.yml +++ b/modules/cnvkit/batch/meta.yml @@ -80,6 +80,14 @@ output: type: file description: File containing copy number segment information pattern: "*.{cns}" + - pdf: + type: file + description: File with plot of copy numbers or segments on chromosomes + pattern: "*.{pdf}" + - png: + type: file + description: File with plot of bin-level log2 coverages and segmentation calls + pattern: "*.{png}" - versions: type: file description: File containing software versions @@ -91,3 +99,4 @@ authors: - "@drpatelh" - "@fbdtemme" - "@lassefolkersen" + - "@SusiJo" From 3d57caa683a48a014abf986cfdaaf0b9f6ff9676 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 09:13:27 +0200 Subject: [PATCH 03/19] added test & corrected cram input --- tests/modules/cnvkit/batch/main.nf | 19 ++++++++++++++--- tests/modules/cnvkit/batch/test.yml | 33 +++++++++++++++++++---------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/tests/modules/cnvkit/batch/main.nf b/tests/modules/cnvkit/batch/main.nf index 6b40dec6..15b5dfe6 100755 --- a/tests/modules/cnvkit/batch/main.nf +++ b/tests/modules/cnvkit/batch/main.nf @@ -35,8 +35,8 @@ workflow test_cnvkit_cram { input = [ [ id:'test'], // meta map - file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_cram'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true) ] fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) @@ -53,5 +53,18 @@ workflow test_cnvkit_tumoronly { fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) reference = file(params.test_data['generic']['cnn']['reference'], checkIfExists: true) - CNVKIT_TUMORONLY ( input, [], [], reference ) + CNVKIT_TUMORONLY ( input, fasta, [], reference ) +} + +workflow test_cnvkit_tumoronly_cram { + + input = [ + [ id:'test'], // meta map + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_cram'], checkIfExists: true), + [] + ] + fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + reference = file(params.test_data['generic']['cnn']['reference'], checkIfExists: true) + + CNVKIT_TUMORONLY ( input, fasta, [], reference ) } diff --git a/tests/modules/cnvkit/batch/test.yml b/tests/modules/cnvkit/batch/test.yml index 57af3603..9bce265a 100755 --- a/tests/modules/cnvkit/batch/test.yml +++ b/tests/modules/cnvkit/batch/test.yml @@ -1,15 +1,15 @@ - name: cnvkit batch test_cnvkit_hybrid - command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_hybrid -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config + command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_hybrid -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config tags: - - cnvkit/batch - cnvkit + - cnvkit/batch files: - path: output/cnvkit/baits.antitarget.bed md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/baits.target.bed md5sum: 26d25ff2d6c45b6d92169b3559c6acdb - path: output/cnvkit/reference.cnn - md5sum: ac99c1ad8b917b96ae15119146c91ab9 + md5sum: 035d031f54c5f1b43b903da96559b475 - path: output/cnvkit/test.paired_end.sorted.antitargetcoverage.cnn md5sum: 203caf8cef6935bb50b4138097955cb8 - path: output/cnvkit/test.paired_end.sorted.bintest.cns @@ -28,10 +28,10 @@ md5sum: aa8a018b1d4d1e688c9f9f6ae01bf4d7 - name: cnvkit batch test_cnvkit_wgs - command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_wgs -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config + command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_wgs -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config tags: - - cnvkit/batch - cnvkit + - cnvkit/batch files: - path: output/cnvkit/genome.antitarget.bed md5sum: d41d8cd98f00b204e9800998ecf8427e @@ -40,7 +40,7 @@ - path: output/cnvkit/genome.target.bed md5sum: a13353ae9c8405e701390c069255bbd2 - path: output/cnvkit/reference.cnn - md5sum: 05c6211e0179885b8a83e44fd21d5f86 + md5sum: 1606a85410bfaa79464be6e98699aa83 - path: output/cnvkit/test.paired_end.sorted.antitargetcoverage.cnn md5sum: 203caf8cef6935bb50b4138097955cb8 - path: output/cnvkit/test.paired_end.sorted.targetcoverage.cnn @@ -59,10 +59,10 @@ md5sum: 6ae6b3fce7299eedca6133d911c38fe1 - name: cnvkit batch test_cnvkit_cram - command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_cram -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config + command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_cram -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config tags: - - cnvkit/batch - cnvkit + - cnvkit/batch files: - path: output/cnvkit/genome.antitarget.bed md5sum: d41d8cd98f00b204e9800998ecf8427e @@ -71,7 +71,7 @@ - path: output/cnvkit/genome.target.bed md5sum: a13353ae9c8405e701390c069255bbd2 - path: output/cnvkit/reference.cnn - md5sum: 05c6211e0179885b8a83e44fd21d5f86 + md5sum: 1606a85410bfaa79464be6e98699aa83 - path: output/cnvkit/test.paired_end.sorted.antitargetcoverage.cnn md5sum: 203caf8cef6935bb50b4138097955cb8 - path: output/cnvkit/test.paired_end.sorted.targetcoverage.cnn @@ -90,10 +90,21 @@ md5sum: 6ae6b3fce7299eedca6133d911c38fe1 - name: cnvkit batch test_cnvkit_tumoronly - command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_tumoronly -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config + command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_tumoronly -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config tags: - - cnvkit/batch - cnvkit + - cnvkit/batch + files: + - path: output/cnvkit/reference.antitarget-tmp.bed + md5sum: d41d8cd98f00b204e9800998ecf8427e + - path: output/cnvkit/reference.target-tmp.bed + md5sum: 26d25ff2d6c45b6d92169b3559c6acdb + +- name: cnvkit batch test_cnvkit_tumoronly_cram + command: nextflow run ./tests/modules/cnvkit/batch -entry test_cnvkit_tumoronly_cram -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/batch/nextflow.config + tags: + - cnvkit + - cnvkit/batch files: - path: output/cnvkit/reference.antitarget-tmp.bed md5sum: d41d8cd98f00b204e9800998ecf8427e From 129270d7bc31830ea5f4772264c6dcb5007ee817 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 10:37:46 +0200 Subject: [PATCH 04/19] adjusted conda env & singularity container --- modules/cnvkit/batch/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 1ceb7072..063808a1 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -2,9 +2,9 @@ process CNVKIT_BATCH { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? 'bioconda::cnvkit=0.9.9' : null) + conda (params.enable_conda ? 'bioconda::cnvkit=0.9.9 bioconda::samtools=1.15.1' : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/cnvkit:0.9.9--pyhdfd78af_0' : + 'https://depot.galaxyproject.org/singularity/mulled-v2-780d630a9bb6a0ff2e7b6f730906fd703e40e98f:304d1c5ab610f216e77c61420ebe85f1e7c5968a-0' : 'quay.io/biocontainers/mulled-v2-780d630a9bb6a0ff2e7b6f730906fd703e40e98f:304d1c5ab610f216e77c61420ebe85f1e7c5968a-0' }" input: From f392c4bed533ccacd0e79cca736666417e877ad0 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 13:05:43 +0200 Subject: [PATCH 05/19] removed params section & added description fasta --- modules/cnvkit/batch/meta.yml | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/modules/cnvkit/batch/meta.yml b/modules/cnvkit/batch/meta.yml index 03277e33..2cd675c7 100644 --- a/modules/cnvkit/batch/meta.yml +++ b/modules/cnvkit/batch/meta.yml @@ -11,27 +11,6 @@ tools: homepage: https://cnvkit.readthedocs.io/en/stable/index.html documentation: https://cnvkit.readthedocs.io/en/stable/index.html licence: ["Apache-2.0"] -params: - - outdir: - type: string - description: | - The pipeline's output directory. By default, the module will - output files into `$params.outdir/` - - publish_dir_mode: - type: string - description: | - Value for the Nextflow `publishDir` mode parameter. - Available: symlink, rellink, link, copy, copyNoFollow, move. - - enable_conda: - type: boolean - description: | - Run the module with Conda using the software specified - via the `conda` directive - - singularity_pull_docker_container: - type: boolean - description: | - Instead of directly downloading Singularity images for use with Singularity, - force the workflow to pull and convert Docker containers instead. input: - meta: type: map @@ -49,7 +28,7 @@ input: - fasta: type: file description: | - Input reference genome fasta file + Input reference genome fasta file (only needed for cram_input and/or when normal_samples are provided) - targetfile: type: file description: | From 00077c36c8f57474c7540053b7ec43d4c4378c13 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 13:06:16 +0200 Subject: [PATCH 06/19] removed unnecessary fasta for tumor_only_bam --- tests/modules/cnvkit/batch/main.nf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/modules/cnvkit/batch/main.nf b/tests/modules/cnvkit/batch/main.nf index 15b5dfe6..988ed3ad 100755 --- a/tests/modules/cnvkit/batch/main.nf +++ b/tests/modules/cnvkit/batch/main.nf @@ -50,10 +50,9 @@ workflow test_cnvkit_tumoronly { file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true), [] ] - fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) reference = file(params.test_data['generic']['cnn']['reference'], checkIfExists: true) - CNVKIT_TUMORONLY ( input, fasta, [], reference ) + CNVKIT_TUMORONLY ( input, [], [], reference ) } workflow test_cnvkit_tumoronly_cram { From 3b3921cfa319602ed15c7021969122d72d600e46 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Fri, 20 May 2022 13:07:57 +0200 Subject: [PATCH 07/19] refine comment Co-authored-by: FriederikeHanssen --- modules/cnvkit/batch/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 063808a1..63482c6c 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -27,7 +27,7 @@ process CNVKIT_BATCH { script: def args = task.ext.args ?: '' - // execute samtools only when cram files are input + // execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow // input pair is assumed to have same extension if both exist def is_cram = tumor.Extension == "cram" ? true : false def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" From 2e5aa0dbb45632072cbe862985e0e4ff50c55867 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Fri, 20 May 2022 13:08:26 +0200 Subject: [PATCH 08/19] refine comment Co-authored-by: FriederikeHanssen --- modules/cnvkit/batch/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 63482c6c..55e3ee6b 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -31,7 +31,7 @@ process CNVKIT_BATCH { // input pair is assumed to have same extension if both exist def is_cram = tumor.Extension == "cram" ? true : false def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" - // do not run samtools on normal samples in tumor_only + // do not run samtools on normal samples in tumor_only mode def normal_exists = normal ? true: false // tumor_only mode does not need fasta & target // instead it requires a pre-computed reference which is built from fasta & target From 153c900d0e8c2e871a984bf40fb92a06ed019ae7 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Fri, 20 May 2022 13:08:38 +0200 Subject: [PATCH 09/19] refine comment Co-authored-by: FriederikeHanssen --- modules/cnvkit/batch/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 55e3ee6b..c3a4ba32 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -34,7 +34,7 @@ process CNVKIT_BATCH { // do not run samtools on normal samples in tumor_only mode def normal_exists = normal ? true: false // tumor_only mode does not need fasta & target - // instead it requires a pre-computed reference which is built from fasta & target + // instead it requires a pre-computed reference.cnn which is built from fasta & target def (normal_out, normal_args, fasta_args, target_args) = ["", "", "", ""] def reference_args = reference ? "--reference $reference" : "" From bdf222649d04fc2748d5247e02aa7fd7a1646a70 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 13:25:57 +0200 Subject: [PATCH 10/19] remove unnecessary if statement --- modules/cnvkit/batch/main.nf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index c3a4ba32..66cfe8b2 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -27,7 +27,7 @@ process CNVKIT_BATCH { script: def args = task.ext.args ?: '' - // execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow + // execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow // input pair is assumed to have same extension if both exist def is_cram = tumor.Extension == "cram" ? true : false def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" @@ -35,7 +35,8 @@ process CNVKIT_BATCH { def normal_exists = normal ? true: false // tumor_only mode does not need fasta & target // instead it requires a pre-computed reference.cnn which is built from fasta & target - def (normal_out, normal_args, fasta_args, target_args) = ["", "", "", ""] + def (normal_out, normal_args, fasta_args) = ["", "", ""] + def target_args = targets ? "--targets $targets" : "" def reference_args = reference ? "--reference $reference" : "" if (normal_exists){ @@ -45,13 +46,6 @@ process CNVKIT_BATCH { fasta_args = fasta ? "--fasta $fasta" : "" } - if (args.contains("--method wgs") || args.contains("-m wgs")) { - target_args = targets ? "--targets $targets" : "" - } - else { - target_args = "--targets $targets" - } - """ if $is_cram; then samtools view -T $fasta $tumor -@ $task.cpus -o $tumor_out From 9096be5464d800156761b7c73c574f5a5bad2f72 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Fri, 20 May 2022 13:29:49 +0200 Subject: [PATCH 11/19] improve readability --- modules/cnvkit/batch/main.nf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/cnvkit/batch/main.nf b/modules/cnvkit/batch/main.nf index 66cfe8b2..c1f9ef87 100644 --- a/modules/cnvkit/batch/main.nf +++ b/modules/cnvkit/batch/main.nf @@ -27,17 +27,17 @@ process CNVKIT_BATCH { script: def args = task.ext.args ?: '' + // execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow // input pair is assumed to have same extension if both exist def is_cram = tumor.Extension == "cram" ? true : false def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" + // do not run samtools on normal samples in tumor_only mode def normal_exists = normal ? true: false // tumor_only mode does not need fasta & target // instead it requires a pre-computed reference.cnn which is built from fasta & target def (normal_out, normal_args, fasta_args) = ["", "", ""] - def target_args = targets ? "--targets $targets" : "" - def reference_args = reference ? "--reference $reference" : "" if (normal_exists){ def normal_prefix = normal.BaseName @@ -46,6 +46,9 @@ process CNVKIT_BATCH { fasta_args = fasta ? "--fasta $fasta" : "" } + def target_args = targets ? "--targets $targets" : "" + def reference_args = reference ? "--reference $reference" : "" + """ if $is_cram; then samtools view -T $fasta $tumor -@ $task.cpus -o $tumor_out From 4f9d672e55bc42d24fcc9e197e1ea7d86c1d2dd0 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Mon, 23 May 2022 16:52:06 +0200 Subject: [PATCH 12/19] added new module cnvkit/antitarget --- modules/cnvkit/antitarget/main.nf | 40 +++++++++++++++++ modules/cnvkit/antitarget/meta.yml | 44 +++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/cnvkit/antitarget/main.nf | 16 +++++++ .../modules/cnvkit/antitarget/nextflow.config | 5 +++ tests/modules/cnvkit/antitarget/test.yml | 8 ++++ 6 files changed, 117 insertions(+) create mode 100644 modules/cnvkit/antitarget/main.nf create mode 100644 modules/cnvkit/antitarget/meta.yml create mode 100644 tests/modules/cnvkit/antitarget/main.nf create mode 100644 tests/modules/cnvkit/antitarget/nextflow.config create mode 100644 tests/modules/cnvkit/antitarget/test.yml diff --git a/modules/cnvkit/antitarget/main.nf b/modules/cnvkit/antitarget/main.nf new file mode 100644 index 00000000..af2d7558 --- /dev/null +++ b/modules/cnvkit/antitarget/main.nf @@ -0,0 +1,40 @@ + +process CNVKIT_ANTITARGET { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::cnvkit=0.9.9" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/cnvkit:0.9.9--pyhdfd78af_0': + 'quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0' }" + + input: + + tuple val(meta), path(targets) + + output: + + tuple val(meta), path("*.bed"), emit: bed + + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + cnvkit.py \\ + antitarget \\ + $targets \\ + --output ${prefix}.antitarget.bed \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cnvkit: \$(cnvkit.py version | sed -e "s/cnvkit v//g") + END_VERSIONS + """ +} diff --git a/modules/cnvkit/antitarget/meta.yml b/modules/cnvkit/antitarget/meta.yml new file mode 100644 index 00000000..28a2bfa4 --- /dev/null +++ b/modules/cnvkit/antitarget/meta.yml @@ -0,0 +1,44 @@ +name: cnvkit_antitarget +description: +keywords: + - cvnkit + - antitarget +tools: + - cnvkit: + description: | + CNVkit is a Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data. + It is designed for use with hybrid capture, including both whole-exome and custom target panels, and short-read sequencing platforms such as Illumina and Ion Torrent. + homepage: https://cnvkit.readthedocs.io/en/stable/index.html + documentation: https://cnvkit.readthedocs.io/en/stable/index.html + tool_dev_url: "https://github.com/etal/cnvkit" + doi: 10.1371/journal.pcbi.1004873 + licence: ["Apache-2.0"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - targets: + type: file + description: File containing genomic regions + pattern: "*.{bed}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bed: + type: file + description: File containing off-target regions + pattern: "*.{bed}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@SusiJo" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index c1aeb0c6..7aa4b64d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -447,6 +447,10 @@ cmseq/polymut: - modules/cmseq/polymut/** - tests/modules/cmseq/polymut/** +cnvkit/antitarget: + - modules/cnvkit/antitarget/** + - tests/modules/cnvkit/antitarget/** + cnvkit/batch: - modules/cnvkit/batch/** - tests/modules/cnvkit/batch/** diff --git a/tests/modules/cnvkit/antitarget/main.nf b/tests/modules/cnvkit/antitarget/main.nf new file mode 100644 index 00000000..44e49eb2 --- /dev/null +++ b/tests/modules/cnvkit/antitarget/main.nf @@ -0,0 +1,16 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { CNVKIT_ANTITARGET } from '../../../../modules/cnvkit/antitarget/main.nf' + +workflow test_cnvkit_antitarget { + + input = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) + ] + + CNVKIT_ANTITARGET ( input ) +} + diff --git a/tests/modules/cnvkit/antitarget/nextflow.config b/tests/modules/cnvkit/antitarget/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/cnvkit/antitarget/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/cnvkit/antitarget/test.yml b/tests/modules/cnvkit/antitarget/test.yml new file mode 100644 index 00000000..e1c3d0c8 --- /dev/null +++ b/tests/modules/cnvkit/antitarget/test.yml @@ -0,0 +1,8 @@ +- name: cnvkit antitarget test_cnvkit_antitarget + command: nextflow run ./tests/modules/cnvkit/antitarget -entry test_cnvkit_antitarget -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/antitarget/nextflow.config + tags: + - cnvkit + - cnvkit/antitarget + files: + - path: output/cnvkit/test.antitarget.bed + md5sum: 3d4d20f9f23b39970865d29ef239d20b From bbee9e3c3bea54e8cedc0d8ec68619b1d05dae2e Mon Sep 17 00:00:00 2001 From: SusiJo Date: Mon, 23 May 2022 18:35:50 +0200 Subject: [PATCH 13/19] add new module cnvkit/reference --- modules/cnvkit/reference/main.nf | 39 +++++++++++++++ modules/cnvkit/reference/meta.yml | 47 +++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/cnvkit/reference/main.nf | 14 ++++++ .../modules/cnvkit/reference/nextflow.config | 5 ++ tests/modules/cnvkit/reference/test.yml | 8 ++++ 6 files changed, 117 insertions(+) create mode 100644 modules/cnvkit/reference/main.nf create mode 100644 modules/cnvkit/reference/meta.yml create mode 100644 tests/modules/cnvkit/reference/main.nf create mode 100644 tests/modules/cnvkit/reference/nextflow.config create mode 100644 tests/modules/cnvkit/reference/test.yml diff --git a/modules/cnvkit/reference/main.nf b/modules/cnvkit/reference/main.nf new file mode 100644 index 00000000..1f0b20d8 --- /dev/null +++ b/modules/cnvkit/reference/main.nf @@ -0,0 +1,39 @@ +process CNVKIT_REFERENCE { + tag "$reference" + label 'process_low' + + conda (params.enable_conda ? "bioconda::cnvkit=0.9.9" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/cnvkit:0.9.9--pyhdfd78af_0': + 'quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0' }" + + input: + path fasta + path targets + path antitargets + + output: + path("*.cnn") , emit: cnn + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + + """ + cnvkit.py \\ + reference \\ + --fasta $fasta \\ + --targets $targets \\ + --antitargets $antitargets \\ + --output reference.cnn \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cnvkit: \$(cnvkit.py version | sed -e "s/cnvkit v//g") + END_VERSIONS + """ +} diff --git a/modules/cnvkit/reference/meta.yml b/modules/cnvkit/reference/meta.yml new file mode 100644 index 00000000..2e0fef1a --- /dev/null +++ b/modules/cnvkit/reference/meta.yml @@ -0,0 +1,47 @@ +name: cnvkit_reference +description: +keywords: + - cnvkit + - reference +tools: + - cnvkit: + description: | + CNVkit is a Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data. + It is designed for use with hybrid capture, including both whole-exome and custom target panels, and short-read sequencing platforms such as Illumina and Ion Torrent. + homepage: https://cnvkit.readthedocs.io/en/stable/index.html + documentation: https://cnvkit.readthedocs.io/en/stable/index.html + tool_dev_url: https://github.com/etal/cnvkit + doi: 10.1371/journal.pcbi.1004873 + licence: ["Apache-2.0"] + +input: + - fasta: + type: file + description: File containing reference genome + pattern: "*.{fasta}" + - targets: + type: file + description: File containing genomic regions + pattern: "*.{bed}" + - antitargets: + type: file + description: File containing off-target genomic regions + pattern: "*.{bed}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reference: + type: file + description: File containing a copy-number reference (required for CNV calling in tumor_only mode) + pattern: "*.{cnn}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@SusiJo" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 78e85487..0e5a1815 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -451,6 +451,10 @@ cnvkit/batch: - modules/cnvkit/batch/** - tests/modules/cnvkit/batch/** +cnvkit/reference: + - modules/cnvkit/reference/** + - tests/modules/cnvkit/reference/** + controlfreec/assesssignificance: - modules/controlfreec/assesssignificance/** - tests/modules/controlfreec/assesssignificance/** diff --git a/tests/modules/cnvkit/reference/main.nf b/tests/modules/cnvkit/reference/main.nf new file mode 100644 index 00000000..bd7009c0 --- /dev/null +++ b/tests/modules/cnvkit/reference/main.nf @@ -0,0 +1,14 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { CNVKIT_REFERENCE } from '../../../../modules/cnvkit/reference/main.nf' + +workflow test_cnvkit_reference { + + fasta = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + targets = file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) + antitargets = file("/Users/susanne/Documents/repos/forks/modules/test_antitarget/output/cnvkit/test.antitarget.bed", checkIfExists: true) + + CNVKIT_REFERENCE ( fasta, targets, antitargets ) +} diff --git a/tests/modules/cnvkit/reference/nextflow.config b/tests/modules/cnvkit/reference/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/cnvkit/reference/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/cnvkit/reference/test.yml b/tests/modules/cnvkit/reference/test.yml new file mode 100644 index 00000000..b1b8c896 --- /dev/null +++ b/tests/modules/cnvkit/reference/test.yml @@ -0,0 +1,8 @@ +- name: cnvkit reference test_cnvkit_reference + command: nextflow run ./tests/modules/cnvkit/reference -entry test_cnvkit_reference -c ./tests/config/nextflow.config -c ./tests/modules/cnvkit/reference/nextflow.config + tags: + - cnvkit/reference + - cnvkit + files: + - path: output/cnvkit/reference.cnn + md5sum: 7c4a7902f5ab101b1f9d6038d331b3d9 From ddb964a4bf33b4026a31a25778a7ee26df0da1d6 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Mon, 23 May 2022 18:48:04 +0200 Subject: [PATCH 14/19] rm line Co-authored-by: FriederikeHanssen --- modules/cnvkit/antitarget/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/cnvkit/antitarget/main.nf b/modules/cnvkit/antitarget/main.nf index af2d7558..f0516eeb 100644 --- a/modules/cnvkit/antitarget/main.nf +++ b/modules/cnvkit/antitarget/main.nf @@ -1,4 +1,3 @@ - process CNVKIT_ANTITARGET { tag "$meta.id" label 'process_low' From 24905e26e2dcf8cacadee54c7b280d8bda511da4 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Mon, 23 May 2022 18:48:13 +0200 Subject: [PATCH 15/19] rm line Co-authored-by: FriederikeHanssen --- modules/cnvkit/antitarget/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/cnvkit/antitarget/main.nf b/modules/cnvkit/antitarget/main.nf index f0516eeb..6c092a31 100644 --- a/modules/cnvkit/antitarget/main.nf +++ b/modules/cnvkit/antitarget/main.nf @@ -8,7 +8,6 @@ process CNVKIT_ANTITARGET { 'quay.io/biocontainers/cnvkit:0.9.9--pyhdfd78af_0' }" input: - tuple val(meta), path(targets) output: From 86b5951c14eaf5a11376f2fd8abd6a912bdfb214 Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Mon, 23 May 2022 18:48:30 +0200 Subject: [PATCH 16/19] rm line Co-authored-by: FriederikeHanssen --- modules/cnvkit/antitarget/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/cnvkit/antitarget/main.nf b/modules/cnvkit/antitarget/main.nf index 6c092a31..a3181daa 100644 --- a/modules/cnvkit/antitarget/main.nf +++ b/modules/cnvkit/antitarget/main.nf @@ -11,7 +11,6 @@ process CNVKIT_ANTITARGET { tuple val(meta), path(targets) output: - tuple val(meta), path("*.bed"), emit: bed path "versions.yml" , emit: versions From 58c5ec2f4eb44eff1fb7cc9e02df07bd448c6aaf Mon Sep 17 00:00:00 2001 From: SusiJo <43847534+SusiJo@users.noreply.github.com> Date: Mon, 23 May 2022 18:53:28 +0200 Subject: [PATCH 17/19] rm line Co-authored-by: FriederikeHanssen --- modules/cnvkit/antitarget/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/cnvkit/antitarget/main.nf b/modules/cnvkit/antitarget/main.nf index a3181daa..bf6461bd 100644 --- a/modules/cnvkit/antitarget/main.nf +++ b/modules/cnvkit/antitarget/main.nf @@ -12,7 +12,6 @@ process CNVKIT_ANTITARGET { output: tuple val(meta), path("*.bed"), emit: bed - path "versions.yml" , emit: versions when: From 8fec7ae3218020fc305ba14fe19720783b8baf1c Mon Sep 17 00:00:00 2001 From: SusiJo Date: Mon, 23 May 2022 19:01:46 +0200 Subject: [PATCH 18/19] added new testdata path --- tests/config/test_data.config | 1 + tests/modules/cnvkit/reference/main.nf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/config/test_data.config b/tests/config/test_data.config index cf7d45f6..39331664 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -142,6 +142,7 @@ params { genome_21_sizes = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/genome.sizes" genome_21_interval_list = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/genome.interval_list" genome_21_multi_interval_bed = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed" + genome_21_multi_interval_antitarget_bed = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.antitarget.bed" genome_21_multi_interval_bed_gz = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed.gz" genome_21_multi_interval_bed_gz_tbi = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed.gz.tbi" genome_21_chromosomes_dir = "${test_data_dir}/genomics/homo_sapiens/genome/chr21/sequence/chromosomes.tar.gz" diff --git a/tests/modules/cnvkit/reference/main.nf b/tests/modules/cnvkit/reference/main.nf index bd7009c0..a72ad566 100644 --- a/tests/modules/cnvkit/reference/main.nf +++ b/tests/modules/cnvkit/reference/main.nf @@ -8,7 +8,7 @@ workflow test_cnvkit_reference { fasta = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) targets = file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) - antitargets = file("/Users/susanne/Documents/repos/forks/modules/test_antitarget/output/cnvkit/test.antitarget.bed", checkIfExists: true) + antitargets = file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_antitarget_bed'], checkIfExists: true) CNVKIT_REFERENCE ( fasta, targets, antitargets ) } From 1451d62be43f62045d3b30c36a51afacfb3cf1c0 Mon Sep 17 00:00:00 2001 From: SusiJo Date: Tue, 24 May 2022 07:38:53 +0200 Subject: [PATCH 19/19] rm md5sums for empty files --- tests/modules/cnvkit/batch/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/modules/cnvkit/batch/test.yml b/tests/modules/cnvkit/batch/test.yml index 9bce265a..00d6a767 100755 --- a/tests/modules/cnvkit/batch/test.yml +++ b/tests/modules/cnvkit/batch/test.yml @@ -5,7 +5,6 @@ - cnvkit/batch files: - path: output/cnvkit/baits.antitarget.bed - md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/baits.target.bed md5sum: 26d25ff2d6c45b6d92169b3559c6acdb - path: output/cnvkit/reference.cnn @@ -34,7 +33,6 @@ - cnvkit/batch files: - path: output/cnvkit/genome.antitarget.bed - md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/genome.bed md5sum: 87a15eb9c2ff20ccd5cd8735a28708f7 - path: output/cnvkit/genome.target.bed @@ -65,7 +63,6 @@ - cnvkit/batch files: - path: output/cnvkit/genome.antitarget.bed - md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/genome.bed md5sum: 87a15eb9c2ff20ccd5cd8735a28708f7 - path: output/cnvkit/genome.target.bed @@ -96,7 +93,6 @@ - cnvkit/batch files: - path: output/cnvkit/reference.antitarget-tmp.bed - md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/reference.target-tmp.bed md5sum: 26d25ff2d6c45b6d92169b3559c6acdb @@ -107,6 +103,5 @@ - cnvkit/batch files: - path: output/cnvkit/reference.antitarget-tmp.bed - md5sum: d41d8cd98f00b204e9800998ecf8427e - path: output/cnvkit/reference.target-tmp.bed md5sum: 26d25ff2d6c45b6d92169b3559c6acdb