Skip to content
Open
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
12 changes: 1 addition & 11 deletions modules/nf-core/ska/distance/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ process SKA_DISTANCE {
tuple val(meta), path("*clusters.tsv") , emit: cluster_list , optional: true
tuple val(meta), path("*cluster*.txt") , emit: cluster_files, optional: true
tuple val(meta), path("*.dot") , emit: dot , optional: true
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('ska'), eval("ska --version | grep Version | sed '1!d ; s/Version: //'"), emit: versions_ska, topic: versions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the following works ?
We aim to avoid grep as it is sometimes not available depending on the platform and container.

Suggested change
tuple val("${task.process}"), val('ska'), eval("ska --version | grep Version | sed '1!d ; s/Version: //'"), emit: versions_ska, topic: versions
tuple val("${task.process}"), val('ska'), eval("ska --version | sed -n 's/Version: //p'"), emit: versions_ska, topic: versions


when:
task.ext.when == null || task.ext.when
Expand All @@ -31,11 +31,6 @@ process SKA_DISTANCE {
$arg_list \\
-o ${prefix} \\
$sketch_files

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ska: \$(ska --version | grep Version |& sed '1!d ; s/Version: //')
END_VERSIONS
"""

stub:
Expand All @@ -53,10 +48,5 @@ process SKA_DISTANCE {
touch ${prefix}.cluster\${i}.txt
done
$output_dot

cat <<-END_VERSIONS > versions.yml
"${task.process}":
ska: \$(ska --version | grep Version |& sed '1!d ; s/Version: //')
END_VERSIONS
"""
}
33 changes: 24 additions & 9 deletions modules/nf-core/ska/distance/meta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "ska_distance"
description: Calculate pairwise distances and basic clustering from SKA sketches
keywords:
Expand All @@ -15,7 +14,8 @@ tools:
documentation: "https://github.com/simonrharris/SKA/wiki"
tool_dev_url: "https://github.com/simonrharris/SKA"
doi: "10.1101/453142"
licence: ["MIT"]
licence:
- "MIT"
identifier: ""

input:
Expand Down Expand Up @@ -47,7 +47,7 @@ output:
description: Pairwise distance table
pattern: "*distance.tsv"
ontologies:
- edam: "http://edamontology.org/format_3475"
- edam: "http://edamontology.org/format_3475" # TSV
cluster_list:
- - meta:
type: map
Expand Down Expand Up @@ -82,14 +82,29 @@ output:
description: DOT file for visualization
pattern: "*.dot"
ontologies: []
versions_ska:
- - ${task.process}:
type: string
description: The name of the process
- ska:
type: string
description: The name of the tool
- "ska --version | grep Version | sed '1!d ; s/Version: //'":
type: eval
description: The expression to obtain the version of the tool

topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
- - ${task.process}:
type: string
description: The name of the process
- ska:
type: string
description: The name of the tool
- "ska --version | grep Version | sed '1!d ; s/Version: //'":
type: eval
description: The expression to obtain the version of the tool

ontologies:
- edam: http://edamontology.org/format_3750 # YAML
authors:
- "@itrujnara"
maintainers:
Expand Down
10 changes: 6 additions & 4 deletions modules/nf-core/ska/distance/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.distances[0][1]).csv(sep:"\t").rows,
process.out.versions_ska,
path(process.out.distances[0][1]).csv(sep:"\t").rows.collect { row ->
row.collectEntries { k, v -> [(k): (v in ['nan', '-nan'] ? 'nan' : v)] }
},
path(process.out.cluster_list[0][1]).csv(sep:"\t").rows,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to check the content, or would a simple sanitizeOutput(process.out) be enough ?

process.out.dot
).match() }
Expand Down Expand Up @@ -102,9 +104,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
process.out.versions_ska,
path(process.out.distances[0][1]).csv(sep:"\t").columnNames.sort(),
path(process.out.distances[0][1]).csv(sep:"\t").rows[0].values().sort(),
path(process.out.distances[0][1]).csv(sep:"\t").rows[0].values().collect { v -> v in ['nan', '-nan'] ? 'nan' : v }.sort(),
path(process.out.cluster_list[0][1]).csv(sep:"\t").columnNames.sort(),
path(process.out.cluster_list[0][1]).csv(sep:"\t").columns["ID"].sort(),
path(process.out.cluster_list[0][1]).csv(sep:"\t").columns["Cluster__autocolour"].sort(),
Expand Down
64 changes: 40 additions & 24 deletions modules/nf-core/ska/distance/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,29 @@
"test.dot:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,914078627d4223f14da56bb9dd72a667"
"versions_ska": [
[
"SKA_DISTANCE",
"ska",
"1.0"
]
]
}
],
"timestamp": "2026-08-23T21:13:57.031634",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.3"
},
"timestamp": "2026-02-17T13:24:34.498999152"
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
},
"sarscov2 - plasmodium - skf": {
"content": [
[
"versions.yml:md5,914078627d4223f14da56bb9dd72a667"
[
"SKA_DISTANCE",
"ska",
"1.0"
]
],
[
{
Expand All @@ -61,7 +69,7 @@
"Matches": 0,
"Sample 2": "plasmodium_reduced",
"SNPs": 0,
"SNP distance": "-nan",
"SNP distance": "nan",
"Mash-like distance": 1
}
],
Expand All @@ -84,16 +92,20 @@
]
]
],
"timestamp": "2026-08-23T21:13:47.781661",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.3"
},
"timestamp": "2026-02-17T13:24:29.184171536"
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
},
"sarscov2 - plasmodium - list": {
"content": [
[
"versions.yml:md5,914078627d4223f14da56bb9dd72a667"
[
"SKA_DISTANCE",
"ska",
"1.0"
]
],
[
"Jaccard Index",
Expand All @@ -112,7 +124,7 @@
0,
1,
2740,
"-nan",
"nan",
"plasmodium_reduced"
],
[
Expand All @@ -136,11 +148,11 @@
]
]
],
"timestamp": "2026-08-23T21:14:09.175944",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.3"
},
"timestamp": "2026-02-17T14:36:59.237532349"
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
},
"sarscov2 - plasmodium - list - stub": {
"content": [
Expand Down Expand Up @@ -175,15 +187,19 @@
"dot": [

],
"versions": [
"versions.yml:md5,914078627d4223f14da56bb9dd72a667"
"versions_ska": [
[
"SKA_DISTANCE",
"ska",
"1.0"
]
]
}
],
"timestamp": "2026-08-23T21:14:20.454425",
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.3"
},
"timestamp": "2026-02-17T13:25:40.464938435"
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
}
}