scirpy.tl.summarize_clonal_expansion

scirpy.tl.summarize_clonal_expansion(adata, groupby, *, target_col='clone_id', summarize_by='cell', normalize=False, airr_mod='airr', **kwargs)

Summarizes clonal expansion by a grouping variable.

Removes all entries with NaN in target_col prior to summarization.

Parameters
adata : AnnData | MuData | DataHandlerUnion[AnnData, MuData, DataHandler]

AnnData or MuData object that contains AIRR information.

groupby : str

summarize by this column in adata.obs.

target_col : str (default: 'clone_id')

column in obs which holds the clonotype information

summarize_by : {‘cell’, ‘clone_id’}Literal[‘cell’, ‘clone_id’] (default: 'cell')

Can be either cell to count cells belonging to a clonotype (the default), or “clone_id” to count clonotypes. The former leads to a over-representation of expanded clonotypes but better represents the fraction of expanded cells.

normalize : bool (default: False)

If False, plot absolute cell counts. If True, scale each group to 1.

airr_mod : str (default: 'airr')

Name of the modality with AIRR information is stored in the MuData object. if an AnnData object is passed to the function, this parameter is ignored.

**kwargs

Additional arguments passed to clonal_expansion().

Return type

DataFrame

Returns

A DataFrame with one row for each unique value in groupby.