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

[M-2H]2- Adduct bug #284

Open
lauperbe opened this issue Mar 16, 2021 · 4 comments
Open

[M-2H]2- Adduct bug #284

lauperbe opened this issue Mar 16, 2021 · 4 comments

Comments

@lauperbe
Copy link

I came across a bug for Spectra of Adducts [M-2H]2-.
MWE is attached.

The compound with ID 4339 has the formula: C8H4Cl2N2O7S2
The [M-2H]2- ion has a monoisotopic mass of 185.934572, which can be clearly seen in the raw file.

The error occurs during the msmsRead() function. The based on the list here:

getAdductInformation <- function(formula){

mode="m2H_c2" should be what is needed for the [M-2H]2- Adduct.

during the msmsRead() function the error "assignment of an object of class “NULL” is not valid for @‘polarity’ in an object of class “Spectrum1”; is(value, "integer") is not TRUE" occurs.

Additionally the warning "In findMsMsHR.mass(msRaw, mz, mzCoarse, limit.fine, rtLimits, confirmMode + :
No precursor was detected for compound, 4339 with m/z 371.869144923819. Please check the mass and retention time window." appears.
The m/z 371.8691 is the m/z of the [M-2H]- ion, indicating that due to the error above it assumes a charge state of 1.

Thank you in advance
Benedikt

MWE including .mzXML files can be found here since they are too big for upload:
https://polybox.ethz.ch/index.php/s/VTpjPDD43KAjbHU
MWE_M2H.zip

@sneumann
Copy link
Member

Kudos for providing the MWE! The ZIP is missing 202101_023_4339_ChlorothalonilTPR419492.mzXML,
could you upload that as well somewhere ? Yours, Steffen

@lauperbe
Copy link
Author

The mzXML file are in the polyboxlink since they are to big to be directly uploaded.
https://polybox.ethz.ch/index.php/s/VTpjPDD43KAjbHU

@sneumann
Copy link
Member

Darn, hadn't realised that was two separate links and hit the wrong one :-(
I can confirm the error class “NULL” is not valid for @‘polarity’
and the warning No precursor was detected for compound ...
on RMassBank_2.99.4 and 3.1.0. Yours, Steffen

@meowcat
Copy link

meowcat commented Apr 21, 2021

I have a parser that builds all data required for mz calculation directly from arbitrary adduct strings, and handles multiple charges correctly.

https://gist.github.com/meowcat/1df7c1b10002029d39bc2b8fd70e0b18

Should we eventually move to this? The only thing we still would need are a map from mode to adductString. We could think about dropping the "mode" and only using adductstrings directly, but having a non-special-character descriptor is not so bad for e.g. building filenames. Perhaps the "mode" could also be derived automatically? Or it can have a few standard values and the other are user-defined?

Note that this requires tidyverse packages. This would add a few dependencies but also allow to rewrite some code in leMsMs.R that currently awkwardly does what dplyr would easily do.

Note: doubly-charged fragments are not handled correctly by analyzeFormula for now, I think!

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

No branches or pull requests

4 participants