matchms.filtering.metadata_processing.derive_adduct_from_name module

matchms.filtering.metadata_processing.derive_adduct_from_name.derive_adduct_from_name(spectrum_in: Spectrum, remove_adduct_from_name: bool = True, clone: bool | None = True) Spectrum | None[source]

Find adduct in compound name and add to metadata (if not present yet).

Method to interpret the given compound name to find the adduct.

Parameters:
  • spectrum_in – Input spectrum.

  • remove_adduct_from_name – Remove found adducts from compound name if set to True. Default is True.

  • clone – Optionally clone the Spectrum.

Returns:

Spectrum with added adduct, or None if not present.

Return type:

Spectrum or None