mantispy.pp.annotate_controls#

mantispy.pp.annotate_controls(adata, negcon=('DMSO',), poscon=None, perturbation_key=None, copy=False)[source]#

Mark negative (and optionally positive) controls.

Parameters:
adata AnnData

Object to annotate.

negcon Sequence[str] (default: ('DMSO',))

Perturbation values that are negative controls.

poscon Sequence[str] | None (default: None)

Perturbation values that are positive controls, if any.

perturbation_key str | None (default: None)

Column holding the perturbation, auto-detected from PERTURBATION_KEYS when omitted.

copy bool (default: False)

Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy when copy=True. Writes obs["Metadata_Control_Type"] and the boolean obs["Metadata_Control"] it implies (True for any control). Steps defaulting to reference="negcon" read the type column, so the negcon rows are selected by it alone.

Notes

The classes named here are authoritative: rows matching negcon become "negcon" and earlier "negcon" rows that no longer match become treatments, and likewise for poscon when it is given. Every other class an upstream annotation set, such as "poscon" or "empty" wells from a plate map or annotate_jump(), is kept.