from spidepy.datasets import simulate_niche
adata = simulate_niche(n_samples=4, n_per=50, seed=1)
adata.shape(200, 20)
Synthetic spatial data set with a condition-free neighbourhood effect.
Port of spiDE’s internal .toyNiche() (dropped from R in c8db60a; kept here). Like simulate_toy, but gene G1 in index cell type “A” rises with the local density of niche cell type “B” in every cell, and there is no condition column, so it can only be analysed in the condition-free mode. The generative model is R’s; the random draws are not (numpy vs Mersenne-Twister), and the global numpy RNG is not touched.
| Name | Type | Description | Default |
|---|---|---|---|
| n_samples | int | Number of samples; as in simulate_toy. |
6 |
| n_per | int | Cells per sample; as in simulate_toy. |
80 |
| n_genes | int | Number of genes; as in simulate_toy. |
20 |
| field | float | Side length of the square spatial field; as in simulate_toy. |
500 |
| sd_lib_sample | float | Log-scale SD of the sample-level library-size term; as in simulate_toy. |
0.15 |
| sd_lib_celltype | float | Log-scale SD of the cell-type-level library-size term; as in simulate_toy. |
0.35 |
| beta | float | Effect size of the planted B-niche association on G1 in A cells. | 2.5 |
| seed | int | Seed of the numpy.random.default_rng used for every draw. |
1 |
| Name | Type | Description |
|---|---|---|
| anndata.AnnData | As simulate_toy but obs has no condition column. |
simulate_toy : The version with a condition-specific effect.
(200, 20)