scib.metrics.graph_connectivity

scib.metrics.graph_connectivity(adata, label_key)

Graph Connectivity

Quantify the connectivity of the subgraph per cell type label. The final score is the average for all cell type labels \(C\), according to the equation:

\[GC = \frac {1} {|C|} \sum_{c \in C} \frac {|{LCC(subgraph_c)}|} {|c|}\]

where \(|LCC(subgraph_c)|\) stands for all cells in the largest connected component and \(|c|\) stands for all cells of cell type \(c\).

Parameters:
  • adata – integrated adata with computed neighborhood graph

  • label_key – name in adata.obs containing the cell identity labels

This function can be applied to all integration output types. The integrated object (adata) needs to have a kNN graph based on the integration output. See User Guide for more information on preprocessing.

Examples

# feature output
scib.pp.reduce_data(
    adata, n_top_genes=2000, batch_key="batch", pca=True, neighbors=True
)
scib.me.graph_connectivity(adata, label_key="celltype")

# embedding output
sc.pp.neighbors(adata, use_rep="X_emb")
scib.me.graph_connectivity(adata, label_key="celltype")

# knn output
scib.me.graph_connectivity(adata, label_key="celltype")