mantispy.tl.cell_cycle_phase

mantispy.tl.cell_cycle_phase#

mantispy.tl.cell_cycle_phase(adata, dna_feature=None, by='Metadata_Plate', layer=None, key_added='Metadata_CellCyclePhase', copy=False)#

Assign G1, S or G2M from integrated DNA intensity.

A two-component Gaussian mixture is fitted to log DNA intensity within each by group. The lower component is G1 and the upper is G2M. Cells that neither component claims with probability above 0.9 are called S.

Parameters:
  • adata (AnnData) – Single-cell object holding raw, unnormalized intensities.

  • dna_feature (str | None (default: None)) – The integrated DNA intensity feature. Found from the feature names and var["channel"] when omitted.

  • by (str | None (default: 'Metadata_Plate')) – Fit separately within each group, normally the plate, since staining intensity does not carry across plates.

  • layer (str | None (default: None)) – Read this layer instead of X, for example "raw" after normalize(keep_raw=True).

  • key_added (str (default: 'Metadata_CellCyclePhase')) – 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 PHASES.

Raises:
  • KeyErrordna_feature was not given and no integrated DNA intensity feature could be found.

  • ValueError – More than 5% of the feature’s values are not positive, so their log cannot be fitted.

Notes

This is a heuristic. It needs a well-resolved DNA stain and enough cells per group (a group with fewer than 20 usable cells is left as S), and it cannot tell G0 from G1. It also needs raw intensities, because after normalize() the values are z-scores and about half are negative. Check the result before relying on it.