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

Add sylph sketch #7078

Merged
merged 31 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
87fb871
Add sylph sketch
sofstam Nov 25, 2024
f674d15
Merge branch 'master' into sylph_sketch
sofstam Nov 25, 2024
1781b16
Update snap
sofstam Nov 25, 2024
d0e2b98
Update snap
sofstam Nov 25, 2024
1355c28
Remove sylph profile
sofstam Nov 25, 2024
4197399
Merge branch 'sylph_sketch' of https://github.com/sofstam/modules int…
sofstam Nov 25, 2024
f45ce76
Fix linting with version
sofstam Nov 25, 2024
a01eea2
Fix output format in meta.yama
sofstam Nov 25, 2024
a4a0b60
Fix input formatting
sofstam Nov 25, 2024
11b4142
Update meta
sofstam Nov 25, 2024
1f3e6cd
Fix input formatting
sofstam Nov 25, 2024
06e5c80
Fix output formatting
sofstam Nov 25, 2024
5d587b0
Add versions to output
sofstam Nov 25, 2024
08fc547
Merge branch 'master' into sylph_sketch
sofstam Nov 25, 2024
c4beeda
Update snap
sofstam Nov 25, 2024
9ebacb2
Update test
sofstam Nov 27, 2024
8893d9d
Fix lintinG
sofstam Nov 27, 2024
cd0254e
Test linting
sofstam Nov 27, 2024
97fb2fc
Linting
sofstam Nov 27, 2024
a619b41
Correct output names
sofstam Nov 27, 2024
6e5a493
Add quotes to output names
sofstam Nov 27, 2024
bfa02c6
Linting
sofstam Nov 27, 2024
ab7b21a
Merge branch 'master' into sylph_sketch
sofstam Nov 27, 2024
f5f211a
Fix align in input
sofstam Nov 27, 2024
35fd9a4
Merge branch 'master' into sylph_sketch
sofstam Nov 27, 2024
b00ff49
Update modules/nf-core/sylph/sketch/tests/main.nf.test
sofstam Nov 27, 2024
aa6a767
Merge branch 'master' into sylph_sketch
sofstam Nov 27, 2024
0a975be
Update snapshot
sofstam Nov 27, 2024
da043c7
Merge branch 'master' into sylph_sketch
sofstam Nov 28, 2024
6b3a4a2
Add stub test
sofstam Nov 28, 2024
bec8bd7
Merge branch 'master' into sylph_sketch
sofstam Nov 28, 2024
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
5 changes: 5 additions & 0 deletions modules/nf-core/sylph/sketch/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::sylph=0.7.0"
51 changes: 51 additions & 0 deletions modules/nf-core/sylph/sketch/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process SYLPH_SKETCH {
tag "$meta.id"
label 'process_high'

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

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

output:
tuple val(meta), path('my_sketches/*.sylsp'), path('database.syldb'), emit: sketch_fastq_genome
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}"
def fastq = meta.single_end ? "-r ${reads[0]}" : "-1 ${reads[0]} -2 ${reads[1]}"
"""
sylph sketch \\
$args \\
$fastq \\
-g $reference \\
-S $prefix \\
-d my_sketches

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph: \$(sylph -V|awk '{print \$2}')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir -p my_sketches
touch my_sketches/${prefix}.sylsp
touch database.syldb

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sylph: \$(sylph -V|awk '{print \$2}')
END_VERSIONS
"""
}
60 changes: 60 additions & 0 deletions modules/nf-core/sylph/sketch/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "sylph_sketch"
description: Sketching/indexing sequencing reads
keywords:
- sketch
- metagenomics
- sylph
- indexing
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://github.com/bluenote-1577/sylph
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: Input fastq files
pattern: "*.{fq,fastq,fq.gz,fastq.gz}"
- - reference:
type: file
description: Reference genome file in FASTA format
output:
- sketch_fastq_genome:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "my_sketches/*.sylsp"
- my_sketches/*.sylsp:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "my_sketches/*.sylsp"
- database.syldb:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
pattern: "my_sketches/*.sylsp"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@jiahang1234"
- "@sofstam"
maintainers:
- "@sofstam"
50 changes: 50 additions & 0 deletions modules/nf-core/sylph/sketch/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
nextflow_process {

script "../main.nf"
process "SYLPH_SKETCH"
tag "modules"
tag "modules_nfcore"
tag "sylph"
tag "sylph/sketch"

test("SYLPH_SKETCH: Should run without failures with single-end data") {
when {
process {
"""
input[0] = [ [ id:'test', single_end:true ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
]
input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
"""
}
}

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

test("SYLPH_SKETCH: Should run without failures with paired-end data") {
when {
process {
"""
input[0] = [ [ id:'test', single_end:false ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
76 changes: 76 additions & 0 deletions modules/nf-core/sylph/sketch/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"SYLPH_SKETCH: Should run without failures with single-end data": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true
},
"test.sylsp:md5,4f9ba8a3613e74e0fd4213330abae522",
"database.syldb:md5,c60e5450276385d81557a3f2b224762f"
]
],
"1": [
"versions.yml:md5,f78c271e0133ef3d93db094bdab7cf3c"
],
"sketch_fastq_genome": [
[
{
"id": "test",
"single_end": true
},
"test.sylsp:md5,4f9ba8a3613e74e0fd4213330abae522",
"database.syldb:md5,c60e5450276385d81557a3f2b224762f"
]
],
"versions": [
"versions.yml:md5,f78c271e0133ef3d93db094bdab7cf3c"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-27T11:14:52.331315"
},
"SYLPH_SKETCH: Should run without failures with paired-end data": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.paired.sylsp:md5,8ac5d34be025f7491c13ab6407e946fd",
"database.syldb:md5,c60e5450276385d81557a3f2b224762f"
]
],
"1": [
"versions.yml:md5,f78c271e0133ef3d93db094bdab7cf3c"
],
"sketch_fastq_genome": [
[
{
"id": "test",
"single_end": false
},
"test.paired.sylsp:md5,8ac5d34be025f7491c13ab6407e946fd",
"database.syldb:md5,c60e5450276385d81557a3f2b224762f"
]
],
"versions": [
"versions.yml:md5,f78c271e0133ef3d93db094bdab7cf3c"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-27T11:15:00.053288"
}
}
Loading