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}_nonzero column, and marks an edge as a candidate ({cluster}_candidate_edge = True) when support exceeds threshold. A global candidate_edge column summing candidacies across clusters is also added.

Parameters:
  • grn_adata (anndata.AnnData) – GRN AnnData with layers['mask'] and var['count_nonzero'].

  • cluster_column (str) – Column in grn_adata.obs with 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_adata with per-cluster and global candidacy

columns added to .var.

Return type:

anndata.AnnData