Skip to content

Commit

Permalink
Merge pull request #332 from jonasscheid/add-idmassaccuracy
Browse files Browse the repository at this point in the history
Add idmassaccuracy module and QC plot
  • Loading branch information
jonasscheid authored Oct 8, 2024
2 parents da9fc4d + a7fd94d commit 2b89f80
Show file tree
Hide file tree
Showing 15 changed files with 475 additions and 51 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### `Added`

- Added `PYOPENMS_CHROMATOGRAMEXTRACTOR` extracting MS1 Chromatograms and visualize them in multiQC report [#329](https://github.com/nf-core/mhcquant/pull/329)
- Added `OPENMS_IDMASSACCURACY` and `DATAMASH_HISTOGRAM` to compute fragment mass errors and visualizte them in multiQC report [#332](https://github.com/nf-core/mhcquant/pull/332)

## v2.6.0 - nfcore/mhcquant "Mr Bob" - 2024/06/17

Expand Down
27 changes: 24 additions & 3 deletions assets/multiqc_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,43 @@ custom_data:
It represents the total ion current (TIC) from the MS1 scan,
which is useful for monitoring the overall elution profile of compounds during a chromatographic separation.
pconfig:
id: "chromatogram"
title: "MS1 Chromatograms"
xlab: "Retention time [min]"
xmin: 0
ylab: "Intensity"
logswitch: true
logswitch_active: true

# Mass error plot
mass_error:
plot_type: "linegraph"
file_format: "tsv"
section_name: "Fragment mass error"
description: |
The fragment mass error describes the differences between observed and theoretical fragment ion masses.
It helps assessing the accuracy and calibration of the mass spectrometer by visualizing the error range
and potential deviations. Depending on your configurations this error is plotted in Dalton (Da)
or parts-per-million (ppm).
pconfig:
xlab: "Mass deviation [Da/ppm]"
ylab: "Frequency"
#id: custom_box
#plot_type: 'box'
#section_name: 'Custom box plot'
#description: "Box plot for a sample"
#pconfig:
# title: 'Box plot'

sp:
chromatogram:
fn: "*_chrom.csv"
## Define the order of sections
mass_error:
fn: "*_binned.tsv"
### Define the order of sections
#module_order:
# - custom_content
#
## Set the order of custom code plots and tables
#custom_content:
# order:
# - chromatogram
# - mass_error
18 changes: 18 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,24 @@ process {
]
}

withName: 'OPENMS_IDMASSACCURACY' {
ext.prefix = {"${meta.spectra}"}
ext.args = [
(params.precursor_error_units == 'ppm') ? "-precursor_error_ppm": "",
"-fragment_mass_tolerance ${params.fragment_mass_tolerance}"
].join(' ').trim()
publishDir = [
enabled: false
]
}

withName: 'DATAMASH_HISTOGRAM' {
ext.prefix = {"${meta.spectra}"}
publishDir = [
enabled: false
]
}

withName: 'MS2RESCORE' {
ext.args = [
"--ms2_tolerance ${2 * params.fragment_mass_tolerance}",
Expand Down
7 changes: 6 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"multiqc": {
"branch": "master",
"git_sha": "06c8865e36741e05ad32ef70ab3fac127486af48",
"git_sha": "666652151335353eef2fcd58880bcef5bc2928e1",
"installed_by": ["modules"]
},
"openms/decoydatabase": {
Expand All @@ -25,6 +25,11 @@
"git_sha": "bbcad23c681ff85336aef1c41345bc313d921b5d",
"installed_by": ["modules"]
},
"openms/idmassaccuracy": {
"branch": "master",
"git_sha": "f768b283dbd8fc79d0d92b0f68665d7bed94cabc",
"installed_by": ["modules"]
},
"openms/idmerger": {
"branch": "master",
"git_sha": "bbcad23c681ff85336aef1c41345bc313d921b5d",
Expand Down
52 changes: 52 additions & 0 deletions modules/local/datamash_histogram.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
process DATAMASH_HISTOGRAM {
tag "$meta.id"
label 'process_single'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/datamash:1.1.0--0' :
'biocontainers/datamash:1.1.0--0' }"

input:
tuple val(meta), path(tsv)

output:
tuple val(meta), path("*.tsv"), emit: binned_tsv
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
datamash \\
bin:0.0002 1 \\
$args \\
< $tsv \\
| \\
datamash \\
--sort \\
--group 1 \\
count 1 \\
> ${prefix}_binned.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
datamash: \$(datamash --version | grep 'datamash' | cut -d ' ' -f4)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_binned.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
datamash: \$(datamash --version | grep 'datamash' | cut -d ' ' -f4)
END_VERSIONS
"""
}
4 changes: 2 additions & 2 deletions modules/nf-core/multiqc/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 49 additions & 42 deletions modules/nf-core/multiqc/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions modules/nf-core/multiqc/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions modules/nf-core/openms/idmassaccuracy/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions modules/nf-core/openms/idmassaccuracy/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2b89f80

Please sign in to comment.