mocca.components package

Submodules

mocca.components.databases module

Created on Thu Dec 2 16:32:36 2021

@author: haascp

class mocca.components.databases.BaseDatabase[source]

Bases: object

Base class for component databases with the unique constrained primary key compound_id.

delete_all_items()[source]

Clears all components out of database.

insert_item(item, unique=True)[source]

Inserts a new item to the database. If the unique argument is True, it checks if the item already exists in the databse.

class mocca.components.databases.QualiComponentDatabase[source]

Bases: BaseDatabase

Database storing and processing qualitative components used for peak assignment.

insert_by_compound_id(peak_database, compound_id, peak_filter_function=None)[source]

Inserts component in existing component list. If component with given compound_id already exists, it will be overwritten.

update(peak_database, peak_filter_function=None)[source]

Creates components from the given peak database. Optionally, a condition can be given to filter peaks.

class mocca.components.databases.QuantComponentDatabase[source]

Bases: BaseDatabase

Database storing and processing quantitative components used for peak quantification.

update(peak_database, quali_comp_db, peak_filter_function=None)[source]

Creates components from the given peak database. Optionally, a condition can be given to filter peaks.

mocca.components.models module

class mocca.components.models.QualiComponent(compound_id: str, left: int, right: int, maximum: int, offset: int, spectrum: list, spectrum_max: list, created_from: List[ProcessedPeak])[source]

Bases: object

Class of a qualitative component created from a number of peaks of the same compound_id.

compound_id: str
created_from: List[ProcessedPeak]
left: int
maximum: int
offset: int
right: int
spectrum: list
spectrum_max: list
class mocca.components.models.QuantComponent(compound_id: str, integrate_wl_idx: int, calib_factors: dict, calib_data: dict, calib_scores: dict, created_from: List[ProcessedPeak])[source]

Bases: object

Class of a quantitative component created from a number of peaks of the same compound_id.

calib_data: dict
calib_factors: dict
calib_scores: dict
compound_id: str
created_from: List[ProcessedPeak]
integrate_wl_idx: int

mocca.components.quali_funcs module

Created on Fri Dec 3 09:54:04 2021

@author: haascp

mocca.components.quali_funcs.create_quali_component(peaks)[source]

Creates a qualitative component object based on the given peaks.

mocca.components.quali_funcs.get_absorbance_maxima(spectrum)[source]

Returns absorbance maxima of given spectrum. Maximum must be at least 5% intensity of the overall maximum intensity.

mocca.components.quant_funcs module

Created on Mon Dec 20 17:20:35 2021

@author: haascp

mocca.components.quant_funcs.create_calibration_dict(peaks, integrate_wl_idx, quali_comp_db)[source]

Creates a dictionary with all data needed to create calibration curves.

mocca.components.quant_funcs.create_linear_models(calib_data)[source]

Creates linear models out of the given data and returns a list of linear calibration factors (calibration curve is forced through origin) and a list of corresponing R-squared values of the regression.

mocca.components.quant_funcs.create_quant_component(peaks, quali_comp_db)[source]

Creates a quantitative component object based on the given peaks

mocca.components.quant_funcs.get_integrate_wl_index(compound_id, quali_comp_db)[source]

Returns index of the wavelength vector where spectrum of component has the highest maximum.

mocca.components.quant_funcs.integrate_on_wl(peak, integrate_wl_idx, bandwidth=2)[source]

Integrates signal of given peak on a given wavelength with a bandwidth of 2 (default) by summing all absorbances.

mocca.components.utils module

Created on Fri Dec 3 13:23:45 2021

@author: haascp

mocca.components.utils.average_ret_times_over_peaks(peaks)[source]

Calculates mean retention indices of a list of peaks.

mocca.components.utils.average_spectra_over_peaks(peaks)[source]

Calculates mean spectrum of a list of peaks with averaged spectrum.

mocca.components.utils.check_peaks_compound_id(peaks)[source]

Checks if all given peaks have the same compound_id and, if so, returns this compound_id.

mocca.components.utils.filter_peaks(peaks, filter_function)[source]

Filters given peaks with regard to the given filter function (which takes a list of peaks and returns a filtered list of peaks).

mocca.components.utils.get_filtered_peaks(peak_database, filter_function)[source]

Returns a filtered (by the given filter function) list of peaks from the database which are pure and unsaturated and have a compound_id.

mocca.components.utils.get_filtered_peaks_by_compound(peak_database, filter_function)[source]

Creates a filtered (by the given filter function) list of peaks from the database which are pure and unsaturated and have a compound_id. From this list, it returns a dict with unique compound_id as keys and a list of corresponding peaks as values.

mocca.components.utils.get_quant_peaks_by_compound(peak_database, filter_function)[source]

Returns a dict with compound_ids as keys and lists of peaks as values, where only peaks are includud which have is_compound True and which have a given concentration.

mocca.components.utils.get_valid_peaks(peaks)[source]

Returns a list of peaks from the database which are pure and unsaturated and have a compound_id.

mocca.components.utils.sort_peaks_by_compound(peaks)[source]

Returns dict with unique compound_id as keys and a list of corresponding peaks as values.

Module contents