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

Merged
merged 10 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 2 additions & 4 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 Down
89 changes: 89 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,89 @@
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"

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.test_data['sarscov2']['illumina']['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.test_data['sarscov2']['illumina']['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,
famosab marked this conversation as resolved.
Show resolved Hide resolved
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 {
process {
"""
input[0] = MMSEQS_CREATEDB_QUERY.out.db,
famosab marked this conversation as resolved.
Show resolved Hide resolved
input[1] = MMSEQS_CREATEDB_TARGET.out.db
"""
}
}

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

}

}
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 = module_prefix
famosab marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -350,9 +350,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
Loading