Mass Spectrometry, Tutorial, Python, Data Analysis, Research.
file file_mgf = os.path.join(path_data, "GNPS-NIH-NATURALPRODUCTSLIBRARY.mgf") spectrums = list(load_from_mgf(file_mgf)) Now you will have spectrums which is a Python list full of matchms-type Spectrum objects. When running len(spectrums) you can see that we have just imported 1267 mass spectra.