mantispy.tl.pathway_coherence#
- mantispy.tl.pathway_coherence(adata, net, gene_key='Metadata_Gene', metric='cosine', use_rep=None, min_genes=5, n_permutations=1000, seed=0, key_added='pathway_coherence', copy=False)[source]#
Score how similar the profiles of each gene set’s genes are.
For each set, the mean pairwise similarity among the profiles of its genes is compared with random sets of the same number of profiles. This checks whether a genetic screen recovers known biology.
- Parameters:
- adata
AnnData One profile per gene, normally the output of
consensus().- net
DataFrame A gene-set network from
gene_set_network(), or any frame withsourceandtarget.- gene_key
str(default:'Metadata_Gene') obscolumn holding the gene symbol.- metric
str(default:'cosine') Similarity between profiles,
"cosine"or"pearson".- use_rep
str|None(default:None) Measure in
obsm[use_rep]instead ofX.- min_genes
int(default:5) Sets with fewer of their genes present in the screen are skipped.
- n_permutations
int(default:1000) Number of random sets in the null.
- seed
int(default:0) Seed for drawing the random sets.
- key_added
str(default:'pathway_coherence') Name for the output table.
- 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]withset,n_genes,coherence,pvalueandqvalue, sorted by coherence.- Raises:
KeyError –
obshas no columngene_key.
Notes
Rank sets by coherence rather than by p-value. With 1000 permutations every strongly coherent set reaches the p-value floor of 1/1001 and ties there. The p-value shows whether a set is coherent, and the coherence orders the sets that are.