ehrapy.preprocessing.clip_quantile¶
- ehrapy.preprocessing.clip_quantile(adata, limits, vars=None, obs_cols=None, *, copy=False)[source]¶
Clips (limits) features.
Given an interval, values outside the interval are clipped to the interval edges.
- Parameters:
adata (
AnnData
) – The AnnData object to clip.limits (
tuple
[float
,float
]) – Values outside the interval are clipped to the interval edges.vars (
Collection
[str
]) – Columns in var with features to clip.obs_cols (
Collection
[str
]) – Columns in obs with features to clipcopy (
bool
) – Whether to return a copy of AnnData or not
- Return type:
- Returns:
A copy of original AnnData object with clipped features.
Examples
>>> import ehrapy as ep >>> adata = ep.dt.mimic_2(encoded=True) >>> ep.pp.clip_quantile(adata, vars=["bmi"])