Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fragment formula annotation is incorrect for multiply-charged ions #307

Open
meowcat opened this issue Mar 17, 2022 · 1 comment
Open

Fragment formula annotation is incorrect for multiply-charged ions #307

meowcat opened this issue Mar 17, 2022 · 1 comment

Comments

@meowcat
Copy link

meowcat commented Mar 17, 2022

For charges > 1 (e.g. mode = "m2H_c2"), fragment formula annotation is incorrect.
The m/z used as input for generate.formula is corrected by # electrons corresponding to the precursor charge, but not multiplied by z. This leads to masses that correspond to singly-charged fragments that are off by one electron (for the case of z=2).

In reality, the observed fragments would be either singly or doubly (or triply, etc) charged, and for each possibility both the electron mass and z need to be adjusted.

RMassBank/R/leMsMs.r

Lines 643 to 658 in 7b780e2

peakmatrix <- lapply(split(shot,shot$row), function(shot.row) {
# Circumvent bug in rcdk: correct the mass for the charge first, then calculate uncharged formulae
# finally back-correct calculated masses for the charge
mass <- shot.row[["mz"]]
mass.calc <- mass + mode.charge * .emass
tolerance <- ppm(mass.calc, ppmlimit, p=TRUE)
if (mass.calc > maximal.mass + tolerance)
return(t(c(row=shot.row[["row"]], intensity = shot.row[["intensity"]], mz=mass, formula=NA, mzCalc=NA)))
peakformula <- tryCatch(
suppressWarnings(generate.formula(mass.calc, tolerance,
limits, charge=0)),
error = function(e) list())
# was a formula found? If not, return empty result
# ppm(mass, ppmlimit, p=TRUE),
# limits, charge=1),
#error= function(e) list())

@meowcat
Copy link
Author

meowcat commented Mar 18, 2022

Working on it in branch https://github.com/MassBank/RMassBank/tree/multiply_charged. Since this changes a core function, I am hesitant to push it into 3.15 release

@tsufz tsufz added this to the Adduct and formula annotation milestone Feb 7, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants