mantispy.tl.feature_signature#
- mantispy.tl.feature_signature(adata, key='differential', by=('feature_group', 'channel', 'object'), statistic='t')[source]#
Collapse a differential table into a perturbation-by-feature-family matrix.
- Parameters:
adata (
AnnData) – Object carryinguns["mantispy"][key], as written bydifferential_features().key (
str(default:'differential')) – Which table to collapse.by (
Sequence[str] (default:('feature_group', 'channel', 'object'))) –varcolumns 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:
- Returns:
A new
AnnDataof perturbations by families, with each family’sbycolumns andn_featuresinvar, beside the schema’s remaining annotation columns, left empty because a family is not a measurement they describe. Abycolumn carries the family’s own value, in the dtypevarheld it in; the"none"that names a family whose features had no value appears in the family’s name, not in the column. It is a perturbation-level profile object, soneighbors(),leiden()andnn_moa_classify()accept it.- Raises:
KeyError –
uns["mantispy"][key]is missing, that table has nostatisticcolumn, orvaris missing one of thebycolumns.ValueError –
bynames the same column more than once, which would give one family two copies of a component; everybycolumn is empty, so there is no family to name; or two different sets of values name the same family.
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 onIntensity | CorrActin | Nucleiwith no tubulin signal; as the microtubules come apart the cells round up, which is the largest remaining change.