mantispy.pl.control_drift

Contents

mantispy.pl.control_drift#

mantispy.pl.control_drift(adata, groupby='Metadata_Plate', n_components=2, ax=None)[source]#

Control wells projected onto principal components fitted on the controls alone.

Fitting on the controls alone shows how the reference moves between plates or batches, which is the drift normalization should remove.

Parameters:
  • adata (AnnData) – Object whose obs["Metadata_Control"] marks the wells to draw.

  • groupby (str (default: 'Metadata_Plate')) – obs column that colors the control wells, normally the plate or the batch.

  • n_components (int (default: 2)) – Components fitted on the controls. The first two are the ones drawn.

  • 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 one scatter per group of groupby in the space of the first two control components.

Raises:
  • KeyError – obs has no Metadata_Control column to select the controls with, or no groupby column.

  • ValueError – n_components is below the two that are drawn, or there are that many control rows or fewer, too few to fit them.