netmap.downstream.regulon.select_top_edges_signed

netmap.downstream.regulon.select_top_edges_signed(gene_inter_adata, top_per_source=10, col_cluster='leiden_remap', min_reg_size=10, verbose=True, tf_column=None, min_edge_support=0.5, neutral_threshold=0.05)[source]

Select top edges per source TF per cluster and split them into positive and negative regulons based on cluster-wise Spearman correlation.

Requires add_cluster_wise_spearman to have been called first so that {cluster}_spearman columns are present in gene_inter_adata.var.

Positive regulons contain edges with Spearman >= neutral_threshold, ranked by highest mean attribution. Negative regulons contain edges with Spearman <= -neutral_threshold, ranked by most negative mean attribution. Edges with |spearman| < neutral_threshold are excluded.

Parameters:
  • gene_inter_adata (anndata.AnnData) – GRN AnnData with mask layer and ‘{cluster}_spearman’ columns in .var.

  • top_per_source (int) – Maximum edges per source TF per sign group per cluster.

  • col_cluster (str) – Cluster column in obs.

  • min_reg_size (int) – Minimum edges a sign-group must have to be kept.

  • verbose (bool) – Print progress.

  • tf_column (str or None) – var column flagging TF rows; restricts sources to TFs.

  • min_edge_support (float) – Minimum mask support fraction required per edge.

  • neutral_threshold (float) – Edges with |spearman| < this value are excluded.

Returns:

{‘unique’: {cluster: {‘positive’: …, ‘negative’: …}},

’all’: {cluster: {‘positive’: …, ‘negative’: …}}}

Return type:

dict