partipy.compute_archetype_expression#
- partipy.compute_archetype_expression(adata, layer=None, result_filters=None)#
Calculate a weighted average gene expression profile for each archetype.
This function computes the weighted average of gene expression across cells for each archetype. The weights should be based on the distance of cells to the archetypes, as computed by
calculate_weights.- Parameters:
adata (anndata.AnnData) – An AnnData object containing the gene expression data and weights. The weights should be stored in
adata.uns["AA_cell_weights"]keyed by the correspondingArchetypeConfig.layer (str, default
None) – The layer of the AnnData object to use for gene expression. IfNone,adata.Xis used. For Pareto analysis of AA data, z-scaled data is recommended.result_filters (Mapping[str, Any] | None, default
None) – Filters applied toArchetypeConfigentries to select the optimization configuration whose weights should be used.
- Return type:
DataFrame- Returns:
pd.DataFrame A DataFrame of shape (n_archetypes, n_genes) with weighted pseudobulk expression profiles.