mantispy.tl.rank_sets

Contents

mantispy.tl.rank_sets#

mantispy.tl.rank_sets(adata, groupby, score_key='score_ulm', key_added='rank_sets', copy=False)#

Rank feature sets by how far each group’s score sits from the rest.

Parameters:
  • adata (AnnData) – Object already scored by enrich().

  • groupby (str) – obs column defining the groups.

  • score_key (str (default: 'score_ulm')) – The obsm key written by enrich().

  • key_added (str (default: 'rank_sets')) – 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 group, set and score, the group’s mean enrichment score minus the mean over all other rows.

Raises:
  • KeyErrorobsm has no score_key.

  • ValueErrorgroupby has a single group, leaving nothing to rank it against.