RIAssigner.data.MatchMSData

Classes

MatchMSData

Class to handle data from filetypes which can be imported

Functions

safe_read_key(→ float)

Read key from spectrum and convert to float or return 0.0.

_assign_ri_value(→ None)

Assign RI value to Spectrum object

Module Contents

class RIAssigner.data.MatchMSData.MatchMSData(filename: str, filetype: str, rt_unit: str)[source]

Bases: RIAssigner.data.Data.Data

Class to handle data from filetypes which can be imported using ‘matchms’.

_read()[source]

Load data into object and initialize properties.

write(filename: str) None[source]

Write data to back to the spectra file

Parameters:

filename (str) – Path to filename under which to store the data.

_write_RIs_to_spectra() None[source]

Write the RI values stored in the object to the spectra metadata.

_read_retention_times() None[source]

Read retention times from spectrum metadata.

_read_retention_indices() None[source]

Read retention indices from spectrum metadata.

_sort_spectra_by_rt() None[source]

Sort objects (peaks) in spectra list by their retention times.

__eq__(o: object) bool[source]

Comparison operator ==.

Parameters:

o (object) – Object to compare with.

Returns:

State of equality.

Return type:

bool

property retention_times: Iterable[RIAssigner.data.Data.Data.RetentionTimeType][source]

Get retention times in seconds.

property retention_indices: Iterable[RIAssigner.data.Data.Data.RetentionIndexType][source]

Get retention indices.

property comment: Iterable[RIAssigner.data.Data.Data.CommentFieldType][source]

Get comments.

property spectra_metadata: Tuple[numpy.array, List[str]][source]
RIAssigner.data.MatchMSData.safe_read_key(spectrum: matchms.Spectrum, key: str) float[source]

Read key from spectrum and convert to float or return 0.0. Tries to read the given key from the spectrum metadata and convert it to a float. In case an exception is thrown or the key is not present, returns 0.0.

Parameters:
  • spectrum – Spectrum from which to read the key.

  • key – Key to be read from the spectrum metadata.

Return type:

Either the key’s value converted to float or 0.0.

RIAssigner.data.MatchMSData._assign_ri_value(spectrum: matchms.Spectrum, key: str, value: RIAssigner.data.Data.Data.RetentionIndexType) None[source]

Assign RI value to Spectrum object

Parameters: