mantispy.tl.enrich_hits#

mantispy.tl.enrich_hits(adata, net, gene_key='Metadata_Gene', hit_key='hits_qvalue', threshold=0.05, key_added='enrich_hits', copy=False)[source]#

Test which gene sets are over-represented among the hits.

Parameters:
adata AnnData

One profile per gene, already scored by hit_calling().

net DataFrame

A gene-set network from gene_set_network().

gene_key str (default: 'Metadata_Gene')

obs column holding the gene symbol.

hit_key str (default: 'hits_qvalue')

obs column holding the q-value that defines a hit.

threshold float (default: 0.05)

q-value below which a gene counts as a hit.

key_added str (default: 'enrich_hits')

Name for the output table.

copy bool (default: False)

Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes uns["mantispy"][key_added] with set, odds_ratio (log, Haldane-Anscombe corrected) and qvalue, the Benjamini-Hochberg adjusted p-value of decoupler’s Fisher test.

Raises:
  • KeyError – obs has no gene_key or no hit_key.

  • ValueError – Every gene or no gene is a hit at threshold, so one side of the comparison is empty.

Notes

Over-representation is coarser than pathway_coherence(). It counts hits per set and ignores whether their phenotypes resemble each other. Sets that share many genes, such as the cell-cycle programs, are reported together.

The background is the set of genes measured in this screen. When almost every gene is a hit (190 of 193 on rohban2017), the result mostly reflects the library’s composition. In that case tighten threshold, or rank by phenotype strength instead.