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 :
AnnData
AnnData
Annotated data matrix
- groupby :
str
str
Column of
obs
by which the grouping will be performed.- target_col :
str
str
(default:'clone_id'
) Column on which to compute the alpha diversity
- inplace :
bool
bool
(default:True
) If
True
, add a column toobs
. Otherwise return a DataFrame with the alpha diversities.- key_added :
str
|None
Optional
[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
.