matchms.filtering.metadata_processing.derive_formula_from_name module

matchms.filtering.metadata_processing.derive_formula_from_name.derive_formula_from_name(spectrum_in: Spectrum, remove_formula_from_name: bool = True) Spectrum[source]

Detect and remove misplaced formula in compound name and add to metadata.

Method to find misplaced formulas in compound name based on regular expression. This will not chemically test the detected formula, so the search is limited to frequently occuring types of shape ‘C47H83N1O8P1’.

Parameters:
  • spectrum_in – Input spectrum.

  • remove_formula_from_name – Remove found formula from compound name if set to True. Default is True.