campmc.mt.quality#
- campmc.mt.quality(adata, *, partition_key='camp', label_key=None, use_rep='X_pca')[source]#
Compute per-metacell quality metrics.
Metrics include compactness and separation on the diffusion map, an INV (intra-metacell variability) score, and optionally purity / label entropy when
label_keyis provided.- Parameters:
- adata
AnnData Annotated data with metacell labels in
obs[partition_key].- partition_key
str(default:'camp') Column in
adata.obsholding metacell assignments.- label_key
str|None(default:None) Optional cell-type (or other) labels for purity and entropy.
- use_rep
str(default:'X_pca') Representation used to compute neighbors / diffusion map when
X_diffmapis not already present.
- adata
- Return type:
- Returns:
DataFrame One row per metacell with columns such as
size,compactness,separation,sc_ratio,INV, and optionallypurity/label_entropy.
Examples
import campmc as cp import scanpy as sc adata = sc.datasets.pbmc68k_reduced() cp.partition(adata, method="camp3", gamma=50, random_state=0) qc = cp.mt.quality(adata, partition_key="camp", label_key="louvain") qc[["metacell_id", "size", "purity", "sc_ratio"]].head()
metacell_id size purity sc_ratio 0 seed0-50-__all__ 65 0.984615 4.415655 1 seed1-50-__all__ 34 0.911765 10.381738 2 seed10-50-__all__ 3 0.666667 2.374693 3 seed11-50-__all__ 158 0.708861 2.823893 4 seed12-50-__all__ 42 0.809524 1.641697