mantispy.pp.well_qc#

mantispy.pp.well_qc(adata, min_cells=50, max_nan_fraction=0.1, max_control_cv=None, key='selected', copy=False)[source]#

Flag wells with too few cells, too much missing data, or unstable controls.

Parameters:
adata AnnData

Single-cell object to summarize per well.

min_cells int (default: 50)

Wells with fewer cells than this fail.

max_nan_fraction float (default: 0.1)

Wells missing more than this fraction of their values fail.

max_control_cv float | None (default: None)

For control wells only, the largest acceptable median coefficient of variation across features. None skips the check, which is the default because a sensible value depends on the assay.

key str | None (default: 'selected')

Restrict the statistics to features flagged by this boolean var column.

copy bool (default: False)

Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes uns["mantispy"]["well_qc"], a frame with the columns Metadata_Plate, Metadata_Well, n_cells, nan_fraction, control_cv and qc_well_pass, and broadcasts obs["qc_well_pass"].

Notes

The table keeps plate and well as columns because a MultiIndex in uns cannot be written to h5ad.

min_cells counts the rows of each well, so this belongs before aggregation. Run on profiles that are already one row per well every well has one row, fails min_cells, and the whole plate is flagged. At well resolution the equivalent is a threshold on obs["Metadata_CellCount"].