spatialvi.data.synthetic_spatial

spatialvi.data.synthetic_spatial#

spatialvi.data.synthetic_spatial(n_cells=1000, n_genes=200, n_cell_types=5, n_batches=1, spatial_dims=2, spatial_scale=100.0, library_size_mean=10000, library_size_std=3000, dropout_rate=0.3, seed=None)[source]#

Generate synthetic spatial transcriptomics data.

Creates an AnnData object with: - Count matrix with cell type-specific expression patterns - Spatial coordinates - Cell type labels - Optional batch labels

Parameters:
  • n_cells (int) – Number of cells to generate.

  • n_genes (int) – Number of genes.

  • n_cell_types (int) – Number of cell types.

  • n_batches (int) – Number of batches.

  • spatial_dims (int) – Number of spatial dimensions (2 or 3).

  • spatial_scale (float) – Scale of spatial coordinates.

  • library_size_mean (float) – Mean library size.

  • library_size_std (float) – Standard deviation of library size.

  • dropout_rate (float) – Rate of dropout (zero inflation).

  • seed (int | None) – Random seed for reproducibility.

  • n_cells (int)

  • n_genes (int)

  • n_cell_types (int)

  • n_batches (int)

  • spatial_dims (int)

  • spatial_scale (float)

  • library_size_mean (float)

  • library_size_std (float)

  • dropout_rate (float)

  • seed (int | None)

Return type:

AnnData

Returns:

AnnData object with synthetic spatial data.