matchms.importing.load_from_msp module¶
- matchms.importing.load_from_msp.contains_metadata(rline: str) bool [source]¶
Check if line contains Spectrum metadata.
- matchms.importing.load_from_msp.get_peak_comment(rline: str) Tuple[str, str] [source]¶
Get the peak comment from the line containing the peak information.
- matchms.importing.load_from_msp.get_peak_values(peak: str) Tuple[List[float], List[float]] [source]¶
Get the m/z and intensity value from the line containing the peak information.
- matchms.importing.load_from_msp.load_from_msp(filename: str, metadata_harmonization: bool = True) Generator[Spectrum, None, None] [source]¶
MSP file to a
Spectrum
objects Function that reads a .msp file and converts the info inSpectrum
objects.- Parameters:
filename – Path of the msp file.
metadata_harmonization (bool, optional) – Set to False if metadata harmonization to default keys is not desired. The default is True.
- Yields:
Yield a spectrum object with the data of the msp file
Example:
from matchms.importing import load_from_msp # Download msp file from MassBank of North America repository at https://mona.fiehnlab.ucdavis.edu/ file_msp = "MoNA-export-GC-MS-first10.msp" spectrums = list(load_from_msp(file_msp))