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

MALT/BUILD: Start adding a2tax support #7409

Merged
merged 4 commits into from
Feb 5, 2025
Merged
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: 5 additions & 3 deletions modules/nf-core/malt/build/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ process MALT_BUILD {
path fastas, stageAs: 'fa_folder/'
path gff
path mapping_db
val map_type

output:
path "malt_index/", emit: index
Expand All @@ -21,16 +22,17 @@ process MALT_BUILD {
script:
def args = task.ext.args ?: ''
def igff = gff ? "-igff ${gff}" : ""

"""
INDEX=`find -L . -name '*.db' -o -name '*.abin' -type f`
echo \$INDEX
malt-build \\
${args} \\
-v \\
--input fa_folder \\
--input fa_folder/ \\
${igff} \\
-d 'malt_index/' \\
-t ${task.cpus} \\
-mdb ${mapping_db}/*.db |&tee malt-build.log
-${map_type} \$INDEX |&tee malt-build.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
8 changes: 6 additions & 2 deletions modules/nf-core/malt/build/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ input:
pattern: "*/|*.gff|*.gff3"
- - mapping_db:
type: file
description: MEGAN .db file from https://software-ab.cs.uni-tuebingen.de/download/megan6/welcome.html
pattern: "*.db"
description: An uncompressed MEGAN mapping file from https://software-ab.cs.uni-tuebingen.de/download/megan6/welcome.html (either mapping db, or acc2* .abin file)
pattern: "*.{db,abin}"
- - map_type:
type: string
description: The type of map file provided to the pipeline. Must be a valid string corresponding to a single-dash parameter, for example '-a2tax' or '-a2interpro2go'
pattern: "mdb|a2t|s2t|a2ec|s2ec|t4ec|a2eggnog|s2eggnog|t4eggnog|a2gtdb|s2gtdb|t4gtdb|a2interpro2go|s2interpro2go|t4interprotogo|a2kegg|s2kegg|t4kegg|a2pgpt|s2pgpt|t4pgpt|a2seed|s2seed|t4seed"
output:
- index:
- malt_index/:
Expand Down
71 changes: 64 additions & 7 deletions modules/nf-core/malt/build/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,74 @@ nextflow_process {
tag "malt/build"
tag "unzip"

setup {
run("UNZIP") {
script "../../../unzip/main.nf"
test("sarscov2 - fastq - mdb") {
config "./nextflow.config"

setup {
run("UNZIP", alias: "UNZIP_MDB") {
script "../../../unzip/main.nf"
process {
"""
input[0] = [[], file("https://ngi-igenomes.s3.eu-west-1.amazonaws.com/test-data/createtaxdb/taxonomy/megan-nucl-Feb2022.db.zip", checkIfExists: true)]
"""
}
}
}

when {
params {
module_args = '-J-Xmx6G --sequenceType DNA'
}
process {
"""
input[0] = [[], file("https://ngi-igenomes.s3.eu-west-1.amazonaws.com/test-data/createtaxdb/taxonomy/megan-nucl-Feb2022.db.zip", checkIfExists: true)]
def genome_1 = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/fasta/sarscov2.fasta', checkIfExists: true )
def genome_2 = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true )

input[0] = [genome_1,genome_2]
input[1] = []
input[2] = UNZIP_MDB.out.unzipped_archive.map { it[1] }
input[3] = 'mdb'
"""
}
}

then {

assertAll(
{ assert process.success },
{ assert snapshot(
path("${process.out.index[0]}/index0.idx"),
path("${process.out.index[0]}/ref.db"),
path("${process.out.index[0]}/ref.idx"),
path("${process.out.index[0]}/ref.inf"),
path("${process.out.index[0]}/taxonomy.idx"),
path("${process.out.index[0]}/taxonomy.map"),
path("${process.out.index[0]}/taxonomy.tre"),
process.out.versions
)
.match()
},
{ assert path(process.out.log[0]).readLines().last().contains("Peak memory") },
{ assert path("${process.out.index[0]}/table0.db").exists() },
{ assert path("${process.out.index[0]}/table0.idx").exists() },
)
}
}

test("sarscov2 - fastq") {
test("sarscov2 - fastq - abin") {
config "./nextflow.config"

setup {
run("UNZIP", alias: "UNZIP_ABIN") {
script "../../../unzip/main.nf"
process {
"""
input[0] = [[], file("https://software-ab.cs.uni-tuebingen.de/download/megan6/nucl_acc2tax-Jul2019.abin.zip", checkIfExists: true)]
"""
}
}
}

when {
params {
module_args = '-J-Xmx6G --sequenceType DNA'
Expand All @@ -34,7 +89,8 @@ nextflow_process {

input[0] = [genome_1,genome_2]
input[1] = []
input[2] = UNZIP.out.unzipped_archive.map { it[1] }
input[2] = UNZIP_ABIN.out.unzipped_archive.map { it[1] }
input[3] = 'a2t'
"""
}
}
Expand Down Expand Up @@ -74,7 +130,8 @@ nextflow_process {

input[0] = [genome_1,genome_2]
input[1] = []
input[2] = UNZIP.out.unzipped_archive.map { it[1] }
input[2] = []
input[3] = 'mdb'
"""
}
}
Expand Down
57 changes: 38 additions & 19 deletions modules/nf-core/malt/build/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
{
"sarscov2 - fastq - mdb": {
"content": [
"index0.idx:md5,0ba3d8bfb7ef28d08e2a005dd3405c55",
"ref.db:md5,6b36ae031c49feaae50f4cea07d9c7f4",
"ref.idx:md5,8ba66cdf65181c7efee1d366574cb9d7",
"ref.inf:md5,042712533a0187b6566db67c6503a71e",
"taxonomy.idx:md5,e7ce35e6238f39fa0c236fcf991546e4",
"taxonomy.map:md5,5bb3f2192e925bca2e61e4b54f1671e0",
"taxonomy.tre:md5,f76fb2d5aa9b0d637234d48175841e0e",
[
"versions.yml:md5,4ad582e415ed27dd4a275a149209961b"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-04T10:27:03.034359655"
},
"sarscov2 - fastq - abin": {
"content": [
"index0.idx:md5,0ba3d8bfb7ef28d08e2a005dd3405c55",
"ref.db:md5,6b0b40df6094a735fa2843e0ef916a02",
"ref.idx:md5,42b0bc56c1562594c7500f2f86a3ca71",
"ref.inf:md5,042712533a0187b6566db67c6503a71e",
"taxonomy.idx:md5,e7ce35e6238f39fa0c236fcf991546e4",
"taxonomy.map:md5,5bb3f2192e925bca2e61e4b54f1671e0",
"taxonomy.tre:md5,f76fb2d5aa9b0d637234d48175841e0e",
[
"versions.yml:md5,4ad582e415ed27dd4a275a149209961b"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-04T10:30:59.462853239"
},
"sarscov2 - fastq - stub": {
"content": [
{
Expand Down Expand Up @@ -31,24 +69,5 @@
"nextflow": "24.10.0"
},
"timestamp": "2024-11-15T12:14:24.942518"
},
"sarscov2 - fastq": {
"content": [
"index0.idx:md5,0ba3d8bfb7ef28d08e2a005dd3405c55",
"ref.db:md5,6b36ae031c49feaae50f4cea07d9c7f4",
"ref.idx:md5,8ba66cdf65181c7efee1d366574cb9d7",
"ref.inf:md5,042712533a0187b6566db67c6503a71e",
"taxonomy.idx:md5,e7ce35e6238f39fa0c236fcf991546e4",
"taxonomy.map:md5,5bb3f2192e925bca2e61e4b54f1671e0",
"taxonomy.tre:md5,f76fb2d5aa9b0d637234d48175841e0e",
[
"versions.yml:md5,4ad582e415ed27dd4a275a149209961b"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-15T12:13:59.078459"
}
}
4 changes: 4 additions & 0 deletions modules/nf-core/malt/build/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
process {
withName: UNZIP {
ext.prefix = 'mapping_file'
}

withName: MALT_BUILD {
ext.args = params.module_args
}
Expand Down
3 changes: 3 additions & 0 deletions modules/nf-core/malt/run/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nextflow_process {
setup {
run("UNZIP") {
script "../../../unzip/main.nf"
config './nextflow.config'
process {
"""
input[0] = [[], file("https://ngi-igenomes.s3.eu-west-1.amazonaws.com/test-data/createtaxdb/taxonomy/megan-nucl-Feb2022.db.zip", checkIfExists: true)]
Expand All @@ -23,11 +24,13 @@ nextflow_process {
}
run("MALT_BUILD") {
script "../../../malt/build/main.nf"
config './nextflow.config'
process {
"""
input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true)
input[1] = []
input[2] = UNZIP.out.unzipped_archive.map { it[1] }
input[3] = 'mdb'
"""
}
}
Expand Down
3 changes: 3 additions & 0 deletions modules/nf-core/malt/run/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
process {
withName: UNZIP {
ext.prefix = 'mapping_file'
}

withName: MALT_BUILD {
ext.args = { "-J-Xmx${task.memory.toGiga()}G --sequenceType DNA" }
Expand Down
Loading