pgfinder.validation

Functions for validation of data.

Module Contents

Functions

allowed_modifications(→ list)

Loads allowable modifications from a csv file as a list.

validate_raw_data_df(→ None | ValueError)

Validate that the raw data is a Pandas Dataframe with specific column names and that it has attributes.

validate_theo_masses_df(→ None | ValueError)

Validate that the theoretical masses data is a Pandas Dataframe with specific column names and that it has

validate_rt_window(→ None | ValueError)

Validate that rt_window is an float.

validate_enabled_mod_list(→ None | ValueError)

Validate that enabled_mod_list is a list and modifications are allowed.

validate_user_ppm(→ None | ValueError)

Validate that user_ppm is an integer.

Attributes

LOGGER

pgfinder.validation.LOGGER
pgfinder.validation.allowed_modifications(config_file: str | pathlib.Path = 'config/allowed_modifications.txt') list[source]

Loads allowable modifications from a csv file as a list.

Parameters:

config_file (str | Path) – Path to a configuration file. Default ‘config/allowed_modifications.txt’

Returns:

List of permissible modifications.

Return type:

list

pgfinder.validation.validate_raw_data_df(raw_data_df: pandas.DataFrame, columns: dict = COLUMNS['pgfinder']) None | ValueError[source]

Validate that the raw data is a Pandas Dataframe with specific column names and that it has attributes.

Parameters:

raw_data_df (pd.DataFrame) – Data frame to be validated.

Returns:

Error specific to the problem encountered with the data frame if any are encountered.

Return type:

None | ValueError

Raises:

ValueError

pgfinder.validation.validate_theo_masses_df(theo_masses_df: pandas.DataFrame) None | ValueError[source]

Validate that the theoretical masses data is a Pandas Dataframe with specific column names and that it has attributes.

Parameters:

raw_data_df (pd.DataFrame) – Data frame to be validated.

Returns:

Error specific to the problem encountered with the data frame if any are encountered.

Return type:

None | ValueError

Raises:

ValueError

pgfinder.validation.validate_rt_window(rt_window: float) None | ValueError[source]

Validate that rt_window is an float.

Parameters:

rt_window (int) – Value of rt_window to be validated.

Returns:

If no error nothing is returned, otherwise a ValueError is raised.

Return type:

None | ValueError

Raises:

ValueError

pgfinder.validation.validate_enabled_mod_list(enabled_mod_list: list) None | ValueError[source]

Validate that enabled_mod_list is a list and modifications are allowed.

Parameters:

enabled_mod_list (int) – Value of enabled_mod_list to be validated.

Returns:

If no error nothing is returned, otherwise a ValueError is raised.

Return type:

None | ValueError

Raises:

ValueError

pgfinder.validation.validate_user_ppm(user_ppm: int) None | ValueError[source]

Validate that user_ppm is an integer.

Parameters:

user_ppm (int) – Value of user_ppm to be validated.

Returns:

If no error nothing is returned, otherwise a ValueError is raised.

Return type:

None | ValueError

Raises:

ValueError