mocca.peak package
Submodules
mocca.peak.check module
Created on Thu Dec 2 09:16:47 2021
@author: haascp
- mocca.peak.check.check_peak(expanded_peak, detector_limit, show_analytics, param=2.5)[source]
Peak checking routine. Returns a checked peak with pure and saturation attributes.
mocca.peak.correct module
Created on Tue Dec 14 15:30:29 2021
@author: haascp
mocca.peak.database module
Created on Fri Nov 26 08:28:12 2021
@author: haascp
- class mocca.peak.database.PeakDatabase(peaks: List[ProcessedPeak] | None = None)[source]
Bases:
object
Database class to store and organize peaks of HPLC-DAD data.
mocca.peak.expand module
Created on Thu Dec 2 09:16:47 2021
@author: haascp
- mocca.peak.expand.expand_peak(picked_peak, absorbance_threshold)[source]
Expands peak boundaries to those actually in the data. It keeps expanding them until the absorbance falls below one twentieth of the given absorbance threshold. Returns a picked peak with modified peak boundaries (left, right).
mocca.peak.integrate module
Created on Tue Dec 7 10:57:23 2021
@author: haascp
mocca.peak.match module
Created on Wed Dec 1 12:06:57 2021
@author: haascp
- mocca.peak.match.get_filtered_similarity_dicts(peak, component_db, spectrum_correl_coef_thresh, relative_distance_thresh, print_out=False)[source]
Filters the list of similarity dictionaries with regard to the given thresholds. Return possible matches which have a spectral correlation coefficient higher than the given threshold and a relative distance between the peak maxima lower than the given threshold.
- mocca.peak.match.get_relative_distance(peak, component)[source]
Returns the distance of an offset-corrected peak maximum and a component maximum relative to the length of the time vector.
- mocca.peak.match.get_similarity_dicts(peak, component_db, relative_distance_thresh)[source]
Returns a sorted list of dictionaries. For each component in the given database, similarity values to the given peak are stored.
- mocca.peak.match.get_spectrum_correl_coef(peak, component)[source]
Returns the correlation coefficient of the average peak spectrum and the spectrum of the component.
mocca.peak.models module
- class mocca.peak.models.BasePeak(left: int, right: int, maximum: int, offset: int)[source]
Bases:
object
Base peak class.
- class mocca.peak.models.CheckedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int, saturation: bool, pure: bool)[source]
Bases:
PickedPeak
Class for peaks checked with regard to saturation and purity.
- class mocca.peak.models.CorrectedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int, saturation: bool, pure: bool, integral: float, istd: List[IstdPeak])[source]
Bases:
IntegratedPeak
Class for peaks with added retention time offset. From this class on, retention times in the peaks are already corrected. This means, that accessing data from the dataset attribute require prior un-offsetting.
- class mocca.peak.models.IntegratedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int, saturation: bool, pure: bool, integral: float)[source]
Bases:
CheckedPeak
Class for integrated peaks.
- class mocca.peak.models.IstdPeak(left: int, right: int, maximum: int, dataset: CompoundData, integral: float, offset: int, compound_id: str, concentration: float)[source]
Bases:
object
Class for istd peaks to be added to the peak classes below.
- dataset: CompoundData
- class mocca.peak.models.PickedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int)[source]
Bases:
BasePeak
Class for picked peaks out of DAD data. Also valid for expanded peaks.
- dataset: CompoundData
- class mocca.peak.models.PreprocessedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int, saturation: bool, pure: bool, integral: float, istd: List[IstdPeak], matches: List[dict])[source]
Bases:
CorrectedPeak
Class for preprocessed peaks containing a list of possible component matches in the attribute compound_id.
- class mocca.peak.models.ProcessedPeak(left: int, right: int, maximum: int, offset: int, dataset: CompoundData, idx: int, saturation: bool, pure: bool, integral: float, istd: List[IstdPeak] | None = None, compound_id: str | None = None, concentration: float | None = None, is_compound: bool = False)[source]
Bases:
object
Class of fully processed peaks ready to be put in the peak database.
- dataset: CompoundData
mocca.peak.process module
Created on Fri Dec 17 11:03:08 2021
@author: haascp
mocca.peak.purity_funcs module
Created on Tue Nov 23 15:55:25 2021
@author: haascp
- mocca.peak.purity_funcs.get_agilent_thresholds(peak_data, max_loc, noise_variance, param=2.5)[source]
Returns the thresholds calculated by the Agilent purity algorithm.
- mocca.peak.purity_funcs.get_correls(peak_data, max_loc)[source]
Get a list with correlation coefficients of UV-Vis spectra at every timepoint with reference to the UV-Vis spectrum at maximum absorbance.
- mocca.peak.purity_funcs.get_max_loc(peak_data)[source]
Returns the maximum location of the given peak data.
- mocca.peak.purity_funcs.get_noise_variance(peak)[source]
Filters dataset with only timepoints whose max absorbance at any wavelength is below 1% of max absorbance. Returns the average of the variance over all wavelengths.
- mocca.peak.purity_funcs.get_pca_explained_variance(peak_data)[source]
Calculates the ration of explained variance by the first principal component of the devonvoluted peak data.
- mocca.peak.purity_funcs.get_purity_value_agilent(peak_data, correls, agilent_thresholds)[source]
Uses Agilent’s peak purity algorithm to predict purity of peak. Param gives strictness of test (original was 0.5, which is more strict)
- mocca.peak.purity_funcs.get_trimmed_peak_data(peak)[source]
Returns peak data trimmed with cut edges of the peak to 5% of max absorbance to avoid noise artifacts.
- mocca.peak.purity_funcs.predict_purity_unimodal(correls)[source]
Checks for unimodality of a peak by an averaging filter of length 3 on the correlation vector to the maximum https://stackoverflow.com/questions/14313510/how-to-calculate-rolling-moving-average-using-numpy-scipy
mocca.peak.quantify module
Created on Tue Jan 4 15:49:54 2022
@author: haascp
mocca.peak.resolve_impure module
Created on Fri Jan 14 08:59:36 2022
@author: haascp
- mocca.peak.resolve_impure.create_parafac_peak(comp_i, parafac_model)[source]
Return synthetic PARAFAC peaks created from the PARAFAC decomposition results.
- mocca.peak.resolve_impure.create_pure_peak(impure_peak)[source]
Takes an impure peak and returns its copy with the pure attribute True.
- mocca.peak.resolve_impure.get_parafac_data_shift(iter_offset)[source]
If the iteration offset is larger than zero, the impure peak was shifted and must therefore be shifted back in the resulting PARAFAC data. If the iteration shift was negative, the pure signals were shifted and nothing has to be done.
mocca.peak.utils module
Created on Thu Dec 2 10:00:18 2021
@author: haascp
- mocca.peak.utils.average_peak_spectrum(peak)[source]
Calculates mean spectrum over peak from left to right border.
- mocca.peak.utils.get_peak_data(peak)[source]
Returns absorbance data from the left to the right border of the peak for all wavelengths. If the peak was offset-corrected, the left and right border are un-offset in order to access the correct data.
- mocca.peak.utils.get_retention_times(peak)[source]
Returns left and right borders as well as maximum of a peak as retention times.
- mocca.peak.utils.is_unimodal(L, high_val_threshold=inf)[source]
Checks if a list is unimodal (for use in peak purity).
- Parameters:
L (list) – A list to test unimodality for
high_val_threshold (numeric, optional) – If set, then values above high_val_threshold will not be counted in unimodality testing. Default is np.inf (i.e. this threshold is not used).
- Returns:
True if the list is unimodal ignoring high values; False otherwise.
- Return type:
TYPE boolean