c2v.pl.nesting_clones

Contents

c2v.pl.nesting_clones#

c2v.pl.nesting_clones(adata, early_injection, late_injection, min_clone_size=5, non_clonal_str='NA', show=True, figsize=None, ax=None, return_fig=False)#

Plot ternary composition of clones labeled by two different injections.

In ideal clonal reconstructions, smaller clones from a later injection should nest within larger clones from an earlier injection — resembling a “Russian doll” pattern. This function visualizes the composition of shared and unique cells across early and late injections using a ternary plot.

Parameters:
adata AnnData

Annotated data matrix with clonal labels in .obs.

early_injection str

Column name in .obs containing clone IDs from the early injection.

late_injection str

Column name in .obs containing clone IDs from the late injection.

min_clone_size int, optional

Minimum number of cells required for a clone to be included in the plot. Default is 5.

non_clonal_str str, optional

Value representing unlabelled or non-clonal cells. Default is “NA”.

show bool, optional

Whether to show the plot. Default is True.

figsize tuple[float, float] | None, optional

Figure size. Default is None.

return_fig bool, optional

Whether to return the figure. Default is False.

ax Axes | None

Return type:

Figure | Axes | None

Returns:

None or matplotlib.figure.Figure or matplotlib.axes.Axes Returns Figure if return_fig is True, or ax if return_ax is True.