Skip to content
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
7 changes: 7 additions & 0 deletions modules/nf-core/sylphtax/merge/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::sylph-tax=1.2.0"
51 changes: 51 additions & 0 deletions modules/nf-core/sylphtax/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

process SYLPHTAX_MERGE {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/sylph-tax:1.2.0--pyhdfd78af_0':
'biocontainers/sylph-tax:1.2.0--pyhdfd78af_0' }"


input:
tuple val(meta), path(sylphtax_reports)
val data_type

output:
tuple val(meta), path("*.tsv"), emit: tsv
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
export SYLPH_TAXONOMY_CONFIG="/tmp/config.json"
sylph-tax \\
merge \\
${sylphtax_reports} \\
--column $data_type \\
--output ${prefix}.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph-tax: \$(sylph-tax --version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
export SYLPH_TAXONOMY_CONFIG="/tmp/config.json"
touch ${prefix}.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph-tax: \$(sylph-tax --version)
END_VERSIONS
"""
}
46 changes: 46 additions & 0 deletions modules/nf-core/sylphtax/merge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "sylphtax_merge"
description: Merge multiple taxonomic profiles from sylphtaxt/taxprof into a tsv table
keywords:
- sylph
- metagenomics
- merge
tools:
- sylphtax:
description: Integrating taxonomic information into the sylph metagenome profiler.
homepage: https://github.com/bluenote-1577/sylph-tax?tab=readme-ov-file
documentation: https://sylph-docs.github.io/sylph-tax/
licence: ["MIT"]
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- sylphtax_reports:
type: file
description: Output taxonomic profile from sylph-tax taxprof command.
pattern: "*.{sylphmpa}"
- - data_type:
type: string
description: Can be ANI, relative abundance, or sequence abundance.
output:
- tsv:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.tsv":
type: file
description: Output profile with the merged taxonomic profiles in tsv format.
pattern: "*.tsv"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@sofstam"
maintainers:
- "@sofstam"
116 changes: 116 additions & 0 deletions modules/nf-core/sylphtax/merge/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "sylph"
tag "sylph/profile"
tag "sylphtax"
tag "sylphtax/taxprof"
tag "sylphtax/merge"


test("sarscov2 illumina single-end [fastq_gz]") {
setup {
run("SYLPH_PROFILE") {
script "../../../sylph/profile/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ]
]
input[1] = file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
"""
}
}
run("SYLPHTAX_TAXPROF")
{
script "../../../sylphtax/taxprof/main.nf"
process {
"""
input[0] = SYLPH_PROFILE.out.profile_out
input[1] = file('https://github.com/nf-core/test-datasets/raw/taxprofiler/data/database/sylph/test_taxonomy.tsv.gz', checkIfExists: true)
"""
}
}

}
when {

process {
"""
input[0] = SYLPHTAX_TAXPROF.out.taxprof_output
input[1] = "relative_abundance"
"""
}
}

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

}

test("sarscov2 illumina single-end [fastq_gz]-stub") {

options '-stub'

setup {
run("SYLPH_PROFILE") {
script "../../../sylph/profile/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ]
]
input[1] = file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
"""
}
}
run("SYLPHTAX_TAXPROF")
{
script "../../../sylphtax/taxprof/main.nf"
process {
"""
input[0] = SYLPH_PROFILE.out.profile_out
input[1] = file('https://github.com/nf-core/test-datasets/raw/taxprofiler/data/database/sylph/test_taxonomy.tsv.gz', checkIfExists: true)
"""
}
}

}
when {

process {
"""
input[0] = SYLPHTAX_TAXPROF.out.taxprof_output
input[1] = "relative_abundance"
"""
}
}

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

}
}
44 changes: 44 additions & 0 deletions modules/nf-core/sylphtax/merge/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"sarscov2 illumina single-end [fastq_gz]": {
"content": [
[
"versions.yml:md5,fb665700c08de369d03e29c02394da07"
],
[
[
{
"id": "test",
"single_end": false
},
"test.tsv:md5,0babfd085a52f127c5d352fab5595b39"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-04-07T15:29:34.708536546"
},
"sarscov2 illumina single-end [fastq_gz]-stub": {
"content": [
[
"versions.yml:md5,fb665700c08de369d03e29c02394da07"
],
[
[
{
"id": "test",
"single_end": false
},
"test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-04-07T15:29:46.390759044"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/sylphtax/taxprof/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::sylph-tax=1.1.2"
- "bioconda::sylph-tax=1.2.0"
12 changes: 7 additions & 5 deletions modules/nf-core/sylphtax/taxprof/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ process SYLPHTAX_TAXPROF {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/sylph-tax:1.1.2--pyhdfd78af_0':
'biocontainers/sylph-tax:1.1.2--pyhdfd78af_0' }"
'https://depot.galaxyproject.org/singularity/sylph-tax:1.2.0--pyhdfd78af_0':
'biocontainers/sylph-tax:1.2.0--pyhdfd78af_0' }"

input:
tuple val(meta), path(sylph_results)
Expand All @@ -24,28 +24,30 @@ process SYLPHTAX_TAXPROF {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
export SYLPH_TAXONOMY_CONFIG="/tmp/config.json"
sylph-tax \\
taxprof \\
$sylph_results \\
$args \\
-t $taxonomy

mv *.sylphmpa ${prefix}.sylphmpa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph-tax: \$(sylph-tax --version 2>&1 | sed -n 's/.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*/\\1/p' | head -n 1)
sylph-tax: \$(sylph-tax --version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
export SYLPH_TAXONOMY_CONFIG="/tmp/config.json"
touch ${prefix}.sylphmpa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph-tax: \$(sylph-tax --version 2>&1 | sed -n 's/.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*/\\1/p' | head -n 1)
sylph-tax: \$(sylph-tax --version)
END_VERSIONS
"""
}
10 changes: 5 additions & 5 deletions modules/nf-core/sylphtax/taxprof/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"stub sarscov2 illumina single-end [fastq_gz]": {
"content": [
[
"versions.yml:md5,976fae8d146f4f3087e2a090703f09b9"
"versions.yml:md5,bdbbd22b3e721ba2027d3e6cb1dc4bb4"
],
[
[
Expand All @@ -17,27 +17,27 @@
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-06T09:50:24.907781877"
"timestamp": "2025-04-07T15:28:04.026470884"
},
"sarscov2 illumina single-end [fastq_gz]": {
"content": [
[
"versions.yml:md5,976fae8d146f4f3087e2a090703f09b9"
"versions.yml:md5,bdbbd22b3e721ba2027d3e6cb1dc4bb4"
],
[
[
{
"id": "test",
"single_end": true
},
"test.sylphmpa:md5,797e3463eeb9a2e8f91de9b842cd421d"
"test.sylphmpa:md5,a9743c21a53ba766226e57d2a25f6167"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-06T09:50:17.295239617"
"timestamp": "2025-04-07T15:27:55.45776116"
}
}
Loading