Skip to content

Commit 1a23c0b

Browse files
randombenjSPPearce
andauthored
Add fasta to picard/collectalignmentsummarymetrics (#8392)
* Update bioconda version * Add ability to use a reference genome * Add meta map for fasta input * Update modules/nf-core/picard/collectalignmentsummarymetrics/meta.yml --------- Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
1 parent 0a42e8f commit 1a23c0b

File tree

5 files changed

+77
-18
lines changed

5 files changed

+77
-18
lines changed

modules/nf-core/picard/collectalignmentsummarymetrics/environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ channels:
44
- conda-forge
55
- bioconda
66
dependencies:
7-
- "bioconda::picard=3.3.0"
7+
- bioconda::picard=3.4.0

modules/nf-core/picard/collectalignmentsummarymetrics/main.nf

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ process PICARD_COLLECTALIGNMENTSUMMARYMETRICS {
88
'biocontainers/picard:3.3.0--hdfd78af_0' }"
99

1010
input:
11-
tuple val(meta), path(bam)
11+
tuple val(meta), path(bam)
12+
tuple val(meta2), path(fasta)
1213

1314
output:
1415
tuple val(meta), path("*.txt"), emit: metrics
@@ -20,6 +21,7 @@ process PICARD_COLLECTALIGNMENTSUMMARYMETRICS {
2021
script:
2122
def args = task.ext.args ?: ''
2223
def prefix = task.ext.prefix ?: "${meta.id}"
24+
def reference = fasta ? "--REFERENCE_SEQUENCE ${fasta}" : ""
2325

2426
def avail_mem = 3072
2527
if (!task.memory) {
@@ -33,6 +35,7 @@ process PICARD_COLLECTALIGNMENTSUMMARYMETRICS {
3335
CollectAlignmentSummaryMetrics \\
3436
--INPUT $bam \\
3537
--OUTPUT ${prefix}.txt \\
38+
${reference} \\
3639
$args
3740
3841
cat <<-END_VERSIONS > versions.yml

modules/nf-core/picard/collectalignmentsummarymetrics/meta.yml

+9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ input:
2323
type: file
2424
description: BAM/CRAM/SAM file
2525
pattern: "*.{bam,cram,sam}"
26+
- - meta2:
27+
type: map
28+
description: |
29+
Groovy Map containing sample information
30+
e.g. [ id:'test', single_end:false ]
31+
- fasta:
32+
type: file
33+
description: Fasta file
34+
pattern: "*.{fasta}"
2635
output:
2736
- metrics:
2837
- meta:

modules/nf-core/picard/collectalignmentsummarymetrics/tests/main.nf.test

+41-12
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,39 @@ nextflow_process {
1515
process {
1616
"""
1717
input[0] = [
18-
[ id:'test', single_end:false ], // meta map
19-
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
20-
]
18+
[ id:'test', single_end:false ], // meta map
19+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
20+
]
21+
input[1] = [[], []]
22+
"""
23+
}
24+
}
2125

26+
then {
27+
assertAll(
28+
{ assert process.success },
29+
{ assert snapshot(
30+
file(process.out.metrics[0][1]).readLines()[5..8],
31+
process.out.versions
32+
).match()
33+
}
34+
)
35+
}
36+
}
37+
38+
test("test-picard-collectalignmentsummarymetrics - with reference") {
39+
40+
when {
41+
process {
42+
"""
43+
input[0] = [
44+
[ id:'test', single_end:false ], // meta map
45+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
46+
]
47+
input[1] = [
48+
[ id:'test', single_end:false ], // meta map
49+
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
50+
]
2251
"""
2352
}
2453
}
@@ -27,10 +56,10 @@ nextflow_process {
2756
assertAll(
2857
{ assert process.success },
2958
{ assert snapshot(
30-
file(process.out.metrics[0][1]).readLines()[5..8],
31-
process.out.versions
32-
).match()
33-
}
59+
file(process.out.metrics[0][1]).readLines()[5..8],
60+
process.out.versions
61+
).match()
62+
}
3463
)
3564
}
3665
}
@@ -41,10 +70,10 @@ nextflow_process {
4170
process {
4271
"""
4372
input[0] = [
44-
[ id:'test', single_end:false ], // meta map
45-
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
46-
]
47-
73+
[ id:'test', single_end:false ], // meta map
74+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
75+
]
76+
input[1] = [[], []]
4877
"""
4978
}
5079
}
@@ -57,4 +86,4 @@ nextflow_process {
5786
}
5887
}
5988

60-
}
89+
}

modules/nf-core/picard/collectalignmentsummarymetrics/tests/main.nf.test.snap

+22-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,27 @@
1313
],
1414
"meta": {
1515
"nf-test": "0.9.2",
16-
"nextflow": "24.10.5"
16+
"nextflow": "24.10.6"
1717
},
18-
"timestamp": "2025-04-13T14:35:05.248694"
18+
"timestamp": "2025-05-05T15:13:47.554135117"
19+
},
20+
"test-picard-collectalignmentsummarymetrics - with reference": {
21+
"content": [
22+
[
23+
"## METRICS CLASS\tpicard.analysis.AlignmentSummaryMetrics",
24+
"CATEGORY\tTOTAL_READS\tPF_READS\tPCT_PF_READS\tPF_NOISE_READS\tPF_READS_ALIGNED\tPCT_PF_READS_ALIGNED\tPF_ALIGNED_BASES\tPF_HQ_ALIGNED_READS\tPF_HQ_ALIGNED_BASES\tPF_HQ_ALIGNED_Q20_BASES\tPF_HQ_MEDIAN_MISMATCHES\tPF_MISMATCH_RATE\tPF_HQ_ERROR_RATE\tPF_INDEL_RATE\tMEAN_READ_LENGTH\tSD_READ_LENGTH\tMEDIAN_READ_LENGTH\tMAD_READ_LENGTH\tMIN_READ_LENGTH\tMAX_READ_LENGTH\tMEAN_ALIGNED_READ_LENGTH\tREADS_ALIGNED_IN_PAIRS\tPCT_READS_ALIGNED_IN_PAIRS\tPF_READS_IMPROPER_PAIRS\tPCT_PF_READS_IMPROPER_PAIRS\tBAD_CYCLES\tSTRAND_BALANCE\tPCT_CHIMERAS\tPCT_ADAPTER\tPCT_SOFTCLIP\tPCT_HARDCLIP\tAVG_POS_3PRIME_SOFTCLIP_LENGTH\tSAMPLE\tLIBRARY\tREAD_GROUP",
25+
"FIRST_OF_PAIR\t100\t100\t1\t0\t100\t1\t13884\t99\t13735\t12777\t0\t0.004249\t0.004296\t0.000432\t138.97\t22.059357\t150\t1\t72\t151\t138.84\t97\t0.97\t4\t0.04\t0\t0.48\t0\t0\t0.000935\t0\t6.5\t\t\t",
26+
"SECOND_OF_PAIR\t100\t100\t1\t0\t97\t0.97\t13517\t97\t13517\t12630\t0\t0.002885\t0.002885\t0.000296\t137.48\t23.672633\t150\t1\t53\t151\t135.17\t97\t1\t1\t0.010309\t0\t0.515464\t0\t0\t0.000655\t0\t0\t\t\t"
27+
],
28+
[
29+
"versions.yml:md5,6861b381e5b887f0d331e45166feeb04"
30+
]
31+
],
32+
"meta": {
33+
"nf-test": "0.9.2",
34+
"nextflow": "24.10.6"
35+
},
36+
"timestamp": "2025-05-05T15:13:56.775995067"
1937
},
2038
"test-picard-collectalignmentsummarymetrics-stub": {
2139
"content": [
@@ -48,8 +66,8 @@
4866
],
4967
"meta": {
5068
"nf-test": "0.9.2",
51-
"nextflow": "24.10.5"
69+
"nextflow": "24.10.6"
5270
},
53-
"timestamp": "2025-04-13T14:31:59.598201"
71+
"timestamp": "2025-05-05T15:15:16.790101044"
5472
}
5573
}

0 commit comments

Comments
 (0)