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/samtools/index/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process SAMTOOLS_INDEX {
tuple val(meta), path("*.bai") , optional:true, emit: bai
tuple val(meta), path("*.csi") , optional:true, emit: csi
tuple val(meta), path("*.crai"), optional:true, emit: crai
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('samtools'), eval("samtools version | sed '1!d;s/.* //'"), topic: versions, emit: versions_samtools

when:
task.ext.when == null || task.ext.when
Expand All @@ -27,11 +27,6 @@ process SAMTOOLS_INDEX {
-@ ${task.cpus} \\
$args \\
$input

cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""

stub:
Expand All @@ -40,10 +35,5 @@ process SAMTOOLS_INDEX {
"crai" : args.contains("-c") ? "csi" : "bai"
"""
touch ${input}.${extension}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}
28 changes: 22 additions & 6 deletions modules/nf-core/samtools/index/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,29 @@ output:
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}"
ontologies: []
versions_samtools:
- - ${task.process}:
type: string
description: The process the versions were collected from
- samtools:
type: string
description: The tool name
- "samtools version | sed '1!d;s/.* //'":
type: string
description: The command used to generate the version of the tool

topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The process the versions were collected from
- samtools:
type: string
description: The tool name
- "samtools version | sed '1!d;s/.* //'":
type: string
description: The command used to generate the version of the tool

authors:
- "@drpatelh"
- "@ewels"
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/samtools/index/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ nextflow_process {
{ assert process.success },
{ assert snapshot(
file(process.out.csi[0][1]).name,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match() }
)
}
Expand Down
118 changes: 82 additions & 36 deletions modules/nf-core/samtools/index/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@

],
"3": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
],
"bai": [

Expand All @@ -35,16 +39,20 @@
"test.paired_end.sorted.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:38.25787"
"timestamp": "2025-12-31T15:25:32.706640639"
},
"crai - stub": {
"content": [
Expand All @@ -65,7 +73,11 @@
]
],
"3": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
],
"bai": [

Expand All @@ -82,16 +94,20 @@
"csi": [

],
"versions": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:34.496412"
"timestamp": "2025-12-31T15:25:24.477945713"
},
"bai - stub": {
"content": [
Expand All @@ -112,7 +128,11 @@

],
"3": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
],
"bai": [
[
Expand All @@ -129,29 +149,39 @@
"csi": [

],
"versions": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:25.934431"
"timestamp": "2025-12-31T15:25:16.221396835"
},
"csi": {
"content": [
"test.paired_end.sorted.bam.csi",
[
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
]
{
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:22.262088"
"timestamp": "2025-12-31T15:25:08.621945161"
},
"crai": {
"content": [
Expand All @@ -172,7 +202,11 @@
]
],
"3": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
],
"bai": [

Expand All @@ -189,16 +223,20 @@
"csi": [

],
"versions": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:18.191664"
"timestamp": "2025-12-31T15:25:01.071934898"
},
"bai": {
"content": [
Expand All @@ -219,7 +257,11 @@

],
"3": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
],
"bai": [
[
Expand All @@ -236,15 +278,19 @@
"csi": [

],
"versions": [
"versions.yml:md5,b8717818c91b07de87c2a5590bad02e6"
"versions_samtools": [
[
"SAMTOOLS_INDEX",
"samtools",
"1.22.1"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.6"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-10T14:13:08.51539"
"timestamp": "2025-12-31T15:24:52.105615274"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workflow BAM_DEDUP_STATS_SAMTOOLS_UMICOLLAPSE {

main:

ch_versions = Channel.empty()
ch_versions = channel.empty()

//
// umicollapse in bam mode (thus hardcode mode input channel to 'bam')
Expand All @@ -24,7 +24,7 @@ workflow BAM_DEDUP_STATS_SAMTOOLS_UMICOLLAPSE {
// Index BAM file and run samtools stats, flagstat and idxstats
//
SAMTOOLS_INDEX ( UMICOLLAPSE.out.bam )
ch_versions = ch_versions.mix(SAMTOOLS_INDEX.out.versions.first())
// SAMTOOLS_INDEX emits version as a topic channel
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// SAMTOOLS_INDEX emits version as a topic channel

I usually just delete the whole line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I've been doing this, to make it clearer while we still have mixed subworkflows.


ch_bam_bai_dedup = UMICOLLAPSE.out.bam
.join(SAMTOOLS_INDEX.out.bai, by: [0], remainder: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
[
"versions.yml:md5,15a99b83c8965f9b29d0e9e6dbdef621",
"versions.yml:md5,61bd927f2f2121e34d94692a62305955",
"versions.yml:md5,657bce03545b4c57f9c5fc4314bf85f7",
"versions.yml:md5,71d8ff70a0f65311659c446278f10b1a"
"versions.yml:md5,657bce03545b4c57f9c5fc4314bf85f7"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
"nextflow": "25.10.2"
},
"timestamp": "2025-11-01T02:35:06.350407"
"timestamp": "2025-12-31T15:30:53.374645362"
},
"test_bam_dedup_stats_samtools_umicollapse_flagstats": {
"content": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ workflow BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS {
// Index BAM file and run samtools stats, flagstat and idxstats
//
SAMTOOLS_INDEX ( UMITOOLS_DEDUP.out.bam )
ch_versions = ch_versions.mix(SAMTOOLS_INDEX.out.versions.first())
// SAMTOOLS_INDEX emits version as a topic channel

ch_bam_bai_dedup = UMITOOLS_DEDUP.out.bam
.join(SAMTOOLS_INDEX.out.bai, by: [0], remainder: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
[
"versions.yml:md5,0ebfc47a75bd075329a7434161100f8f",
"versions.yml:md5,a8989d3d3bf9dde36a1d0664e54fccb5",
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45",
"versions.yml:md5,e687e4e909255370121fcbec5a4299d1"
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
"nextflow": "25.10.2"
},
"timestamp": "2025-11-01T02:35:42.524116"
"timestamp": "2025-12-31T15:28:36.488926399"
},
"sarscov2_bam_bai - stub": {
"content": [
Expand Down Expand Up @@ -96,8 +95,7 @@
"7": [
"versions.yml:md5,0ebfc47a75bd075329a7434161100f8f",
"versions.yml:md5,a8989d3d3bf9dde36a1d0664e54fccb5",
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45",
"versions.yml:md5,e687e4e909255370121fcbec5a4299d1"
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45"
],
"bai": [
[
Expand Down Expand Up @@ -153,15 +151,14 @@
"versions": [
"versions.yml:md5,0ebfc47a75bd075329a7434161100f8f",
"versions.yml:md5,a8989d3d3bf9dde36a1d0664e54fccb5",
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45",
"versions.yml:md5,e687e4e909255370121fcbec5a4299d1"
"versions.yml:md5,c4d5d9b171cc7b206cb14f7043f16e45"
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
"nextflow": "25.10.2"
},
"timestamp": "2025-11-01T02:35:58.59434"
"timestamp": "2025-12-31T15:28:52.020714406"
}
}
Loading
Loading