matchms.filtering.filter_utils.interpret_unknown_adduct module

Calculates the multiplier and correction mass for an adduct

matchms.filtering.filter_utils.interpret_unknown_adduct.get_charge_of_adduct(adduct) int | None[source]

Returns the charge of an adduct

e.g. ‘[M+H-H2O]2+’ -> 2

matchms.filtering.filter_utils.interpret_unknown_adduct.get_ions_from_adduct(adduct: str) Tuple[int, List[str]][source]

Returns a list of ions from an adduct and returns the number of parent masses

e.g. ‘[M+H-H2O]2+’ -> (1, [“+H”, “-H2O”])

matchms.filtering.filter_utils.interpret_unknown_adduct.get_mass_of_formula(formula)[source]

Calculates the monoisotopic mass of an formula

e.g. “C” returns 12.011 and “CH2” returns 15.035. This can be used to calculate the mass difference of adducts Was adapted from: https://bioinformatics.stackexchange.com/questions/6852/

matchms.filtering.filter_utils.interpret_unknown_adduct.get_mass_of_ion(ions)[source]

Derived from https://github.com/pnnl/MSAC

matchms.filtering.filter_utils.interpret_unknown_adduct.get_multiplier_and_mass_from_adduct(adduct: str) Tuple[float | None, float | None][source]

Get multiplier for charge and the correction mass of an adduct.

The multiplier and correction mass can be used to calculate the parent mass based on the precursor mz. Examples can be found in matchms/data/known_adducts_table.csv

Args:

adduct (str): String description of the adduct. e.g. ‘[M+H-H2O]2+’

Returns:

Tuple[Optional[float], Optional[float]]: Multiplier and mass of this adduct.

matchms.filtering.filter_utils.interpret_unknown_adduct.replace_abbreviations(ions_split)[source]

Derived from https://github.com/pnnl/MSAC

matchms.filtering.filter_utils.interpret_unknown_adduct.split_ion(ion: str) Tuple[str, int, str][source]

Separate an ion description string into sign, number and formula.

e.g. +2H2O -> (“+”, 2, “H2O”) Args:

ion (str): String representing the ion.

Returns:

Tuple[str, str, str]: Components of the ion descirption.