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/sylph/query/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=0.9.0
39 changes: 39 additions & 0 deletions modules/nf-core/sylph/query/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
process SYLPH_QUERY {
tag "${meta.id}"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
? 'https://depot.galaxyproject.org/singularity/sylph:0.9.0--ha6fb395_0'
: 'quay.io/biocontainers/sylph:0.9.0--ha6fb395_0'}"

input:
tuple val(meta), path(reads)
path database

output:
tuple val(meta), path('*.tsv'), emit: query_out
tuple val("${task.process}"), val('sylph'), eval('sylph -V | sed "s/sylph //g"'), topic: versions, emit: versions_sylph

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def input = meta.single_end ? "-r ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}"
"""
sylph query \\
-t ${task.cpus} \\
${args} \\
${database} \\
${input} \\
--output-file ${prefix}.tsv
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.tsv
"""
}
77 changes: 77 additions & 0 deletions modules/nf-core/sylph/query/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "sylph_query"
description: Sylph query command for querying genome databases against reads/metagenomes
keywords:
- query
- metagenomics
- sylph
- containment
- genome
tools:
- sylph:
description: Sylph quickly enables querying of genomes against even low-coverage
shotgun metagenomes to find nearest neighbour ANI.
homepage: https://github.com/bluenote-1577/sylph
documentation: https://sylph-docs.github.io/
tool_dev_url: https://github.com/bluenote-1577/sylph
doi: 10.1038/s41587-024-02412-y
licence:
- "MIT"
identifier: biotools:sylph

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- reads:
type: file
description: |
List of input FastQ/FASTA files of size 1 and 2 for single-end and paired-end data,
respectively. They are automatically sketched to .sylsp/.syldb
pattern: "*.{fasta,fastq,fna,fa,fq,fas}{,.gz}"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
- edam: http://edamontology.org/format_1930 # FASTQ
- database:
type: file
description: Pre-sketched *.syldb/*.sylsp files. Raw single-end fastq/fasta are
allowed and will be automatically sketched to .sylsp/.syldb.
pattern: "*.{syldb,sylsp}"
output:
query_out:
- - meta:
type: map
description: Groovy Map containing sample information
- "*.tsv":
type: file
description: Output TSV file of containment ANI query results.
pattern: "*.tsv"
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
versions_sylph:
- - ${task.process}:
type: string
description: The process the versions were collected from
- sylph:
type: string
description: The tool name
- sylph -V | sed "s/sylph //g":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The process the versions were collected from
- sylph:
type: string
description: The tool name
- sylph -V | sed "s/sylph //g":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@ZunairKhm"
- "@nghiaagent"
maintainers:
- "@nghiaagent"
87 changes: 87 additions & 0 deletions modules/nf-core/sylph/query/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
nextflow_process {

name "Test Process SYLPH_QUERY"
script "../main.nf"
process "SYLPH_QUERY"
tag "modules"
tag "modules_nfcore"
tag "sylph"
tag "sylph/query"

test("sarscov2 illumina single-end [fastq_gz]") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:true ],
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ]
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.findAll { key, val -> key.startsWith("versions") },
file(process.out.query_out[0][1]).readLines()[0]
).match() }
)
}
}

test("sarscov2 illumina paired-end [fastq_gz]") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ],
[
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)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.findAll { key, val -> key.startsWith("versions") },
file(process.out.query_out[0][1]).readLines()[0]
).match() }
)
}
}

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

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ],
[
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)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
83 changes: 83 additions & 0 deletions modules/nf-core/sylph/query/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"sarscov2 illumina paired-end [fastq_gz]": {
"content": [
{
"versions_sylph": [
[
"SYLPH_QUERY",
"sylph",
"0.9.0"
]
]
},
"Sample_file\tGenome_file\tAdjusted_ANI\tEff_cov\tANI_5-95_percentile\tEff_lambda\tLambda_5-95_percentile\tMedian_cov\tMean_cov_geq1\tContainment_ind\tNaive_ANI\tContig_name"
],
"timestamp": "2026-07-22T17:40:58.29668",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.4"
}
},
"sarscov2 illumina single-end [fastq_gz]": {
"content": [
{
"versions_sylph": [
[
"SYLPH_QUERY",
"sylph",
"0.9.0"
]
]
},
"Sample_file\tGenome_file\tAdjusted_ANI\tEff_cov\tANI_5-95_percentile\tEff_lambda\tLambda_5-95_percentile\tMedian_cov\tMean_cov_geq1\tContainment_ind\tNaive_ANI\tContig_name"
],
"timestamp": "2026-07-22T17:40:51.150032",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.4"
}
},
"sarscov2 illumina paired-end [fastq_gz]-stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
"SYLPH_QUERY",
"sylph",
"0.9.0"
]
],
"query_out": [
[
{
"id": "test",
"single_end": false
},
"test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_sylph": [
[
"SYLPH_QUERY",
"sylph",
"0.9.0"
]
]
}
],
"timestamp": "2026-07-22T17:41:07.524879",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.4"
}
}
}