matchms.importing.parsing_utils module¶
Helper functions for parsing metadata.
- matchms.importing.parsing_utils.find_by_key(data: list | dict, target: str) Any [source]¶
Helper function to return entries from nested list/dictionary.
- Parameters:
data – Nested dictionary or list in which entry should be searched.
target – Name of field to search for in data.
- matchms.importing.parsing_utils.parse_mzml_mzxml_metadata(spectrum_dict: dict) dict [source]¶
Parse relevant mzml (or mzxml) metadata entries.
- Parameters:
spectrum_dict –
Spectrum dictionary containing metadata fields. Metadata parsing may easily break when field key names vary. The following metadata information is considered here:
- precursor_mz, searched for in:
–>”precursor”/”precursorMz”–> … –> “selected ion m/z”/”precursorMz”
- charge, searched for in:
–> “charge state”/”polarity”
title, searched for in “spectrum title”
scan_number, searched for in “num”
scan_start_time, searched for in “scan start time”
retention_time, searched for in “retentionTime”