grassp.pp.calculate_replicate_cv#
- calculate_replicate_cv(data, grouping_columns, is_log, layer=None, ignore_zeros=True, inplace=True)[source]#
Calculate the coefficient of variation for each protein across replicates.
- Parameters:
- data
AnnData The annotated data matrix with proteins as observations (rows).
- grouping_columns
Union[str,List[str]] Column name(s) in
data.obsto group samples into replicates.- is_log
bool Whether the data is log-transformed, this determines the CV formula used.
- layer
str|None(default:None) Layer to use for calculation, if None, the .X object is used.
- ignore_zeros
bool(default:True) Whether to ignore zero values.
- inplace
bool(default:True) Whether to modify data in place or return the result. If False, returns a
DataFramewith the CVs.
- data
- Return type:
- Returns:
If
inplace=True, modifies the inputAnnDataobject and returnsNone. The following fields are added to theAnnDataobject: -.obs["mean_replicate_cv"]: Mean CV across replicates. -.obsm["replicate_cv"]: Replicate CVs per group. -.uns["obsm_replicate_cv_headers"]: Headers for the replicate CVs matrix.If
inplace=False, returns aDataFramewith the CVs per group.