netmap.downstream.edge_selection.add_top_edge_annotation_cluster¶
- netmap.downstream.edge_selection.add_top_edge_annotation_cluster(grn_adata, top_edges=[0.1], nan_fill=0, cluster_var='spectral')[source]¶
Annotate
grn_adata.varwith per-cluster top-edge cell counts.For each cluster in
grn_adata.obs[cluster_var], counts how many cells within that cluster include each edge among their top-N% highest-attribution edges. Results are merged intogrn_adata.varas new columns.Pass multiple values in
top_edgeswhen several thresholds are needed; sorting is performed only once regardless of how many thresholds are supplied.- Parameters:
grn_adata (anndata.AnnData) – GRN AnnData object to process.
top_edges (list of float) – Fractions of top edges to count. Defaults to
[0.1].nan_fill (int or float) – Value used to fill edges with no count at a given threshold/cluster combination. Defaults to 0.
cluster_var (str) – Column in
grn_adata.obsthat identifies cluster membership. Defaults to'spectral'.
- Returns:
grn_adatawith new columns added to.varnamed
'cell_count_{top_edge}_{cluster}'for every combination of threshold and cluster.
- Return type: