matchms.exporting.metadata_export module

matchms.exporting.metadata_export.export_metadata_as_csv(spectra: List[Spectrum], filename: str, include_fields: List[str] | None = None)[source]

Export metadata to csv file.

Parameters:
  • spectra – Expected input is a list of Spectrum objects.

  • filename – Provide filename to save metadata of spectrum(s) as csv file.

  • identifier – Identifier used for naming each spectrum in the output file.

matchms.exporting.metadata_export.export_metadata_as_json(spectrums: List[Spectrum], filename: str, include_fields: List[str] | None = None)[source]

Export metadata to json file.

Parameters:
  • spectrums – Expected input is a list of Spectrum objects.

  • filename – Provide filename to save metadata of spectrum(s) as json file.

  • identifier – Identifier used for naming each spectrum in the output file.

matchms.exporting.metadata_export.get_metadata_as_array(spectra: List[Spectrum]) Tuple[array, List[str]][source]

Extract union of all metadata as numpy array from all spectra.

Parameters:
  • spectra – Spectra from which to collect metadata.

  • Returns – Tuple[np.array, List[str]]: Metadata and union of all columns detected in all spectra.