matchms.filtering.metadata_processing.require_parent_mass_match_smiles module

matchms.filtering.metadata_processing.require_parent_mass_match_smiles.require_parent_mass_match_smiles(spectrum_in: Spectrum, mass_tolerance) Spectrum | None[source]

Validates if the parent mass of the given spectrum matches the mass calculated from its associated SMILES string within a specified tolerance.

Parameters:
  • spectrum_in (Spectrum) – The input spectrum to be validated. If None, the function will return None.

  • mass_tolerance (float) – The tolerance for the mass difference between the spectrum’s parent mass and the mass calculated from its SMILES string.

Returns:

The validated spectrum if its parent mass matches the SMILES mass within the specified tolerance, or None otherwise.

Return type:

Spectrum or None