RIAssigner.data.Data

Classes

Data

Base class for data managers.

Module Contents

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

Bases: abc.ABC

Base class for data managers.

RetentionTimeType[source]
RetentionIndexType[source]
CommentFieldType[source]
URegistry[source]
_keys_conversions[source]
_rt_possible_keys[source]
_ri_possible_keys[source]
static is_valid(value: RetentionTimeType | RetentionIndexType) bool[source]

Determine whether a retention time value is valid

Parameters:

rt (RetentionTimeType) – Value to check for validity.

Returns:

State of validity (True/False).

Return type:

bool

static can_be_float(rt: pint.Quantity | float | int) bool[source]

Determine whether a value can be converted to a float.

This function checks if the provided input is an instance of either Quantity, float, or int.

Parameters:

rt (Union[Quantity, float, int]) – Value to check for float conversion.

Returns:

True if the input is an instance of Quantity, float, or int, False otherwise.

Return type:

bool

classmethod add_possible_rt_keys(keys: List[str]) None[source]

A method that adds new identifiers to get retention time information.

Parameters:

keys (List[str]) – A list of new identifiers (keys) to be added to the _rt_possible_keys.

Returns:

None

classmethod add_possible_ri_keys(keys: List[str]) None[source]

A method that adds new identifiers to get retention index information.

Parameters:

keys (List[str]) – A list of new identifiers (keys) to be added to the _ri_possible_keys.

Returns:

None

classmethod get_possible_rt_keys() List[str][source]

A method that returns the possible keys to get retention times.

Returns:

A list of possible keys to get retention times.

Return type:

List[str]

classmethod get_possible_ri_keys() List[str][source]

A method that returns the possible keys to get retention indices.

Returns:

A list of possible keys to get retention indices.

Return type:

List[str]

_filename[source]
_filetype[source]
_rt_unit[source]
_unit[source]
abstractmethod write(filename: str) None[source]

Store current content to disk.

Parameters:

filename (str) – Path to output filename.

property filename: str[source]

Getter for filename property.

Returns:

Filename of originally loaded data.

Return type:

str

property retention_times: Iterable[RetentionTimeType][source]
Abstractmethod:

Getter for retention_times property.

Returns:

RT values contained in data.

Return type:

Iterable[RetentionTimeType]

property retention_indices: Iterable[RetentionIndexType][source]
Abstractmethod:

Getter for retention_indices property.

Returns:

RI values stored in data.

Return type:

Iterable[RetentionIndexType]

has_retention_indices() bool[source]

Check if all retention indices in the spectra exist.

This method iterates over the retention indices in the spectra. If it encounters a value that is None, it immediately returns False. If it iterates over all retention indices without finding a None value, it returns True.

Returns:

True if all retention indices exist, False otherwise.

Return type:

bool

has_retention_times() bool[source]

Check if all retention times in the spectra exist.

This method iterates over the retention times in the spectra. If it encounters a value that is None, it immediately returns False. If it iterates over all retention times without finding a None value, it returns True.

Returns:

True if all retention times exist, False otherwise.

Return type:

bool

property comment: Iterable[CommentFieldType][source]
Abstractmethod:

Getter for comment property.

Returns:

Comment field values stored in data.

Return type:

Iterable[CommentFieldType]

init_ri_from_comment(ri_source: str) None[source]

Extract RI from comment field. Extracts the RI from the comment field of the data file. The RI is expected to be in the format ‘ri_source=RI_value’. The function extracts the RI value and sets it on the retention_index property.

Parameters:
  • content_comment – Comment field of the data file.

  • ri_source – String that is expected to be in the comment field before the RI value.