scirpy.pl.clonal_expansion

scirpy.pl.clonal_expansion(adata, groupby, *, target_col='clone_id', clip_at=3, expanded_in=None, summarize_by='cell', normalize=True, show_nonexpanded=True, viztype='bar', **kwargs)

Visualize clonal expansion.
`

Visualize clonal expansion.

Plots the fraction of cells that belong to an expanded Clonotype by a categorical variable.

If summarize_by is set to “clone_id” it plots the fraction of clonotypes instead of the fraction of cells.

Removes all entries with NaN in target_col prior to plotting.

Parameters
adata : AnnDataAnnData

AnnData object to work on.

groupby : strstr

Group by this categorical variable in adata.obs.

target_col : strstr (default: 'clone_id')

Column in adata.obs containing the clonotype information.

clip_at : intint (default: 3)

All entries in target_col with more copies than clip_at will be summarized into a single group.

expanded_in : str | NoneOptional[str] (default: None)

Calculate clonal expansion within groups. To calculate expansion within patients, set this to the column containing patient annotation. If set to None, a clonotype counts as expanded if there’s any cell of the same clonotype across the entire dataset. See also Public clonotype.

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 clonotype to count clonotypes. The former leads to a over-representation of expanded clonotypes but better represents the fraction of expanded cells.

normalize : boolbool (default: True)

If True, compute fractions rather than reporting abosolute numbers.

show_nonexpanded : boolbool (default: True)

Whether or not to show the fraction of non-expanded cells/clonotypes

viztype : {‘bar’, ‘barh’}Literal[‘bar’, ‘barh’] (default: 'bar')

bar for bars, barh for horizontal bars.

**kwargs

Additional arguments passed to scirpy.pl.base.bar()