mantispy.tl.dna_state#

mantispy.tl.dna_state(adata, key='Metadata_DNAContent', cutoffs=(1.25, 1.75), key_added='Metadata_DNAState', copy=False)[source]#

Call each cell 2N, S or 4N from fixed gates on its DNA content.

Parameters:
adata AnnData

Single-cell object carrying the output of dna_content().

key str (default: 'Metadata_DNAContent')

obs column holding the DNA content, in doublings of the G1 peak.

cutoffs tuple[float, float] (default: (1.25, 1.75))

The lower and upper gate, in multiples of the G1 peak intensity. A cell below the lower gate is 2N, at or above the upper gate 4N, and in between S. The defaults sit a quarter of the way from each peak towards the other, the usual gates on a DNA content histogram.

key_added str (default: 'Metadata_DNAState')

obs column written.

copy bool (default: False)

Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes obs[key_added] as a categorical over DNA_STATES, NaN where the DNA content is NaN. Writes uns["mantispy"]["dna_state"] with the key read and the cutoffs applied, so the call can be reproduced.

Raises:
  • KeyError – obs has no column key.

  • ValueError – cutoffs is not two finite, positive, increasing values.

Notes

Fixed gates cannot tell G0 from G1, or a late-S cell from a G2 cell whose stain is a little dim. A cell above 4N, from polyploidy or a doublet, is called 4N.