mantispy.tl.dna_content#
- mantispy.tl.dna_content(adata, dna_feature=None, by=('Metadata_Plate', 'Metadata_Well'), layer=None, min_cells=50, reference=None, key_added='Metadata_DNAContent', copy=False)[source]#
DNA content of each cell, in doublings of the G1 peak of its group.
The integrated DNA intensity is log2-transformed, and the G1 (2N) peak of each
bygroup is subtracted. A cell with a 2N genome then sits near 0 and a cell with a 4N genome near 1, whatever the staining intensity of its well.- Parameters:
- adata
AnnData Single-cell object holding raw, unnormalized intensities.
- dna_feature
str|None(default:None) The integrated DNA intensity feature. Found when omitted as an integrated intensity, not its edge, whose name or
var["channel"]names DNA, DAPI or Hoechst, theNuclei_one first.- by
Sequence[str] |str|None(default:('Metadata_Plate', 'Metadata_Well')) Find the G1 peak separately within each group, normally the well, since staining intensity does not carry across wells.
- layer
str|None(default:None) Read this layer instead of
X, for example"raw"afternormalize(keep_raw=True).- min_cells
int(default:50) A group with fewer usable cells than this, or fewer
referencecells when given, gets no G1 peak, and its cells getNaN.- reference
str|None(default:None) Find each group’s G1 peak on these cells only, and apply it to every cell of the group:
"negcon"for the negative controls, or the name of a booleanobscolumn.Noneuses every cell. Pass it when a treatment can arrest whole wells, so their peak is not taken for G1;bymust then group treated and control cells together, normally by plate, or by well in a pooled screen.- key_added
str(default:'Metadata_DNAContent') obscolumn written.- copy
bool(default:False) Return a modified copy instead of mutating in place.
- adata
- Return type:
- Returns:
None, or the modified copy. Writesobs[key_added], anduns["mantispy"]["dna_content"]with one row per group: thebycolumns,n_cells(the usable cells the peak was found on) andg1_peak(log2 of the integrated intensity at the G1 peak,NaNfor a group belowmin_cells).- Raises:
KeyError –
dna_featurewas 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 taken.
Notes
The G1 peak is the highest peak of a Gaussian kernel density estimate of the group’s log2 intensities. In a population mostly in G2, such as a well arrested in mitosis, the highest peak is the 4N one. So when a second peak lies one doubling below the highest, within a quarter of a doubling, and is at least a tenth as high, that lower peak is taken as G1. A sub-G1 peak of fragmented nuclei at half the G1 intensity would be mistaken for G1 by the same rule; check
g1_peakacross wells.The intensity is used as measured. CellProfiler’s integrated intensity carries no background subtraction, so a strong background lowers the ratio between the 4N and 2N peaks below two. Subtract it before calling this if your pipeline measured it.
A cell whose intensity is missing, zero or negative gets
NaN, as does every cell of a group belowmin_cells.A stain that does not resolve a 4N peak from the 2N one gives a single broad peak, and its mode is not a G1 peak. The content then still ranks cells by DNA, but
dna_state()gates do not mean 2N, S and 4N; look at the histogram first.