scirpy.tl.alpha_diversity¶
-
scirpy.tl.alpha_diversity(adata, groupby, *, target_col='clone_id', inplace=True, key_added=None)¶ Computes the alpha diversity of clonotypes within a group.
Uses the Shannon Entropy as diversity measure. The Entrotpy gets normalized to group size.
Ignores NaN values.
- Parameters
- adata :
AnnDataAnnData Annotated data matrix
- groupby :
strstr Column of
obsby which the grouping will be performed.- target_col :
strstr(default:'clone_id') Column on which to compute the alpha diversity
- inplace :
boolbool(default:True) If
True, add a column toobs. Otherwise return a DataFrame with the alpha diversities.- key_added :
str|NoneOptional[str] (default:None) Key under which the alpha diversity will be stored if inplace is
True. Defaults toalpha_diversity_{target_col}.
- adata :
- Return type
- Returns
Depending on the value of inplace returns a DataFrame with the alpha diversity for each group or adds a column to
adata.obs.