diff --git a/modules/nf-core/shapeit5/ligate/environment.yml b/modules/nf-core/shapeit5/ligate/environment.yml index 7b8e63bba47..91b87fd02eb 100644 --- a/modules/nf-core/shapeit5/ligate/environment.yml +++ b/modules/nf-core/shapeit5/ligate/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/ligate/main.nf b/modules/nf-core/shapeit5/ligate/main.nf index 5624d7d9870..a45179493fd 100644 --- a/modules/nf-core/shapeit5/ligate/main.nf +++ b/modules/nf-core/shapeit5/ligate/main.nf @@ -4,11 +4,11 @@ process SHAPEIT5_LIGATE { 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(input_list), path (input_list_index) + tuple val(meta), path(input_list), path(input_list_index) output: tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: merged_variants @@ -37,11 +37,11 @@ process SHAPEIT5_LIGATE { """ stub: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def suffix = task.ext.suffix ?: "vcf.gz" + def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "vcf.gz" + def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch" """ - touch ${prefix}.${suffix} + ${create_cmd} ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/shapeit5/ligate/tests/main.nf.test b/modules/nf-core/shapeit5/ligate/tests/main.nf.test new file mode 100644 index 00000000000..4e3391c5631 --- /dev/null +++ b/modules/nf-core/shapeit5/ligate/tests/main.nf.test @@ -0,0 +1,99 @@ +nextflow_process { + + name "Test Process SHAPEIT5_LIGATE" + script "../main.nf" + process "SHAPEIT5_LIGATE" + + tag "modules" + tag "modules_nfcore" + tag "shapeit5" + tag "shapeit5/ligate" + tag "bcftools/view" + + test("homo sapiens - map, [vcf], [tbi]") { + config "./nextflow.config" + setup { + run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_1") { + script "../../../bcftools/view" + params { + bcftools_args = "--regions chr22:16570000-16600000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'" + } + process { + """ + input[0] = [ + [ id:'NA12878_1' ], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true), + ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_2") { + script "../../../bcftools/view" + params { + bcftools_args = "--regions chr22:16580000-16610000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'" + } + process { + """ + input[0] = [ + [ id:'NA12878_2' ], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true), + ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + } + + when { + process { + """ + input[0] = BCFTOOLS_VIEW_1.out.vcf.join(BCFTOOLS_VIEW_1.out.csi) + .mix(BCFTOOLS_VIEW_2.out.vcf.join(BCFTOOLS_VIEW_2.out.csi)) + .map { meta, vcf, csi -> [ [id : "NA12878"], vcf, csi ] } + .groupTuple() + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.merged_variants.collect {meta, vcf -> [ meta, path(vcf).vcf.summary ]}, + process.out.versions + ).match() } + ) + } + } + + test("homo sapiens - map, [vcf], [tbi] - stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [id: 'NA12878'], + [file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true)], + [file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true)] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/shapeit5/ligate/tests/main.nf.test.snap b/modules/nf-core/shapeit5/ligate/tests/main.nf.test.snap new file mode 100644 index 00000000000..3caae978dd6 --- /dev/null +++ b/modules/nf-core/shapeit5/ligate/tests/main.nf.test.snap @@ -0,0 +1,55 @@ +{ + "homo sapiens - map, [vcf], [tbi] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "NA12878" + }, + "NA12878.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b" + ], + "merged_variants": [ + [ + { + "id": "NA12878" + }, + "NA12878.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-11-22T17:22:34.235879155" + }, + "homo sapiens - map, [vcf], [tbi]": { + "content": [ + [ + [ + { + "id": "NA12878" + }, + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=60, phased=false, phasedAutodetect=false]" + ] + ], + [ + "versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-04T10:07:53.185018802" + } +} \ No newline at end of file diff --git a/modules/nf-core/shapeit5/ligate/tests/nextflow.config b/modules/nf-core/shapeit5/ligate/tests/nextflow.config new file mode 100644 index 00000000000..0dee91a2a0c --- /dev/null +++ b/modules/nf-core/shapeit5/ligate/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withName: "BCFTOOLS_VIEW_*" { + ext.args = params.bcftools_args + ext.prefix = { "${meta.id}" } + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 22dd0b609c7..ae64cc3bc35 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -507,9 +507,6 @@ sgdemux: - modules/nf-core/sgdemux/** - modules/nf-core/untar/** - tests/modules/nf-core/sgdemux/** -shapeit5/ligate: - - modules/nf-core/shapeit5/ligate/** - - tests/modules/nf-core/shapeit5/ligate/** shapeit5/phaserare: - modules/nf-core/shapeit5/phaserare/** - tests/modules/nf-core/shapeit5/phaserare/** diff --git a/tests/modules/nf-core/shapeit5/ligate/main.nf b/tests/modules/nf-core/shapeit5/ligate/main.nf deleted file mode 100644 index 1213f7bd3a8..00000000000 --- a/tests/modules/nf-core/shapeit5/ligate/main.nf +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env nextflow -nextflow.enable.dsl = 2 - -include { SHAPEIT5_LIGATE } from '../../../../../modules/nf-core/shapeit5/ligate/main.nf' -include { SHAPEIT5_PHASECOMMON } from '../../../../../modules/nf-core/shapeit5/phasecommon/main.nf' -include { BCFTOOLS_VIEW } from '../../../../../modules/nf-core/bcftools/view/main.nf' -include { BCFTOOLS_INDEX } from '../../../../../modules/nf-core/bcftools/index/main.nf' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX2 } from '../../../../../modules/nf-core/bcftools/index/main.nf' - -workflow test_shapeit5_ligate { - input_vcf = [ - [ id:'NA12878_1X', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), - ] - - ref_panel = Channel.of([ - [ id:'REF_1000GP', 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) - ]).collect() - - scaffold = Channel.of([[],[],[]]).collect() - map = Channel.of([[],[]]).collect() - - BCFTOOLS_VIEW ( input_vcf, [], [], [] ) - BCFTOOLS_INDEX ( BCFTOOLS_VIEW.out.vcf ) - - region = Channel.of("chr21:16600000-16750000", "chr21:16650000-16800000") - sample = Channel.of([[]]) - - phase_input = Channel.of([[ id:'NA12878_1X']]) - .combine(BCFTOOLS_VIEW.out.vcf.collect().map{it[1]}) - .combine(BCFTOOLS_INDEX.out.csi.collect().map{it[1]}) - .combine(sample) - .combine(region) - .map{ meta, vcf, csi, sample, region -> - [meta + [region: region.replace(":","_")], - vcf, csi, sample, region]} - - - SHAPEIT5_PHASECOMMON ( phase_input, ref_panel, scaffold, map ) - - phased_variant = SHAPEIT5_PHASECOMMON.output.phased_variant - .map{ meta, vcf -> [meta.subMap(["id"]), vcf]} - - BCFTOOLS_INDEX2 ( phased_variant ) - - ligate_input = phased_variant.groupTuple() - .join(BCFTOOLS_INDEX2.out.csi.groupTuple()) - .map { meta, vcf, csi -> - [meta, - vcf.sort{ a, b -> - a.getName() <=> b.getName()}, - csi]} - - SHAPEIT5_LIGATE ( ligate_input ) -} diff --git a/tests/modules/nf-core/shapeit5/ligate/nextflow.config b/tests/modules/nf-core/shapeit5/ligate/nextflow.config deleted file mode 100644 index f96da6737f4..00000000000 --- a/tests/modules/nf-core/shapeit5/ligate/nextflow.config +++ /dev/null @@ -1,17 +0,0 @@ -process { - withName: BCFTOOLS_VIEW { - ext.args = [ - "-Oz", - "-e 'GT=\"./.\"||GT=\".\"'" - ].join(' ') - ext.prefix = { "${meta.id}" } - } - withName: SHAPEIT5_PHASECOMMON { - ext.args = [ - ].join(' ') - ext.suffix = "bcf" - ext.prefix = { "${meta.id}_${meta.region}" } - } - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/shapeit5/ligate/test.yml b/tests/modules/nf-core/shapeit5/ligate/test.yml deleted file mode 100644 index d60fb8e47f0..00000000000 --- a/tests/modules/nf-core/shapeit5/ligate/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: shapeit5 ligate test_shapeit5_ligate - command: nextflow run ./tests/modules/nf-core/shapeit5/ligate -entry test_shapeit5_ligate -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/shapeit5/ligate/nextflow.config - tags: - - shapeit5 - - shapeit5/ligate - files: - - path: output/bcftools/NA12878_1X.vcf.gz - - path: output/bcftools/NA12878_1X.vcf.gz.csi - - path: output/bcftools/NA12878_1X_chr21_16600000-16750000.bcf.csi - - path: output/bcftools/NA12878_1X_chr21_16650000-16800000.bcf.csi - - path: output/bcftools/versions.yml - - path: output/shapeit5/NA12878_1X.vcf.gz - - path: output/shapeit5/NA12878_1X_chr21_16600000-16750000.bcf - - path: output/shapeit5/NA12878_1X_chr21_16650000-16800000.bcf - - path: output/shapeit5/versions.yml