diff --git a/modules/nf-core/strdrop/build/environment.yml b/modules/nf-core/strdrop/build/environment.yml new file mode 100644 index 000000000000..6bb6e068535a --- /dev/null +++ b/modules/nf-core/strdrop/build/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::pip=25.3 + - conda-forge::python=3.14.1 + - pip: + - strdrop==0.3 diff --git a/modules/nf-core/strdrop/build/main.nf b/modules/nf-core/strdrop/build/main.nf new file mode 100644 index 000000000000..61f00927be46 --- /dev/null +++ b/modules/nf-core/strdrop/build/main.nf @@ -0,0 +1,34 @@ +process STRDROP_BUILD { + 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/4f/4fc3114f6d67fadb826981d29ae67f8564ee81283184893c2db677d919b5b32d/data': + 'community.wave.seqera.io/library/pip_strdrop:df8d5dc993ea6848' }" + + input: + tuple val(meta), path(training_set, stageAs: 'input/*') + + output: + tuple val(meta), path("*.json"), emit: json + tuple val("${task.process}"), val('strdrop'), eval("strdrop --version | sed 's/.* //g'"), topic: versions, emit: versions_strdrop + + when: + task.ext.when == null || task.ext.when + + script: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + strdrop \\ + build \\ + --training-set ./input \\ + ${prefix}.json + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.json + """ +} diff --git a/modules/nf-core/strdrop/build/meta.yml b/modules/nf-core/strdrop/build/meta.yml new file mode 100644 index 000000000000..64f47d2a34af --- /dev/null +++ b/modules/nf-core/strdrop/build/meta.yml @@ -0,0 +1,68 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "strdrop_build" +description: Build reference json from sequencing coverage in STR VCFs +keywords: + - str + - vcf + - lrs +tools: + - "strdrop": + description: "Flag STR coverage drops in LRS data" + homepage: "https://github.com/dnil/strdrop" + documentation: "https://github.com/dnil/strdrop/blob/main/docs/README.md" + tool_dev_url: "https://github.com/dnil/strdrop" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - training_set: + type: file + description: Input VCF training set files + pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}" + ontologies: + - edam: "http://edamontology.org/format_3016" # VCF + - edam: "http://edamontology.org/format_3020" # BCF +output: + json: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.json": + type: file + description: Output reference json file + pattern: "*.json" + ontologies: + - edam: "http://edamontology.org/format_3464" # JSON + versions_strdrop: + - - ${task.process}: + type: string + description: The name of the process + - strdrop: + type: string + description: The name of the tool + - strdrop --version | sed 's/.* //g': + type: eval + description: The expression to obtain the version of the tool + +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - strdrop: + type: string + description: The name of the tool + - strdrop --version | sed 's/.* //g': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@fellen31" +maintainers: + - "@fellen31" diff --git a/modules/nf-core/strdrop/build/tests/main.nf.test b/modules/nf-core/strdrop/build/tests/main.nf.test new file mode 100644 index 000000000000..10d999ab9801 --- /dev/null +++ b/modules/nf-core/strdrop/build/tests/main.nf.test @@ -0,0 +1,101 @@ +nextflow_process { + + name "Test Process STRDROP_BUILD" + script "../main.nf" + process "STRDROP_BUILD" + + tag "modules" + tag "modules_nfcore" + tag "strdrop" + tag "strdrop/build" + tag "samtools/faidx" + tag "gunzip" + tag "trgt/genotype" + + setup { + run("GUNZIP"){ + script "../../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id : 'chr22' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr22_chr22_KI270734v1_random/sequence/genome.fa.gz', checkIfExists: true) + ] + """ + } + } + run("SAMTOOLS_FAIDX"){ + script "../../../samtools/faidx/main.nf" + process { + """ + input[0] = GUNZIP.out.gunzip + input[1] = [[],[]] + input[2] = false + """ + } + } + run("TRGT_GENOTYPE"){ + script "../../../trgt/genotype/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/test.sorted.bam.bai', checkIfExists: true), + 'XX' + ] + input[1] = GUNZIP.out.gunzip + input[2] = SAMTOOLS_FAIDX.out.fai + input[3] = Channel.of('chr22\t18890357\t18890451\tID=TEST;MOTIFS=AT;STRUC=(AT)n') + .collectFile(name : 'repeats.bed', newLine: false) + .map { file -> [ [ id : 'chr22' ], file ] } + """ + } + } + } + + test("test") { + when { + process { + """ + input[0] = TRGT_GENOTYPE.out.vcf + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + + test("test-stub") { + + options "-stub" + + when { + process { + """ + input[0] = TRGT_GENOTYPE.out.vcf + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } +} diff --git a/modules/nf-core/strdrop/build/tests/main.nf.test.snap b/modules/nf-core/strdrop/build/tests/main.nf.test.snap new file mode 100644 index 000000000000..b53395fc369e --- /dev/null +++ b/modules/nf-core/strdrop/build/tests/main.nf.test.snap @@ -0,0 +1,102 @@ +{ + "test": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.json:md5,e918b92effa7c7c4696f3ae80e51d0d5" + ] + ], + "1": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ], + "json": [ + [ + { + "id": "test" + }, + "test.json:md5,e918b92effa7c7c4696f3ae80e51d0d5" + ] + ], + "versions_strdrop": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ] + }, + { + "versions_strdrop": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-12-06T11:11:57.601817569" + }, + "test-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ], + "json": [ + [ + { + "id": "test" + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_strdrop": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ] + }, + { + "versions_strdrop": [ + [ + "STRDROP_BUILD", + "strdrop", + "0.3" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-12-06T11:12:03.26800462" + } +} \ No newline at end of file