matchms.exporting.save_spectra module

matchms.exporting.save_spectra.save_as_pickled_file(spectra, filename: str) None[source]

Stores spectra as a pickled object

Args:

spectra:

The spectra that are saved.

filename:

Path to file containing spectra, with file extension “json”, “mgf”, “msp”

matchms.exporting.save_spectra.save_spectra(spectra: list[Spectrum], file: str, export_style: str = 'matchms', append: bool = False) None[source]

Saves spectra as the file type specified.

The following file extensions can be used: .json, .mgf, and .msp.

Args:

spectra:

The spectra that are saved.

file:

Path to file containing spectra, with file extension “.json”, “.mgf”, “.msp”.

export_style:

Converts the keys to the required export style. One of [“matchms”, “massbank”, “nist”, “riken”, “gnps”]. Default is “matchms”.

append:

Only supported for “.mgf”, and “.msp” filetypes. If True, will try to append to an existing file, instead of creating a new file. Default is False.