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
12 changes: 1 addition & 11 deletions modules/nf-core/picard/collecthsmetrics/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ process PICARD_COLLECTHSMETRICS {

output:
tuple val(meta), path("*_metrics") , emit: metrics
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('picard'), eval("picard CollectHsMetrics --version 2>&1 | sed -n 's/^Version:*//p'"), topic: versions, emit: versions_picard

when:
task.ext.when == null || task.ext.when
Expand Down Expand Up @@ -63,21 +63,11 @@ process PICARD_COLLECTHSMETRICS {
--INPUT $bam \\
--OUTPUT ${prefix}.CollectHsMetrics.coverage_metrics


cat <<-END_VERSIONS > versions.yml
"${task.process}":
picard: \$(echo \$(picard CollectHsMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.CollectHsMetrics.coverage_metrics

cat <<-END_VERSIONS > versions.yml
"${task.process}":
picard: \$(echo \$(picard CollectHsMetrics --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""
}
27 changes: 21 additions & 6 deletions modules/nf-core/picard/collecthsmetrics/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,28 @@ output:
description: Alignment metrics files generated by picard
pattern: "*_{metrics}"
ontologies: []
versions_picard:
- - ${task.process}:
type: string
description: The process the versions were collected from
- picard:
type: string
description: The tool name
- "picard CollectHsMetrics --version 2>&1 | sed -n 's/^Version:*//p'":
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
- picard:
type: string
description: The tool name
- "picard CollectHsMetrics --version 2>&1 | sed -n 's/^Version:*//p'":
type: string
description: The command used to generate the version of the tool
authors:
- "@projectoriented"
- "@matthdsm"
Expand Down
12 changes: 6 additions & 6 deletions modules/nf-core/picard/collecthsmetrics/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nextflow_process {
file(process.out.metrics[0][1]).name,
size,
lines,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match()
}
)
Expand Down Expand Up @@ -77,7 +77,7 @@ nextflow_process {
file(process.out.metrics[0][1]).name,
size,
lines,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match()
}
)
Expand Down Expand Up @@ -110,7 +110,7 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions") }
{ assert snapshot(process.out).match() }
)
}

Expand Down Expand Up @@ -146,7 +146,7 @@ nextflow_process {
file(process.out.metrics[0][1]).name,
size,
lines,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match()
}
)
Expand Down Expand Up @@ -185,7 +185,7 @@ nextflow_process {
file(process.out.metrics[0][1]).name,
size,
lines,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match()
}
)
Expand Down Expand Up @@ -224,7 +224,7 @@ nextflow_process {
file(process.out.metrics[0][1]).name,
size,
lines,
process.out.versions
process.out.findAll { key, val -> key.startsWith("versions") }
).match()
}
)
Expand Down
145 changes: 103 additions & 42 deletions modules/nf-core/picard/collecthsmetrics/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,64 @@
"88\t0\t0",
"89\t0\t0"
],
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
{
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2026-01-05T17:03:29.566021877"
},
"sarscov2 - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.CollectHsMetrics.coverage_metrics:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
],
"metrics": [
[
{
"id": "test",
"single_end": false
},
"test.CollectHsMetrics.coverage_metrics:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:37:59.62099935"
"timestamp": "2026-01-05T17:03:13.333276975"
},
"sarscov2 - bam - gzippedfa": {
"content": [
Expand Down Expand Up @@ -221,27 +270,21 @@
"88\t0\t0",
"89\t0\t0"
],
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
},
"timestamp": "2025-09-15T10:37:32.831030701"
},
"versions": {
"content": [
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
{
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:37:42.492104283"
"timestamp": "2026-01-05T17:03:04.382110367"
},
"sarscov2 - bam - samebed": {
"content": [
Expand Down Expand Up @@ -349,15 +392,21 @@
"88\t0\t0",
"89\t0\t0"
],
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
{
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:38:39.302597954"
"timestamp": "2026-01-05T17:13:22.872920293"
},
"sarscov2 - bam": {
"content": [
Expand Down Expand Up @@ -465,15 +514,21 @@
"88\t0\t0",
"89\t0\t0"
],
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
{
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:37:15.861292725"
"timestamp": "2026-01-05T17:02:47.615784738"
},
"sarscov2 - bam - bed": {
"content": [
Expand Down Expand Up @@ -581,14 +636,20 @@
"88\t0\t0",
"89\t0\t0"
],
[
"versions.yml:md5,533cf1e35d36fdacbb762f5df2e1b322"
]
{
"versions_picard": [
[
"PICARD_COLLECTHSMETRICS",
"picard",
"3.4.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:38:18.912909604"
"timestamp": "2026-01-05T17:13:02.812282052"
}
}
19 changes: 10 additions & 9 deletions subworkflows/nf-core/bam_qc_picard/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@ workflow BAM_QC_PICARD {
ch_fasta_gzi // channel: [ val(meta), fasta_gzi ]

main:
ch_versions = Channel.empty()
ch_coverage_metrics = Channel.empty()
ch_versions = channel.empty()
ch_coverage_metrics = channel.empty()

ch_bam_bai = ch_bam_bai_bait_target.map{meta, bam, bai, bait, target -> return [meta,bam,bai]}
ch_bam_bai = ch_bam_bai_bait_target.map{meta, bam, bai, _bait, _target -> return [meta,bam,bai]}

PICARD_COLLECTMULTIPLEMETRICS( ch_bam_bai, ch_fasta, ch_fasta_fai )
ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions.first())
ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions)

ch_bam_bai_bait_target_branched = ch_bam_bai_bait_target.branch {
hsmetrics : it.size == 5 && it[3] != [] && it[4] != []
return it
meta, bam, bai, bait, target ->
hsmetrics : bait != [] && target != []
return [ meta, bam, bai, bait, target ]
wgsmetrics : true
return [ it[0], it[1], it[2] ]
return [ meta, bam, bai ]
}

PICARD_COLLECTHSMETRICS( ch_bam_bai_bait_target_branched.hsmetrics, ch_fasta, ch_fasta_fai, ch_fasta_dict, ch_fasta_gzi )
ch_coverage_metrics = ch_coverage_metrics.mix(PICARD_COLLECTHSMETRICS.out.metrics)
ch_versions = ch_versions.mix(PICARD_COLLECTHSMETRICS.out.versions.first())
// PICARD_COLLECTHSMETRICS emits version as a topic channel

PICARD_COLLECTWGSMETRICS( ch_bam_bai_bait_target_branched.wgsmetrics, ch_fasta, ch_fasta_fai, [] )
ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS.out.versions.first())
ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS.out.versions)
ch_coverage_metrics = ch_coverage_metrics.mix(PICARD_COLLECTWGSMETRICS.out.metrics)

emit:
Expand Down
9 changes: 4 additions & 5 deletions subworkflows/nf-core/bam_qc_picard/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@
"## htsjdk.samtools.metrics.StringHeader"
],
[
"versions.yml:md5,3b2235bbbda6df95419f3806503827d0",
"versions.yml:md5,720ecdeea54685db81f179f2f4e8e4ca"
"versions.yml:md5,3b2235bbbda6df95419f3806503827d0"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.7"
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-09-15T10:39:19.027288405"
"timestamp": "2026-01-06T12:22:35.756653797"
},
"sascov2_wgs - [bam,bai]": {
"content": [
Expand Down
Loading