diff --git a/modules/nf-core/shapeit5/switch/environment.yml b/modules/nf-core/shapeit5/switch/environment.yml index 7b8e63bba47..91b87fd02eb 100644 --- a/modules/nf-core/shapeit5/switch/environment.yml +++ b/modules/nf-core/shapeit5/switch/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::shapeit5=1.0.0 + - bioconda::shapeit5=5.1.1 diff --git a/modules/nf-core/shapeit5/switch/main.nf b/modules/nf-core/shapeit5/switch/main.nf index 92e881252f2..a34fed1c805 100644 --- a/modules/nf-core/shapeit5/switch/main.nf +++ b/modules/nf-core/shapeit5/switch/main.nf @@ -4,8 +4,8 @@ process SHAPEIT5_SWITCH { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/shapeit5:1.0.0--h0c8ee15_0': - 'biocontainers/shapeit5:1.0.0--h0c8ee15_0'}" + 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0': + 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" input: tuple val(meta) , path(estimate), path(estimate_index), val(region), path(pedigree) @@ -43,18 +43,18 @@ process SHAPEIT5_SWITCH { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def create_cmd = "echo '' | gzip >" """ - touch ${prefix}.block.switch.txt.gz - touch ${prefix}.calibration.switch.txt.gz - touch ${prefix}.flipsAndSwitches.txt.gz - touch ${prefix}.frequency.switch.txt.gz - touch ${prefix}.sample.switch.txt.gz - touch ${prefix}.sample.typing.txt.gz - touch ${prefix}.type.switch.txt.gz - touch ${prefix}.variant.switch.txt.gz - touch ${prefix}.variant.typing.txt.gz + ${create_cmd} ${prefix}.block.switch.txt.gz + ${create_cmd} ${prefix}.calibration.switch.txt.gz + ${create_cmd} ${prefix}.flipsAndSwitches.txt.gz + ${create_cmd} ${prefix}.frequency.switch.txt.gz + ${create_cmd} ${prefix}.sample.switch.txt.gz + ${create_cmd} ${prefix}.sample.typing.txt.gz + ${create_cmd} ${prefix}.type.switch.txt.gz + ${create_cmd} ${prefix}.variant.switch.txt.gz + ${create_cmd} ${prefix}.variant.typing.txt.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/shapeit5/switch/tests/main.nf.test b/modules/nf-core/shapeit5/switch/tests/main.nf.test new file mode 100644 index 00000000000..8ebad3eaa90 --- /dev/null +++ b/modules/nf-core/shapeit5/switch/tests/main.nf.test @@ -0,0 +1,105 @@ +nextflow_process { + + name "Test Process SHAPEIT5_SWITCH" + script "../main.nf" + process "SHAPEIT5_SWITCH" + + tag "modules" + tag "modules_nfcore" + tag "shapeit5" + tag "shapeit5/switch" + tag "shapeit5/phasecommon" + tag "bcftools/index" + + test("homo sapiens - vcf, scaffold, []") { + config "./nextflow.config" + setup { + run("SHAPEIT5_PHASECOMMON") { + script "../../../shapeit5/phasecommon" + params { + shapeit5_phasecommon_args = "--filter-maf 0.001" + } + process { + """ + input[0] = Channel.of([ + [ id:'scaffold', single_end:false ], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists: true), + [], + "chr22", + ]) + input[1] = Channel.of([[],[],[]]) + input[2] = Channel.of([[],[],[]]) + input[3] = Channel.of([[],[]]) + """ + } + } + run("BCFTOOLS_INDEX") { + script "../../../bcftools/index" + process { + """ + input[0] = SHAPEIT5_PHASECOMMON.out.phased_variant + """ + } + } + } + + when { + process { + """ + input[0] = SHAPEIT5_PHASECOMMON.out.phased_variant + .join(BCFTOOLS_INDEX.out.csi) + .combine(Channel.of("chr22")) + .combine(Channel.of([[]])) + input[1] = Channel.of([[ id:'truth_panel'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz",checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi",checkIfExists:true) + ]) + input[2] = Channel.of([[ id:'freq_file'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.sites.vcf.gz",checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.sites.vcf.gz.csi",checkIfExists:true) + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.errors.collect { meta, txt -> [ meta, txt.collect{ file(it).name } ] }, + process.out.versions + ).match() } + ) + } + + } + + test("homo sapiens - vcf, scaffold, [] - stub") { + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id:'truth_panel'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz",checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi",checkIfExists:true), + "chr21", + [] + ]) + input[1] = [[], [], []] + input[2] = [[], [], []] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/shapeit5/switch/tests/main.nf.test.snap b/modules/nf-core/shapeit5/switch/tests/main.nf.test.snap new file mode 100644 index 00000000000..a568047c355 --- /dev/null +++ b/modules/nf-core/shapeit5/switch/tests/main.nf.test.snap @@ -0,0 +1,86 @@ +{ + "homo sapiens - vcf, scaffold, [] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "truth_panel" + }, + [ + "truth_panel.block.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.calibration.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.flipsAndSwitches.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.frequency.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.sample.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.sample.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.type.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.variant.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.variant.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + "versions.yml:md5,95238962a141557f464b8e22c8057211" + ], + "errors": [ + [ + { + "id": "truth_panel" + }, + [ + "truth_panel.block.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.calibration.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.flipsAndSwitches.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.frequency.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.sample.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.sample.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.type.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.variant.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "truth_panel.variant.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "versions": [ + "versions.yml:md5,95238962a141557f464b8e22c8057211" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-11-22T19:04:42.303883153" + }, + "homo sapiens - vcf, scaffold, []": { + "content": [ + [ + [ + { + "id": "scaffold", + "single_end": false + }, + [ + "scaffold.block.switch.txt.gz", + "scaffold.calibration.switch.txt.gz", + "scaffold.flipsAndSwitches.txt.gz", + "scaffold.frequency.switch.txt.gz", + "scaffold.sample.switch.txt.gz", + "scaffold.sample.typing.txt.gz", + "scaffold.type.switch.txt.gz", + "scaffold.variant.switch.txt.gz", + "scaffold.variant.typing.txt.gz" + ] + ] + ], + [ + "versions.yml:md5,95238962a141557f464b8e22c8057211" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-11-22T19:13:32.038870261" + } +} \ No newline at end of file diff --git a/modules/nf-core/shapeit5/switch/tests/nextflow.config b/modules/nf-core/shapeit5/switch/tests/nextflow.config new file mode 100644 index 00000000000..5f84c07d3bd --- /dev/null +++ b/modules/nf-core/shapeit5/switch/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: SHAPEIT5_PHASECOMMON { + ext.args = params.shapeit5_phasecommon_args + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index ae64cc3bc35..fc5757e089c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -510,9 +510,6 @@ sgdemux: shapeit5/phaserare: - modules/nf-core/shapeit5/phaserare/** - tests/modules/nf-core/shapeit5/phaserare/** -shapeit5/switch: - - modules/nf-core/shapeit5/switch/** - - tests/modules/nf-core/shapeit5/switch/** shigeifinder: - modules/nf-core/shigeifinder/** - tests/modules/nf-core/shigeifinder/** diff --git a/tests/modules/nf-core/shapeit5/switch/main.nf b/tests/modules/nf-core/shapeit5/switch/main.nf deleted file mode 100644 index 525c789f2a1..00000000000 --- a/tests/modules/nf-core/shapeit5/switch/main.nf +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SHAPEIT5_PHASECOMMON } from '../../../../../modules/nf-core/shapeit5/phasecommon/main.nf' -include { SHAPEIT5_SWITCH } from '../../../../../modules/nf-core/shapeit5/switch/main.nf' -include { BCFTOOLS_INDEX } from '../../../../../modules/nf-core/bcftools/index/main.nf' - -workflow test_shapeit5_switch { - input_vcf = Channel.of([ - [ id:'input', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), - [], - "chr21" - ]) - - ref_panel = Channel.of([[],[],[]]) - scaffold = Channel.of([[],[],[]]) - map = Channel.of([[ id:'map'], - [file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)]]) - - SHAPEIT5_PHASECOMMON ( input_vcf, ref_panel, scaffold, map) - - allele_freq = Channel.of([[ id:'freq_file'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true)]) - - truth = Channel.of([[ id:'truth_panel'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi",checkIfExists:true)]) - - BCFTOOLS_INDEX ( SHAPEIT5_PHASECOMMON.output.phased_variant ) - - concordance_input=SHAPEIT5_PHASECOMMON.output.phased_variant.groupTuple() - .join(BCFTOOLS_INDEX.out.csi.groupTuple()) - .combine(Channel.of("chr21")) - .combine(Channel.of([[]])) - - SHAPEIT5_SWITCH ( concordance_input, truth, allele_freq) // meta, Region, Frequencies, Truth, Estimate, minPROB, minDP, bins -} diff --git a/tests/modules/nf-core/shapeit5/switch/nextflow.config b/tests/modules/nf-core/shapeit5/switch/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/shapeit5/switch/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/shapeit5/switch/test.yml b/tests/modules/nf-core/shapeit5/switch/test.yml deleted file mode 100644 index 25314edeb46..00000000000 --- a/tests/modules/nf-core/shapeit5/switch/test.yml +++ /dev/null @@ -1,22 +0,0 @@ -- name: shapeit5 switch test_shapeit5_switch - command: nextflow run ./tests/modules/nf-core/shapeit5/switch -entry test_shapeit5_switch -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/shapeit5/switch/nextflow.config - tags: - - shapeit5/switch - - shapeit5 - files: - - path: output/bcftools/input.vcf.gz.csi - - path: output/bcftools/versions.yml - - path: output/shapeit5/input.block.switch.txt.gz - - path: output/shapeit5/input.calibration.switch.txt.gz - md5sum: e1aee9059a0824cedc8111f39d13107c - - path: output/shapeit5/input.flipsAndSwitches.txt.gz - - path: output/shapeit5/input.frequency.switch.txt.gz - - path: output/shapeit5/input.sample.switch.txt.gz - - path: output/shapeit5/input.sample.typing.txt.gz - md5sum: dfc1d46178e018991c71e13d5fa16dcd - - path: output/shapeit5/input.type.switch.txt.gz - - path: output/shapeit5/input.variant.switch.txt.gz - - path: output/shapeit5/input.variant.typing.txt.gz - md5sum: 2d224ffc41ae40263b7c2d3b35fe5eeb - - path: output/shapeit5/input.vcf.gz - - path: output/shapeit5/versions.yml