mantispy.tl.feature_signature

mantispy.tl.feature_signature#

mantispy.tl.feature_signature(adata, key='differential', by=('feature_group', 'channel', 'object'), statistic='t')#

Collapse a differential table into a perturbation-by-feature-family matrix.

Parameters:
  • adata (AnnData) – Object carrying uns["mantispy"][key], as written by differential_features().

  • key (str (default: 'differential')) – Which table to collapse.

  • by (Sequence[str] (default: ('feature_group', 'channel', 'object'))) – var columns whose combination names a family. The default is the feature group, the channel it was measured in, and the compartment it was measured on.

  • statistic (str (default: 't')) – Column of the table to average within each family, such as "t" or "difference" (the raw contrast).

Return type:

AnnData

Returns:

A new AnnData of perturbations by families, with each family’s by columns and n_features in var. It is a perturbation-level profile object, so sc.pp.neighbors, sc.tl.leiden and nn_moa_classify() accept it.

Raises:

KeyErroruns["mantispy"][key] is missing, that table has no statistic column, or var is missing one of the by columns.

Notes

Signed statistics are averaged, so a family that decreased stays distinct from one that increased. On BBBC021, microtubule stabilizers score +2.2 on Intensity|CorrTub|Nuclei, while destabilizers score +1.4 on Intensity|CorrActin|Nuclei with no tubulin signal; as the microtubules come apart the cells round up, which is the largest remaining change.