c2v.pp.transfer_expression#
- c2v.pp.transfer_expression(adata, clones, obs_name=None, split_obs=None, use_col=None, strategy='average', layer=None, use_raw=None, layers_to_obsm=None, mask_key='mask')#
Summarize gene expression at the clone level using a specified strategy (sum or average).
- Parameters:
- adata AnnData
Annotated data matrix at the cell level with gene expression data.
- clones AnnData
Annotated data matrix at the clone level.
- obs_name str, optional
Column name in adata.obs containing clonal information. If not provided, the value from clones.uns[“obs_name”] is used.
- split_obs str | None, optional
Column name in adata.obs to split the data for aggregation. If None, the entire dataset is used for aggregation, default None.
- strategy Literal["sum", "average"], optional
Strategy for aggregating gene expression (“sum” or “average”), by default “average”.
- layer str | None, optional
If specified, summarizes expression from adata.layers[layer], by default None.
- use_raw bool | None, optional
If specified, uses adata.raw.X for summarization, by default None.
- layers_to_obsm list[str] | str | None, optional
List of layers in clones.layers to transfer to clones_expr.obsm. If None, all layers with adata.X are transferred, by default None.
- use_col str | None
- mask_key str
- Return type:
AnnData- Returns:
AnnData Annotated data matrix at the clone level with summarized gene expression. The strategy used for aggregation is stored in clones.uns[“transfer_expression”][“strategy”]. If split_obs is provided, the aggregation is performed within each group defined by split_obs and stored in clones.layers[g] where g is the group name. Clones without a matching group in split_obs contain NaN values in this layer if absent_expression is “nan”, otherwise they contain zero expression.