Skip to content

Add fasta to picard/collectalignmentsummarymetrics #8392

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

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::picard=3.3.0"
- bioconda::picard=3.4.0
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ process PICARD_COLLECTALIGNMENTSUMMARYMETRICS {
'biocontainers/picard:3.3.0--hdfd78af_0' }"

input:
tuple val(meta), path(bam)
tuple val(meta), path(bam)
tuple val(meta2), path(fasta)

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

def avail_mem = 3072
if (!task.memory) {
Expand All @@ -33,6 +35,7 @@ process PICARD_COLLECTALIGNMENTSUMMARYMETRICS {
CollectAlignmentSummaryMetrics \\
--INPUT $bam \\
--OUTPUT ${prefix}.txt \\
${reference} \\
$args

cat <<-END_VERSIONS > versions.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ input:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: Fasta file
pattern: "*.{fasta}"
output:
- metrics:
- meta:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,39 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
input[1] = [[], []]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.metrics[0][1]).readLines()[5..8],
process.out.versions
).match()
}
)
}
}

test("test-picard-collectalignmentsummarymetrics - with reference") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
input[1] = [
[ id:'test', single_end:false ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
]
"""
}
}
Expand All @@ -27,10 +56,10 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.metrics[0][1]).readLines()[5..8],
process.out.versions
).match()
}
file(process.out.metrics[0][1]).readLines()[5..8],
process.out.versions
).match()
}
)
}
}
Expand All @@ -41,10 +70,10 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]

[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true)
]
input[1] = [[], []]
"""
}
}
Expand All @@ -57,4 +86,4 @@ nextflow_process {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,27 @@
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
"nextflow": "24.10.6"
},
"timestamp": "2025-04-13T14:35:05.248694"
"timestamp": "2025-05-05T15:13:47.554135117"
},
"test-picard-collectalignmentsummarymetrics - with reference": {
"content": [
[
"## METRICS CLASS\tpicard.analysis.AlignmentSummaryMetrics",
"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",
"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",
"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"
],
[
"versions.yml:md5,6861b381e5b887f0d331e45166feeb04"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.6"
},
"timestamp": "2025-05-05T15:13:56.775995067"
},
"test-picard-collectalignmentsummarymetrics-stub": {
"content": [
Expand Down Expand Up @@ -48,8 +66,8 @@
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
"nextflow": "24.10.6"
},
"timestamp": "2025-04-13T14:31:59.598201"
"timestamp": "2025-05-05T15:15:16.790101044"
}
}
Loading