diff --git a/modules/nf-core/hapibd/environment.yml b/modules/nf-core/hapibd/environment.yml index 2902e831e19..4c2f52d3d38 100644 --- a/modules/nf-core/hapibd/environment.yml +++ b/modules/nf-core/hapibd/environment.yml @@ -2,6 +2,5 @@ name: hapibd channels: - conda-forge - bioconda - - defaults dependencies: - bioconda::hap-ibd=1.0.rev20May22.818 diff --git a/modules/nf-core/hapibd/main.nf b/modules/nf-core/hapibd/main.nf index cd920ca29a1..92c355b65e7 100644 --- a/modules/nf-core/hapibd/main.nf +++ b/modules/nf-core/hapibd/main.nf @@ -47,4 +47,25 @@ process HAPIBD { hapibd: \$(hap-ibd 2>&1 |head -n1 | sed 's/^hap-ibd.jar \\[ version //; s/, /rev/; s/ \\]//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + + def avail_mem = 3072 + if (!task.memory) { + log.info '[hapibd] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' + } else { + avail_mem = (task.memory.mega*0.8).intValue() + } + + """ + touch ${prefix}.log + echo | gzip > ${prefix}.hbd.gz + echo | gzip > ${prefix}.ibd.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hapibd: \$(hap-ibd 2>&1 |head -n1 | sed 's/^hap-ibd.jar \\[ version //; s/, /rev/; s/ \\]//') + END_VERSIONS + """ } diff --git a/modules/nf-core/hapibd/meta.yml b/modules/nf-core/hapibd/meta.yml index 686ae88bf22..8def0c8d662 100644 --- a/modules/nf-core/hapibd/meta.yml +++ b/modules/nf-core/hapibd/meta.yml @@ -10,7 +10,7 @@ tools: homepage: "https://github.com/browning-lab/hap-ibd/blob/master/README.md" documentation: "https://github.com/browning-lab/hap-ibd/blob/master/README.md" doi: "10.1016/j.ajhg.2020.02.010" - licence: "['Apache-2.0']" + licence: ["Apache-2.0"] input: - meta: type: map diff --git a/modules/nf-core/hapibd/tests/main.nf.test b/modules/nf-core/hapibd/tests/main.nf.test new file mode 100644 index 00000000000..85d14460690 --- /dev/null +++ b/modules/nf-core/hapibd/tests/main.nf.test @@ -0,0 +1,99 @@ + +nextflow_process { + + name "Test Process HAPIBD" + script "../main.nf" + process "HAPIBD" + + tag "modules" + tag "modules_nfcore" + tag "hapibd" + + test("test-hapibd") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.truth.vcf.gz", checkIfExists: true) + ] + input[1] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.map", checkIfExists: true) + input[2] = [] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert file(process.out.log[0][1]).text.contains('End Time') }, + { assert snapshot( + file(process.out.hbd[0][1]).name, // empty + file(process.out.ibd[0][1]).name, // unstable + file(process.out.log[0][1]).name, + process.out.versions + ).match() + } + ) + } + } + + test("test-hapibd-excludesamples") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.truth.vcf.gz", checkIfExists: true) + ] + input[1] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.map", checkIfExists: true) + input[2] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/excludeSamples.txt", checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert file(process.out.log[0][1]).text.contains('End Time') }, + { assert snapshot( + file(process.out.hbd[0][1]).name, // empty + file(process.out.ibd[0][1]).name, // unstable + file(process.out.log[0][1]).name, + process.out.versions + ).match() + } + ) + } + } + + test("test-hapibd-excludesamples-stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.truth.vcf.gz", checkIfExists: true) + ] + input[1] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.map", checkIfExists: true) + input[2] = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/excludeSamples.txt", checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/hapibd/tests/main.nf.test.snap b/modules/nf-core/hapibd/tests/main.nf.test.snap new file mode 100644 index 00000000000..b5a5951f27f --- /dev/null +++ b/modules/nf-core/hapibd/tests/main.nf.test.snap @@ -0,0 +1,103 @@ +{ + "test-hapibd": { + "content": [ + "test.hbd.gz", + "test.ibd.gz", + "test.log", + [ + "versions.yml:md5,27c1ec7c19884a358c01031f02604c2a" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:50:07.8312" + }, + "test-hapibd-excludesamples": { + "content": [ + "test.hbd.gz", + "test.ibd.gz", + "test.log", + [ + "versions.yml:md5,27c1ec7c19884a358c01031f02604c2a" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:50:29.730739" + }, + "test-hapibd-excludesamples-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hbd.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ibd.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,27c1ec7c19884a358c01031f02604c2a" + ], + "hbd": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hbd.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "ibd": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ibd.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,27c1ec7c19884a358c01031f02604c2a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:40:49.71258" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 6cec5cab408..7000cbeab6e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -326,9 +326,6 @@ gunc/mergecheckm: gunc/run: - modules/nf-core/gunc/run/** - tests/modules/nf-core/gunc/run/** -hapibd: - - modules/nf-core/hapibd/** - - tests/modules/nf-core/hapibd/** hicexplorer/hicpca: - modules/nf-core/hicexplorer/hicpca/** - tests/modules/nf-core/hicexplorer/hicpca/** diff --git a/tests/modules/nf-core/hapibd/main.nf b/tests/modules/nf-core/hapibd/main.nf deleted file mode 100644 index 3a7a0deb4da..00000000000 --- a/tests/modules/nf-core/hapibd/main.nf +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { HAPIBD } from '../../../../modules/nf-core/hapibd/main.nf' - -workflow test_hapibd { - - input = [ - [ id:'test', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.truth.vcf.gz", checkIfExists: true) - ] - map = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.map", checkIfExists: true) - - HAPIBD ( input, map, [] ) -} - -workflow test_hapibd_excludesamples { - - input = [ - [ id:'test', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.truth.vcf.gz", checkIfExists: true) - ] - map = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/target.map", checkIfExists: true) - exclude = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hapibd/excludeSamples.txt", checkIfExists: true) - - HAPIBD ( input, map, exclude ) -} diff --git a/tests/modules/nf-core/hapibd/nextflow.config b/tests/modules/nf-core/hapibd/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/hapibd/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/hapibd/test.yml b/tests/modules/nf-core/hapibd/test.yml deleted file mode 100644 index 12f5192db22..00000000000 --- a/tests/modules/nf-core/hapibd/test.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: hapibd test_hapibd - command: nextflow run ./tests/modules/nf-core/hapibd -entry test_hapibd -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/hapibd/nextflow.config - tags: - - hapibd - files: - - path: output/hapibd/test.hbd.gz # this is an empty file for this test example - - path: output/hapibd/test.ibd.gz - contains: ["I3019"] - - path: output/hapibd/test.log - contains: ["hap-ibd.jar"] - -- name: hapibd test_hapibd_excludesamples - command: nextflow run ./tests/modules/nf-core/hapibd -entry test_hapibd_excludesamples -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/hapibd/nextflow.config - tags: - - hapibd - files: - - path: output/hapibd/test.hbd.gz # this is an empty file for this test example - - path: output/hapibd/test.ibd.gz - contains: ["I3019"] - - path: output/hapibd/test.log - contains: ["hap-ibd.jar"]