mantispy.tl.network_enrichment#
- mantispy.tl.network_enrichment(adata, similarity_key='similarity', edges=None, gene_key='Metadata_Gene', top_quantile=0.95, key_added='network_enrichment', copy=False)[source]#
Test the most-similar perturbation pairs for enrichment of known interactions.
- Parameters:
- adata
AnnData Object whose
obsp[similarity_key]holds a pairwise similarity, fromsimilarity(), and whoseobs[gene_key]names each profile’s gene.- similarity_key
str(default:'similarity') obspkey holding the pairwise similarity matrix.- edges
DataFrame|None(default:None) A two-column frame of reference gene pairs. Its first two columns are read as the pair, in any order. Defaults to
mantispy.ds.interactions()(CORUM within-complex pairs).- gene_key
str(default:'Metadata_Gene') obscolumn holding the gene symbol.- top_quantile
float(default:0.95) Quantile of the off-diagonal similarity above which a pair counts as a top pair. The default 0.95 takes the top 5%.
- key_added
str(default:'network_enrichment') Name for the output.
- copy
bool(default:False) Return a modified copy instead of mutating in place.
- adata
- Return type:
- Returns:
None, or the modified copy. Writesuns["mantispy"][key_added]with the 2x2 contingencytable(top vs not, known vs not),odds_ratioandpvalue(a one-sided Fisher exact test), thethresholdsimilarity, and the pair countsn_top,n_knownandn_pairs.- Raises:
KeyError –
obsphas nosimilarity_key, orobshas nogene_key.ValueError –
top_quantileis outside (0, 1), or the object has fewer than two annotated profiles.
Notes
Only pairs whose two profiles both carry a gene are counted, so control wells with no gene are left out of the universe. The default reference needs the network on its first call to build the pinned CORUM snapshot; pass
edgesto avoid any fetch, or to test against a real protein-protein network.