matchms.filtering.metadata_processing.repair_smiles_of_salts module

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

Repairs the smiles of a salt to match the parent mass. E.g. C1=NC2=NC=NC(=C2N1)N.Cl is converted to 1=NC2=NC=NC(=C2N1)N if this matches the parent mass Checks if parent mass matches one of the ions

Parameters:
  • spectrum_in – Input spectrum.

  • mass_tolerance – Maximum allowed mass difference between the calculated parent mass and the neutral monoisotopic mass derived from the SMILES.

  • clone – Optionally clone the Spectrum.

Returns:

Spectrum with repaired SMILES, or None if not present.

Return type:

Spectrum or None