Skip to content

Commit

Permalink
add nf-test and fix stub happy/sompy (#6285)
Browse files Browse the repository at this point in the history
* add nf-test and fix stub

* renew snapshot

* simpler match

---------

Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
kubranarci and SPPearce authored Aug 26, 2024
1 parent 88ae684 commit 5f5f9f7
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 106 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/happy/sompy/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ process HAPPY_SOMPY {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '0.3.14' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
touch ${prefix}.features.csv
Expand Down
28 changes: 26 additions & 2 deletions modules/nf-core/happy/sompy/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,39 @@ tools:
homepage: "https://www.illumina.com/products/by-type/informatics-products/basespace-sequence-hub/apps/hap-py-benchmarking.html"
documentation: "https://github.com/Illumina/hap.py/blob/master/doc/sompy.md"
tool_dev_url: "https://github.com/Illumina/hap.py"

licence: "['BSD-2-clause']"
licence: ["BSD-2-clause"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- meta2:
type: map
description: |
Groovy Map containing fasta file information
e.g. [ id:'test2']
- meta3:
type: map
description: |
Groovy Map containing fai file information
e.g. [ id:'test3']
- meta4:
type: map
description: |
Groovy Map containing false_positives_bed file information
e.g. [ id:'test4']
- meta5:
type: map
description: |
Groovy Map containing ambiguous_beds file information
e.g. [ id:'test5']
- meta6:
type: map
description: |
Groovy Map containing bam file information
e.g. [ id:'test6']
- query_vcf:
type: file
description: VCF/GVCF file to query
Expand Down
127 changes: 127 additions & 0 deletions modules/nf-core/happy/sompy/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
nextflow_process {

name "Test Process HAPPY_SOMPY"
script "../main.nf"
process "HAPPY_SOMPY"

tag "modules"
tag "modules_nfcore"
tag "happy"
tag "happy/sompy"

test("homo_sapiens - vcf") {
config './nextflow.config'
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true),
[]
]
input[1] = [
[ id:'test2' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[2] = [
[ id:'test3' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
]
input[3] = [[],[]]
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.stats,
process.out.versions,
file(process.out.metrics[0][1]).name,
file(process.out.features[0][1]).name).match()}
)
}

}
test("homo_sapiens - vcf - bam") {
config './nextflow.config'
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true),
[]
]
input[1] = [
[ id:'test2' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[2] = [
[ id:'test3' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
]
input[3] = [[],[]]
input[4] = [[],[]]
input[5] = [[ id:'test2' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam', checkIfExists: true)]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.stats,
process.out.versions,
file(process.out.metrics[0][1]).name,
file(process.out.features[0][1]).name).match()}
)
}

}
test("homo_sapiens - vcf - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true),
[]
]
input[1] = [
[ id:'test2' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
]
input[2] = [
[ id:'test3' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
]
input[3] = [[],[]]
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
111 changes: 111 additions & 0 deletions modules/nf-core/happy/sompy/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"homo_sapiens - vcf": {
"content": [
[
[
{
"id": "test"
},
"test.stats.csv:md5,8b35dd00bf7b5bd697a05d73fb8c0816"
]
],
[
"versions.yml:md5,dda929752e25faa5e5dc8e82228980fc"
],
"test.metrics.json",
"test.features.csv"
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-26T08:56:57.589412212"
},
"homo_sapiens - vcf - bam": {
"content": [
[
[
{
"id": "test"
},
"test.stats.csv:md5,5e9aae3e92641f1934c10fe88f250e59"
]
],
[
"versions.yml:md5,dda929752e25faa5e5dc8e82228980fc"
],
"test.metrics.json",
"test.features.csv"
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-26T08:57:13.752402851"
},
"homo_sapiens - vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.features.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"test.metrics.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test"
},
"test.stats.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
"versions.yml:md5,dda929752e25faa5e5dc8e82228980fc"
],
"features": [
[
{
"id": "test"
},
"test.features.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"metrics": [
[
{
"id": "test"
},
"test.metrics.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"stats": [
[
{
"id": "test"
},
"test.stats.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,dda929752e25faa5e5dc8e82228980fc"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-23T14:39:09.160343644"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/happy/sompy/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: HAPPY_SOMPY {
ext.args = '--feature-table hcc.mutect.snv'
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,6 @@ haplocheck:
haplogrep2/classify:
- modules/nf-core/haplogrep2/classify/**
- tests/modules/nf-core/haplogrep2/classify/**
happy/sompy:
- modules/nf-core/happy/sompy/**
- tests/modules/nf-core/happy/sompy/**
hicap:
- modules/nf-core/hicap/**
- tests/modules/nf-core/hicap/**
Expand Down
67 changes: 0 additions & 67 deletions tests/modules/nf-core/happy/sompy/main.nf

This file was deleted.

8 changes: 0 additions & 8 deletions tests/modules/nf-core/happy/sompy/nextflow.config

This file was deleted.

Loading

0 comments on commit 5f5f9f7

Please sign in to comment.