Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nf-test for hapibd #6575

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions modules/nf-core/hapibd/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
}
2 changes: 1 addition & 1 deletion modules/nf-core/hapibd/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
99 changes: 99 additions & 0 deletions modules/nf-core/hapibd/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}
}

}
103 changes: 103 additions & 0 deletions modules/nf-core/hapibd/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
28 changes: 0 additions & 28 deletions tests/modules/nf-core/hapibd/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/hapibd/nextflow.config

This file was deleted.

21 changes: 0 additions & 21 deletions tests/modules/nf-core/hapibd/test.yml

This file was deleted.

Loading