mantispy.tl.rank_features

Contents

mantispy.tl.rank_features#

mantispy.tl.rank_features(adata, groupby, method='wilcoxon', key_added='rank_features', copy=False)#

Rank features by how well they separate each group, with the annotation attached.

Wraps scanpy.tl.rank_genes_groups() and joins the parsed var annotation onto the result, so each ranked feature carries its object, feature group and channel.

Parameters:
  • adata (AnnData) – Object to rank.

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

  • method (str (default: 'wilcoxon')) – Passed to scanpy: "wilcoxon", "t-test", "logreg".

  • key_added (str (default: 'rank_features')) – 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, feature, score, pvalue, qvalue and the object, feature_group and channel the feature belongs to.

Notes

scanpy’s logfoldchanges column is dropped. Normalized morphology features are signed, so the ratio is often negative and its log is NaN or meaningless. Rank by score.