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

try porting mmseqs/search to nf-test #7231

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions modules/nf-core/mmseqs/search/main.nf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

process MMSEQS_SEARCH {
tag "$meta.id"
label 'process_high'
Expand All @@ -13,7 +12,7 @@ process MMSEQS_SEARCH {
tuple val(meta2), path(db_target)

output:
tuple val(meta), path("${prefix}"), emit: db_search
tuple val(meta), path("${prefix}/"), emit: db_search
path "versions.yml" , emit: versions

when:
Expand Down Expand Up @@ -51,8 +50,7 @@ process MMSEQS_SEARCH {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}"
if ("$db_query" == "${prefix}" || "$db_target" == "${prefix}" ) error "Input and output names of databases are the same, set prefix in module configuration to disambiguate!"
"""
mkdir -p $prefix
Expand All @@ -62,7 +60,7 @@ process MMSEQS_SEARCH {

cat <<-END_VERSIONS > versions.yml
"${task.process}":
mmseqs: \$(mmseqs | grep 'Version' | sed 's/MMseqs2 Version: /')
mmseqs: \$(mmseqs | grep 'Version' | sed 's/MMseqs2 Version: //')
END_VERSIONS
"""
}
95 changes: 95 additions & 0 deletions modules/nf-core/mmseqs/search/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "mmseqs"
tag "mmseqs/search"
tag "mmseqs/createdb"

config "./nextflow.config"

setup {
run("MMSEQS_CREATEDB", alias: "MMSEQS_CREATEDB_QUERY") {
script "../../../mmseqs/createdb/main.nf"
process {
"""
input[0] = [ [ id:'test_query', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true)
]
"""
}
}

run("MMSEQS_CREATEDB", alias: "MMSEQS_CREATEDB_TARGET") {
script "../../../mmseqs/createdb/main.nf"
process {
"""
input[0] = [ [ id:'test_target', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true)
]
"""
}
}
}

test("sarscov2 - test-search") {

when {
params {
module_args = '--remove-tmp-files 1 --search-type 2'
module_prefix = 'test_output_search'
}
process {
"""
input[0] = MMSEQS_CREATEDB_QUERY.out.db
input[1] = MMSEQS_CREATEDB_TARGET.out.db
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
path(process.out.versions[0]).yaml
).match() }
)
}

}

test("sarscov2 - test-search - stub") {

options "-stub"

when {
params {
module_args = '--remove-tmp-files 1 --search-type 2'
module_prefix = 'test_output_search'
}
process {
"""
input[0] = MMSEQS_CREATEDB_QUERY.out.db
input[1] = MMSEQS_CREATEDB_TARGET.out.db
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
path(process.out.versions[0]).yaml
).match() }
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/mmseqs/search/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"sarscov2 - test-search - stub": {
"content": [
{
"0": [
[
{
"id": "test_query",
"single_end": true
},
[
"test_output_search.0:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.1:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.2:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.3:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.4:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.5:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.6:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.7:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.8:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.9:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.dbtype:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.index:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,186c905c6a33d4175414a55ffb169711"
],
"db_search": [
[
{
"id": "test_query",
"single_end": true
},
[
"test_output_search.0:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.1:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.2:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.3:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.4:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.5:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.6:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.7:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.8:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.9:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.dbtype:md5,d41d8cd98f00b204e9800998ecf8427e",
"test_output_search.index:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,186c905c6a33d4175414a55ffb169711"
]
},
{
"MMSEQS_SEARCH": {
"mmseqs": 1.47E+285
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-19T13:58:05.087961"
}
}
8 changes: 8 additions & 0 deletions modules/nf-core/mmseqs/search/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
process {

withName: MMSEQS_SEARCH {
ext.prefix = params.module_prefix
ext.args = params.module_args
}

}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,6 @@ mitohifi/mitohifi:
mmseqs/easysearch:
- modules/nf-core/mmseqs/easysearch/**
- tests/modules/nf-core/mmseqs/easysearch/**
mmseqs/search:
- modules/nf-core/mmseqs/search/**
- tests/modules/nf-core/mmseqs/search/**
mmseqs/tsv2exprofiledb:
- modules/nf-core/mmseqs/tsv2exprofiledb/**
- tests/modules/nf-core/mmseqs/tsv2exprofiledb/**
Expand Down
23 changes: 0 additions & 23 deletions tests/modules/nf-core/mmseqs/search/main.nf

This file was deleted.

17 changes: 0 additions & 17 deletions tests/modules/nf-core/mmseqs/search/nextflow.config

This file was deleted.

11 changes: 0 additions & 11 deletions tests/modules/nf-core/mmseqs/search/test.yml

This file was deleted.

Loading