mantispy.pl.moa_confusion

Contents

mantispy.pl.moa_confusion#

mantispy.pl.moa_confusion(adata, key='moa', normalize=True, ax=None)[source]#

The confusion matrix of nn_moa_classify(), as a heatmap.

With row normalization the diagonal is per-mechanism recall, and an off-diagonal block marks a pair of mechanisms the morphology does not separate. Such pairs usually have similar phenotypes.

Parameters:
  • adata (AnnData) – Object holding the confusion table nn_moa_classify() wrote.

  • key (str (default: 'moa')) – Name that run’s outputs were stored under, whose confusion table is key + "_confusion".

  • normalize (bool (default: True)) – Divide each row by its total, which turns the counts into per-mechanism recall.

  • ax (Axes | None (default: None)) – Axes to draw on, or None for a new figure.

Return type:

Axes | None

Returns:

The axes when the caller passed ax, else None because the plot then owns the figure it created. When returned they hold true against predicted mechanisms with the values printed when there are at most 400 cells, and the run’s scheme and accuracy in the title.

Raises:

KeyError – uns["mantispy"] holds no key + "_confusion" table.