Skip to content
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

Sentieon/datametrics: Add plots optionally for each quality metric #6676

Merged
merged 9 commits into from
Sep 20, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ jobs:
path: modules/nf-core/sentieon/bwaindex
- profile: conda
path: modules/nf-core/sentieon/bwamem
- profile: conda
path: modules/nf-core/sentieon/datametrics
- profile: conda
path: modules/nf-core/sentieon/dedup
- profile: conda
Expand Down
21 changes: 21 additions & 0 deletions modules/nf-core/sentieon/datametrics/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ process SENTIEON_DATAMETRICS {
tuple val(meta), path(bam), path(bai)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)
val plot_results

output:
tuple val(meta), path('*mq_metrics.txt') , emit: mq_metrics
Expand All @@ -20,6 +21,10 @@ process SENTIEON_DATAMETRICS {
tuple val(meta), path('*gc_metrics.txt') , emit: gc_metrics
tuple val(meta), path('*aln_metrics.txt'), emit: aln_metrics
tuple val(meta), path('*is_metrics.txt') , emit: is_metrics
tuple val(meta), path('*mq_metrics.pdf') , emit: mq_plot, optional: true
tuple val(meta), path('*qd_metrics.pdf') , emit: qd_plot, optional: true
tuple val(meta), path('*is_metrics.pdf') , emit: is_plot, optional: true
tuple val(meta), path('*gc_metrics.pdf') , emit: gc_plot, optional: true
path "versions.yml" , emit: versions

when:
Expand Down Expand Up @@ -47,6 +52,14 @@ process SENTIEON_DATAMETRICS {
--algo InsertSizeMetricAlgo ${prefix}_is_metrics.txt \\
--algo AlignmentStat ${prefix}_aln_metrics.txt

if $plot_results
then
sentieon plot GCBias -o ${prefix}_gc_metrics.pdf ${prefix}_gc_metrics.txt
sentieon plot MeanQualityByCycle -o ${prefix}_mq_metrics.pdf ${prefix}_mq_metrics.txt
sentieon plot QualDistribution -o ${prefix}_qd_metrics.pdf ${prefix}_qd_metrics.txt
sentieon plot InsertSizeMetricAlgo -o ${prefix}_is_metrics.pdf ${prefix}_is_metrics.txt
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
Expand All @@ -63,6 +76,14 @@ process SENTIEON_DATAMETRICS {
touch ${prefix}_aln_metrics.txt
touch ${prefix}_is_metrics.txt

if $plot_results
then
touch ${prefix}_gc_metrics.pdf
touch ${prefix}_mq_metrics.pdf
touch ${prefix}_qd_metrics.pdf
touch ${prefix}_is_metrics.pdf
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
Expand Down
44 changes: 44 additions & 0 deletions modules/nf-core/sentieon/datametrics/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ input:
type: file
description: Index of the genome fasta file
pattern: "*.fai"
- - plot_results:
type: boolean
description: Boolean to determine whether plots should be generated
pattern: "true or false"
output:
- mq_metrics:
- meta:
Expand Down Expand Up @@ -110,6 +114,46 @@ output:
description: File containing the information about statistical distribution
of insert sizes
pattern: "*.txt"
- mq_plot:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- "*mq_metrics.pdf":
type: file
description: "PDF containting plot of mean base quality scores"
pattern: "*.pdf"
- qd_plot:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- "*qd_metrics.pdf":
type: file
description: "PDF containting plot of specific base quality score"
pattern: "*.pdf"
- is_plot:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- "*is_metrics.pdf":
type: file
description: "PDF containting plot of insert sizes"
pattern: "*.pdf"
- gc_plot:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- "*gc_metrics.pdf":
type: file
description: "PDF containting plot of GC bias"
pattern: "*.pdf"
- versions:
- versions.yml:
type: file
Expand Down
109 changes: 109 additions & 0 deletions modules/nf-core/sentieon/datametrics/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
nextflow_process {

name "Test Process SENTIEON_DATAMETRICS"
script "../main.nf"
process "SENTIEON_DATAMETRICS"

tag "modules"
tag "modules_nfcore"
tag "sentieon"
tag "sentieon/datametrics"
config "./nextflow.config"

test("metrics - no plots") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
]
input [1] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true),
]
input [2] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true),
]
input [3] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("metrics - with plots") {
when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
]
input [1] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true),
]
input [2] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true),
]
input [3] = true
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true),
]
input [1] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true),
]
input [2] = [
[id:'genome'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true),
]
input [3] = true
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
Loading
Loading