netmap.masking.internal.add_cluster_based_candidate_edges¶
- netmap.masking.internal.add_cluster_based_candidate_edges(grn_adata, cluster_column='leiden_remap', threshold=0.5)[source]¶
Annotate edges with per-cluster mask support fractions and candidacy flags.
For each Leiden cluster, computes the fraction of cluster cells in which the edge mask is 1, adds a
{cluster}_nonzerocolumn, and marks an edge as a candidate ({cluster}_candidate_edge = True) when support exceedsthreshold. A globalcandidate_edgecolumn summing candidacies across clusters is also added.- Parameters:
grn_adata (anndata.AnnData) – GRN AnnData with
layers['mask']andvar['count_nonzero'].cluster_column (str) – Column in
grn_adata.obswith cluster labels. Defaults to'leiden_remap'.threshold (float) – Minimum mask support fraction for an edge to be a candidate. Defaults to 0.5.
- Returns:
grn_adatawith per-cluster and global candidacycolumns added to
.var.
- Return type: