diff --git a/modules/nf-core/gens/preparecovandbaf/environment.yml b/modules/nf-core/gens/preparecovandbaf/environment.yml new file mode 100644 index 00000000000..1a3fa44cbe6 --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/environment.yml @@ -0,0 +1,11 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::htslib=1.23 + - conda-forge::pip=25.3 + - conda-forge::python=3.14.2 + - pip: + - gens-input-data-tools==2.0.0 diff --git a/modules/nf-core/gens/preparecovandbaf/main.nf b/modules/nf-core/gens/preparecovandbaf/main.nf new file mode 100644 index 00000000000..a036f28cece --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/main.nf @@ -0,0 +1,46 @@ +process PREPARECOVANDBAF { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/a9/a9f414681caefff508dcab89f4872ae3cda18d15b9b610b679fa5eb5023b4b7c/data': + 'community.wave.seqera.io/library/tabix_pip_gens-input-data-tools:5d39cfe6f6bf258b' }" + + input: + tuple val(meta), path(read_counts), path(gvcf), path(gvcf_tbi) + path baf_positions + + output: + tuple val(meta), path("*.cov.bed.gz") , emit: cov_gz + tuple val(meta), path("*.cov.bed.gz.tbi") , emit: cov_tbi + tuple val(meta), path("*.baf.bed.gz") , emit: baf_gz + tuple val(meta), path("*.baf.bed.gz.tbi") , emit: baf_tbi + tuple val("${task.process}"), val('preparecovandbaf'), eval("generate_cov_and_baf --version"), topic: versions, emit: versions_preparecovandbaf + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + generate_cov_and_baf \\ + --coverage $read_counts \\ + --gvcf $gvcf \\ + --label $prefix \\ + --baf_positions $baf_positions \\ + --bgzip_tabix_output \\ + $args \\ + --outdir . + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo "" | gzip > ${prefix}.cov.bed.gz + touch ${prefix}.cov.bed.gz.tbi + echo "" | gzip > ${prefix}.baf.bed.gz + touch ${prefix}.baf.bed.gz.tbi + """ +} diff --git a/modules/nf-core/gens/preparecovandbaf/meta.yml b/modules/nf-core/gens/preparecovandbaf/meta.yml new file mode 100644 index 00000000000..7de5e1159d3 --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/meta.yml @@ -0,0 +1,110 @@ +name: "preparecovandbaf" +description: Tools for preparing inputs for visualization in Gens +keywords: + - gens + - preparecovandbaf + - preprocessing + - genomics + - CNV +tools: + - "gens": + description: "Scripts for preparing input data to Gens" + homepage: "https://github.com/SMD-Bioinformatics-Lund/Prepare-Gens-input-data" + documentation: "https://github.com/SMD-Bioinformatics-Lund/Prepare-Gens-input-data/README.md" + tool_dev_url: "https://github.com/SMD-Bioinformatics-Lund/Prepare-Gens-input-data" + licence: [MIT] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - read_counts: + type: file + description: Binned coverage calculations from GATK + pattern: "*.{tsv}" + ontologies: + - edam: http://edamontology.org/format_3475 # TSV + - gvcf: + type: file + description: GVCF. It is used to calculate B-allele frequencies at the sites specified in baf_positions. It can be generated using any SNV-caller. + pattern: "*.vcf.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP format + - gvcf_tbi: + type: file + description: GVCF tabix index + pattern: "*.vcf.gz.tbi" + ontologies: [] + - baf_positions: + type: file + description: Sites to sample for BAF calculations + pattern: "*.{tsv,tsv.gz}" + + ontologies: + - edam: http://edamontology.org/format_3475 # TSV +output: + cov_gz: + - - meta: + type: map + description: | + Groovy Map containing sample information + - "*.cov.bed.gz": + type: file + description: Coverage bed (bgzipped) + + cov_tbi: + - - meta: + type: map + description: | + Groovy Map containing sample information + - "*.cov.bed.gz.tbi": + type: file + description: Tabix index for coverage bed + + baf_gz: + - - meta: + type: map + description: | + Groovy Map containing sample information + - "*.baf.bed.gz": + type: file + description: BAF bed (bgzipped) + + baf_tbi: + - - meta: + type: map + description: | + Groovy Map containing sample information + - "*.baf.bed.gz.tbi": + type: file + description: Tabix index for BAF bed + + versions_preparecovandbaf: + - - "${task.process}": + type: string + description: The process the versions were collected from + - "preparecovandbaf": + type: string + description: The tool name + - "generate_cov_and_baf --version": + type: string + description: The command used to generate the version of the tool + +topics: + versions: + - - "${task.process}": + type: string + description: The process the versions were collected from + - "preparecovandbaf": + type: string + description: The tool name + - "generate_cov_and_baf --version": + type: eval + description: The expression used to obtain the tool version +authors: + - "@jakob37" +maintainers: + - "@jakob37" diff --git a/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test b/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test new file mode 100644 index 00000000000..f466ecb959f --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test @@ -0,0 +1,66 @@ +nextflow_process { + + name "Test Process PREPARECOVANDBAF" + script "modules/nf-core/gens/preparecovandbaf/main.nf" + process "PREPARECOVANDBAF" + + tag "modules" + tag "modules_nfcore" + tag "gens" + tag "gens/preparecovandbaf" + + test("gens_preparecovandbaf") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/gatk/hg002_chr20_90000_to_100000.standardizedCR.tsv", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/hg002_chr20_90000_to_100000.dnascope.gvcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/hg002_chr20_90000_to_100000.dnascope.gvcf.gz.tbi", checkIfExists: true), + ] + input[1] = [ + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/tab/gnomad_hg38_chr20_90000_to_100000.0.05.txt.gz", checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("gens_preparecovandbaf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/gatk/hg002_chr20_90000_to_100000.standardizedCR.tsv", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/hg002_chr20_90000_to_100000.dnascope.gvcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/hg002_chr20_90000_to_100000.dnascope.gvcf.gz.tbi", checkIfExists: true), + ] + input[1] = [ + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/tab/gnomad_hg38_chr20_90000_to_100000.0.05.txt.gz", checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test.snap b/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test.snap new file mode 100644 index 00000000000..194c2c1d528 --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/tests/main.nf.test.snap @@ -0,0 +1,180 @@ +{ + "gens_preparecovandbaf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + "PREPARECOVANDBAF", + "preparecovandbaf", + "1.1.4" + ] + ], + "baf_gz": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "baf_tbi": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "cov_gz": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "cov_tbi": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_preparecovandbaf": [ + [ + "PREPARECOVANDBAF", + "preparecovandbaf", + "1.1.4" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-22T07:34:11.057444197" + }, + "gens_preparecovandbaf": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz:md5,2df1734048f1bab141050822a426145e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz.tbi:md5,66025dc44413e9e17c8e11af09e06dbe" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz:md5,ae86e22390df1ba20a931b70be92079f" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz.tbi:md5,442c8518dd2f818757a10ca4f06c1b6c" + ] + ], + "4": [ + [ + "PREPARECOVANDBAF", + "preparecovandbaf", + "1.1.4" + ] + ], + "baf_gz": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz:md5,ae86e22390df1ba20a931b70be92079f" + ] + ], + "baf_tbi": [ + [ + { + "id": "test" + }, + "test.baf.bed.gz.tbi:md5,442c8518dd2f818757a10ca4f06c1b6c" + ] + ], + "cov_gz": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz:md5,2df1734048f1bab141050822a426145e" + ] + ], + "cov_tbi": [ + [ + { + "id": "test" + }, + "test.cov.bed.gz.tbi:md5,66025dc44413e9e17c8e11af09e06dbe" + ] + ], + "versions_preparecovandbaf": [ + [ + "PREPARECOVANDBAF", + "preparecovandbaf", + "1.1.4" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-22T07:34:01.603970443" + } +} \ No newline at end of file diff --git a/modules/nf-core/gens/preparecovandbaf/tests/tags.yml b/modules/nf-core/gens/preparecovandbaf/tests/tags.yml new file mode 100644 index 00000000000..2c5ae0497af --- /dev/null +++ b/modules/nf-core/gens/preparecovandbaf/tests/tags.yml @@ -0,0 +1,2 @@ +gens/preparecovandbaf: + - modules/nf-core/gens/preparecovandbaf/**