tangram.mapping_utils.adata_to_cluster_expression
- tangram.mapping_utils.adata_to_cluster_expression(adata, cluster_label, scale=True, add_density=True)
Convert an AnnData to a new AnnData with cluster expressions. Clusters are based on cluster_label in adata.obs. The returned AnnData has an observation for each cluster, with the cluster-level expression equals to the average expression for that cluster. All annotations in adata.obs except cluster_label are discarded in the returned AnnData.
- Parameters
adata (AnnData) – single cell data
cluster_label (String) – field in adata.obs used for aggregating values
scale (bool) – Optional. Whether weight input single cell by # of cells in cluster. Default is True.
add_density (bool) – Optional. If True, the normalized number of cells in each cluster is added to the returned AnnData as obs.cluster_density. Default is True.
- Returns
aggregated single cell data
- Return type
AnnData