netmap.downstream.regulon.get_sourcewise_jaccard_regulons

netmap.downstream.regulon.get_sourcewise_jaccard_regulons(all_signatures, keep_edges, n_top=50)[source]

Compute per-source-gene Jaccard similarity matrices across clusters.

For each cluster, retrieves the top n_top genes by Wilcoxon rank-sum score from all_signatures, then for each top source gene compares its target gene lists across all clusters using pairwise Jaccard similarity. Returns a square similarity matrix per source gene.

Note

This function references grn_adata3 and sc from the enclosing or module-level scope. This is a known code issue and is not changed here.

Parameters:
  • all_signatures (anndata.AnnData) – AnnData object storing Wilcoxon differential regulon results under the 'wilcoxon' key in .uns['rank_genes_groups']. Cluster labels are read from grn_adata3.obs.leiden_remap (module-level variable).

  • keep_edges (dict) – Nested regulon dict as returned by select_top_edges(), accessed via keep_edges['all'][cluster]['edges'].

  • n_top (int) – Number of top-ranked genes per cluster to consider. Defaults to 50.

Returns:

Mapping of source gene name to a square pd.DataFrame where both index and columns are cluster labels and values are Jaccard similarity scores. Only genes appearing in more than one cluster are included.

Return type:

dict