c2v.pp.clones_adata

Contents

c2v.pp.clones_adata#

c2v.pp.clones_adata(adata, obs_name='clone', min_size=3, na_value='NA', fill_obs=None)#

Creates a clone-level AnnData object from a cell-level AnnData object.

This function identifies clones meeting a minimum size requirement and, if specified, calculates their cellular composition (e.g., by cell type).

Parameters:
adata AnnData

The cell-level annotated data matrix.

obs_name str, optional

Column in adata.obs containing clonal information, by default “clone”.

min_size int, optional

Minimum clone size to be considered, by default 3.

na_value str, optional

Value indicating the absence of clonal information, by default “NA”.

fill_obs str | None, optional

Column in adata.obs (e.g., ‘cell_type’) to calculate clone composition, by default None.

Return type:

AnnData

Returns:

AnnData A new AnnData object where each observation is a clone. The .X matrix and .layers[‘proportions’] store composition proportions, and .layers[‘counts’] stores raw counts. The .obs[‘n_cells’] column contains the number of cells per clone.