From 6cd3d871ff4a671d4d3891b50b96be69cfad4686 Mon Sep 17 00:00:00 2001 From: Vasiliy Strelnikov Date: Wed, 28 Aug 2024 14:30:19 +0000 Subject: [PATCH 1/3] Add deepsomatic module scaffolding --- modules/nf-core/deepsomatic/environment.yml | 9 +++ modules/nf-core/deepsomatic/main.nf | 74 ++++++++++++++++++ modules/nf-core/deepsomatic/meta.yml | 75 +++++++++++++++++++ .../nf-core/deepsomatic/tests/main.nf.test | 73 ++++++++++++++++++ .../deepsomatic/tests/main.nf.test.snap | 48 ++++++++++++ modules/nf-core/deepsomatic/tests/tags.yml | 2 + 6 files changed, 281 insertions(+) create mode 100644 modules/nf-core/deepsomatic/environment.yml create mode 100644 modules/nf-core/deepsomatic/main.nf create mode 100644 modules/nf-core/deepsomatic/meta.yml create mode 100644 modules/nf-core/deepsomatic/tests/main.nf.test create mode 100644 modules/nf-core/deepsomatic/tests/main.nf.test.snap create mode 100644 modules/nf-core/deepsomatic/tests/tags.yml diff --git a/modules/nf-core/deepsomatic/environment.yml b/modules/nf-core/deepsomatic/environment.yml new file mode 100644 index 00000000000..45ecb999e4f --- /dev/null +++ b/modules/nf-core/deepsomatic/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "deepsomatic" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "YOUR-TOOL-HERE" diff --git a/modules/nf-core/deepsomatic/main.nf b/modules/nf-core/deepsomatic/main.nf new file mode 100644 index 00000000000..28835cca817 --- /dev/null +++ b/modules/nf-core/deepsomatic/main.nf @@ -0,0 +1,74 @@ +process DEEPSOMATIC { + tag "$meta.id" + label 'process_high' + + container "docker.io/google/deepsomatic:1.6.1" + + input: + tuple val(meta), path(input_normal), path(index_normal) + tuple val(meta2), path(input_tumor), path(index_tumor) + tuple val(meta3), path(intervals) + tuple val(meta4), path(fasta) + tuple val(meta5), path(fai) + tuple val(meta6), path(gzi) + + output: + tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf + tuple val(meta), path("${prefix}.vcf.gz.tbi") , emit: vcf_tbi + tuple val(meta), path("${prefix}.g.vcf.gz") , emit: gvcf + tuple val(meta), path("${prefix}.g.vcf.gz.tbi"), emit: gvcf_tbi + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def regions = intervals ? "--regions=${intervals}" : "" + def VERSION = '1.6.1' + + """ + run_deepsomatic \\ + --ref=${fasta} \\ + --reads_normal=${input_normal} \\ + --reads_tumor=${input_tumor} \\ + --output_vcf=${prefix}.vcf.gz \\ + --output_gvcf=${prefix}.g.vcf.gz \\ + --sample_name_tumor="tumor" \\ + --sample_name_normal="normal" \\ + ${args} \\ + ${regions} \\ + --intermediate_results_dir=tmp \\ + --num_shards=${task.cpus} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deepsomatic: $VERSION + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead." + } + prefix = task.ext.prefix ?: "${meta.id}" + + def VERSION = '1.6.1' + """ + touch ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + touch ${prefix}.g.vcf.gz + touch ${prefix}.g.vcf.gz.tbi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deepsomatic: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/deepsomatic/meta.yml b/modules/nf-core/deepsomatic/meta.yml new file mode 100644 index 00000000000..0d3568531e7 --- /dev/null +++ b/modules/nf-core/deepsomatic/meta.yml @@ -0,0 +1,75 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "deepsomatic" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - variant calling + - machine learning + - neural network +tools: + - "deepsomatic": + ## TODO nf-core: Add a description and other details for the software below + description: "" + homepage: "https://github.com/google/deepsomatic" + documentation: "https://github.com/google/deepsomatic" + tool_dev_url: "https://github.com/google/deepsomatic" + doi: "10.1101/2024.08.16.608331" + licence: ["BSD-3-clause"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - input_normal: + type: file + description: BAM/CRAM file + pattern: "*.bam/cram" + - index_normal: + type: file + description: Index of BAM/CRAM file + pattern: "*.bai/crai" + - input_tumor: + type: file + description: BAM/CRAM file + pattern: "*.bam/cram" + - index_tumor: + type: file + description: Index of BAM/CRAM file + pattern: "*.bai/crai" + - intervals: + type: file + description: Interval file for targeted regions + pattern: "*.bed" + + ## TODO nf-core: Delete / customise this example input + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +## TODO nf-core: Add a description of all of the variables used as output +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + ## TODO nf-core: Delete / customise this example output + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +authors: + - "@vaxyzek" +maintainers: + - "@vaxyzek" diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test b/modules/nf-core/deepsomatic/tests/main.nf.test new file mode 100644 index 00000000000..95f0510e620 --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/main.nf.test @@ -0,0 +1,73 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test deepsomatic +nextflow_process { + + name "Test Process DEEPSOMATIC" + script "../main.nf" + process "DEEPSOMATIC" + + tag "modules" + tag "modules_nfcore" + tag "deepsomatic" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test.snap b/modules/nf-core/deepsomatic/tests/main.nf.test.snap new file mode 100644 index 00000000000..9e693386d22 --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/main.nf.test.snap @@ -0,0 +1,48 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "bam": [ + + ], + "versions": [ + + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-08-21T17:53:00.524660985" + }, + "sarscov2 - bam": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "bam": [ + + ], + "versions": [ + + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-08-21T17:52:54.704070521" + } +} \ No newline at end of file diff --git a/modules/nf-core/deepsomatic/tests/tags.yml b/modules/nf-core/deepsomatic/tests/tags.yml new file mode 100644 index 00000000000..a8bf10c9f3f --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/tags.yml @@ -0,0 +1,2 @@ +deepsomatic: + - "modules/nf-core/deepsomatic/**" From 9290b0f700b6cc149de5e5c86b1f9d2756e363b1 Mon Sep 17 00:00:00 2001 From: Vasiliy Strelnikov Date: Fri, 4 Oct 2024 14:27:33 +0000 Subject: [PATCH 2/3] Add test against sample nf-core test-datasets data Bump deepsomatic version to 1.7.0 --- modules/nf-core/deepsomatic/environment.yml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 modules/nf-core/deepsomatic/environment.yml diff --git a/modules/nf-core/deepsomatic/environment.yml b/modules/nf-core/deepsomatic/environment.yml deleted file mode 100644 index 45ecb999e4f..00000000000 --- a/modules/nf-core/deepsomatic/environment.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json -name: "deepsomatic" -channels: - - conda-forge - - bioconda - - defaults -dependencies: - - "YOUR-TOOL-HERE" From 45514e8013fdeedc970f7daf5604f10c8b7f4e3a Mon Sep 17 00:00:00 2001 From: Vasiliy Strelnikov Date: Fri, 4 Oct 2024 15:40:13 +0000 Subject: [PATCH 3/3] Add test against nf-core test-datasets --- modules/nf-core/deepsomatic/main.nf | 6 +- .../nf-core/deepsomatic/tests/main.nf.test | 68 +++++++++---------- .../deepsomatic/tests/main.nf.test.snap | 20 ++++++ 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/modules/nf-core/deepsomatic/main.nf b/modules/nf-core/deepsomatic/main.nf index 28835cca817..a12dcf57056 100644 --- a/modules/nf-core/deepsomatic/main.nf +++ b/modules/nf-core/deepsomatic/main.nf @@ -2,7 +2,7 @@ process DEEPSOMATIC { tag "$meta.id" label 'process_high' - container "docker.io/google/deepsomatic:1.6.1" + container "docker.io/google/deepsomatic:1.7.0" input: tuple val(meta), path(input_normal), path(index_normal) @@ -30,7 +30,7 @@ process DEEPSOMATIC { def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" def regions = intervals ? "--regions=${intervals}" : "" - def VERSION = '1.6.1' + def VERSION = '1.7.0' """ run_deepsomatic \\ @@ -59,7 +59,7 @@ process DEEPSOMATIC { } prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = '1.6.1' + def VERSION = '1.7.0' """ touch ${prefix}.vcf.gz touch ${prefix}.vcf.gz.tbi diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test b/modules/nf-core/deepsomatic/tests/main.nf.test index 95f0510e620..21a4078130c 100644 --- a/modules/nf-core/deepsomatic/tests/main.nf.test +++ b/modules/nf-core/deepsomatic/tests/main.nf.test @@ -11,7 +11,7 @@ nextflow_process { tag "deepsomatic" // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("tumor_normal_pair") { // TODO nf-core: If you are created a test for a chained module // (the module requires running more than one process to generate the required output) @@ -24,8 +24,30 @@ nextflow_process { // TODO nf-core: define inputs of the process here. Example: input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + [ id:'normal' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + ] + input[1] = [ + [ id:'tumor'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + ] + input[2] = [ + [ id:'intervals' ], + [] + ] + input[3] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[4] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[5] = [ + [ id: 'gzi' ], + [] ] """ } @@ -34,37 +56,15 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. - ) - } - - } - - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { - - options "-stub" - - when { - process { - """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions, + ).match() + } ) } diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test.snap b/modules/nf-core/deepsomatic/tests/main.nf.test.snap index 9e693386d22..4b987e2252b 100644 --- a/modules/nf-core/deepsomatic/tests/main.nf.test.snap +++ b/modules/nf-core/deepsomatic/tests/main.nf.test.snap @@ -44,5 +44,25 @@ "nextflow": "24.04.3" }, "timestamp": "2024-08-21T17:52:54.704070521" + }, + "tumor_normal_pair": { + "content": [ + [ + + ], + [ + + ], + null, + null, + [ + + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-09-25T20:48:33.535517722" } } \ No newline at end of file