mantispy.pp.correct_plate_position

mantispy.pp.correct_plate_position#

mantispy.pp.correct_plate_position(adata, method='median_polish', by='Metadata_Plate', reference=None, max_iter=10, tol=0.0001, key_added=None, copy=False)#

Remove row and column position effects, per plate and per feature.

Parameters:
  • adata (AnnData) – Object to correct, at cell or well resolution.

  • method (str (default: 'median_polish')) – Only "median_polish" (Tukey), which is robust to a few extreme wells.

  • by (str (default: 'Metadata_Plate')) – Column identifying the plate.

  • reference (str | None (default: None)) – Fit the row and column effects on these rows only. "negcon" is the usual choice, so that treatments laid out in particular columns are not absorbed into a column effect. None fits on every well.

  • max_iter (int (default: 10)) – Maximum number of median-polish iterations.

  • tol (float (default: 0.0001)) – Convergence tolerance of the median polish.

  • key_added (str | None (default: None)) – Write to layers[key_added] instead of overwriting X.

  • copy (bool (default: False)) – Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes X or layers[key_added], and the fitted effects per plate to uns["mantispy"]["plate_position"].

Raises:

ValueError – If method is unknown, or a plate holds no reference rows.

Notes

The polish is fitted on the well grid. At cell resolution each well is first reduced to its median, and the fitted effect is then subtracted from every cell of that well.