acore.drift_correction.cpca_drift_correction module#
Functions for metabolomics drift correction by Common Principal Components Analysis (CPCA).
- check_missingness(df: DataFrame, rows_to_check: list)[source]#
This function checks for NAs in the data frame inside some user-provided rows.
- Parameters:
df (samples as rows, features as columns)
rows_to_check (list of rows that should be checked for missingness)
- Returns:
Boolean
- Return type:
True if there is missingness, False if there is no missingness.
- run_cpca_drift_correction(df: DataFrame, sample_rows, qc_rows, n_comps: int = 1) DataFrame[source]#
Corrects technical drift using Common Principal Components Analysis (CPCA). Adapted from m-baralt/metabolomics_incident_diabetes.
- Parameters:
- Returns:
Full input DataFrame with corrected values applied to the intensity rows
(sample_rows + qc_rows). Rows outside those arguments are returned unchanged.