mantispy.ds.synthetic_plate

mantispy.ds.synthetic_plate#

mantispy.ds.synthetic_plate(n_plates=1, n_wells=384, n_cells=200, n_features=60, channels=('DNA', 'ER', 'RNA', 'AGP', 'Mito'), n_perturbations=8, effect_size=1.0, n_images_per_well=1, n_batches=1, plate_effect=0.0, row_gradient=0.0, col_gradient=0.0, batch_effect=0.0, batch_rotation=0.0, confounder_effect=0.0, n_bad_images=0, n_correlated_pairs=0, n_constant_features=0, nan_fraction=0.0, seed=0)#

Generate a synthetic plate with known ground truth.

Every injected effect is recorded under uns["mantispy"]["truth"] so tests and tutorials can check that a method recovers it.

Parameters:
  • n_plates (int (default: 1)) – Number of plates.

  • n_wells (int (default: 384)) – Wells per plate.

  • n_cells (int (default: 200)) – Cells per well, or the Poisson mean of that count when confounder_effect is set.

  • n_features (int (default: 60)) – Number of features, before correlated copies are added.

  • channels (Sequence[str] (default: ('DNA', 'ER', 'RNA', 'AGP', 'Mito'))) – Channel vocabulary used to build feature names. Any names work.

  • n_perturbations (int (default: 8)) – Number of treatments; a DMSO negative control is always added.

  • effect_size (float (default: 1.0)) – Shift applied to the features affected by each perturbation.

  • n_images_per_well (int (default: 1)) – Fields of view per well, which sets Metadata_ImageNumber.

  • n_batches (int (default: 1)) – Plates are assigned round-robin to this many batches.

  • plate_effect (float (default: 0.0)) – Shift added to every feature, multiplied by the plate’s index.

  • row_gradient (float (default: 0.0)) – Shift added across the plate rows, for plate-position correction.

  • col_gradient (float (default: 0.0)) – Shift added across the plate columns, for plate-position correction.

  • batch_effect (float (default: 0.0)) – Standard deviation of a random per-batch offset added to every feature.

  • batch_rotation (float (default: 0.0)) – Strength of a random per-batch rotation of the first min(5, n_features) features.

  • confounder_effect (float (default: 0.0)) – Makes a fifth of the features scale with the well’s cell count.

  • n_bad_images (int (default: 0)) – Images given a degraded image-quality profile and noisier cells.

  • n_correlated_pairs (int (default: 0)) – Near-copies of existing features to add, for feature selection to remove.

  • n_constant_features (int (default: 0)) – Features set to a constant, for feature selection to remove.

  • nan_fraction (float (default: 0.0)) – Fraction of entries set to NaN.

  • seed (int (default: 0)) – Seed for reproducibility.

Return type:

AnnData

Returns:

An AnnData at cell resolution, carrying every injected effect under uns["mantispy"]["truth"], the channel vocabulary under channels and the per-image quality metrics under image_table.

Raises:

ValueErrorn_features needs more distinct names than channels can spell, or n_wells exceeds the largest standard plate format.