iscc.data.Visium ¶
Visium(count_model='dm', batch_label=None, n_reads=None, spot_pitch=None, spot_radius=None, mu_counts=None, sigma_counts=None, field_lengthscale=None, field_sigma=None, edge_sigma=None, diffusion_sigma=None, sigma_batch=None, ambient_frac=None, kappa=None, nb_dispersion=None, n_spots_x=None, n_spots_y=None, seed=42)
Bases: Assay
Visium spatial assay: lays spots over the section, aggregates cells, applies a VisiumBatch.
Any hyper-parameter below can be overridden explicitly (None keeps the default, which
is calibrated to a real 10x Visium section). Legacy aliases are accepted: n_reads maps
onto mu_counts, and a spot grid requested via n_spots_x / n_spots_y derives
spot_pitch from grid_side at run time. The number of spots (and cells per spot)
follows from grid_side (passed to run) and the sampled cell_data, so there is
no n_cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count_model
|
str
|
Final count-emission model: |
"dm"
|
batch_label
|
str
|
Section/batch label; defaults to |
None
|
n_reads
|
float
|
Legacy alias for |
None
|
spot_pitch
|
float
|
Spot centre-to-centre spacing (coordinate units); sets spot density / number of spots.
Overridden at run time if |
2.0
|
spot_radius
|
float
|
Spot capture radius: cells within this distance of a spot centre are pooled into it (~1-10 cells / spot). |
1.0
|
mu_counts
|
float
|
Mean per-spot library size (total UMIs / spot); |
20000.0
|
sigma_counts
|
float
|
Per-spot library-size LogNormal sd (spot-to-spot depth variation). |
0.45
|
field_lengthscale
|
float
|
Spatial autocorrelation length of the capture-efficiency field (the squared-exponential GP length-scale, in coordinate units); larger -> smoother field -> higher Moran's I. |
18.0
|
field_sigma
|
float
|
Capture-field strength (log-space sd of the smooth positive field); 0 -> flat field (no spatial capture bias). |
0.70
|
edge_sigma
|
float
|
Tissue-boundary capture falloff: the very edge of the section is reduced by this fraction, the interior stays ~1. 0 disables; a value < 1 keeps efficiency positive. |
0.30
|
diffusion_sigma
|
float
|
Lateral mRNA-bleed Gaussian kernel sd, spreading each spot's expression into its neighbours before counting; 0 disables (no bleed). |
0.0
|
sigma_batch
|
float
|
Per-gene batch-factor LogNormal sd, shared across spots (Splatter |
0.10
|
ambient_frac
|
float
|
Fraction of each spot's library drawn as ambient "soup" contamination. |
0.05
|
kappa
|
float
|
Dirichlet-multinomial concentration (only for |
50.0
|
nb_dispersion
|
float
|
Negative-binomial overdispersion phi ( |
0.30
|
n_spots_x
|
int
|
Legacy alias: request a fixed spot-grid width. When both |
None
|
n_spots_y
|
int
|
Legacy alias: request a fixed spot-grid height (see |
None
|
seed
|
int
|
RNG seed. Fixes the technical signature (per-gene batch factor, spatial capture field, per-spot depth) and is reproducible. |
42
|
Methods:
| Name | Description |
|---|---|
run |
Assay a 10x Visium spatial-transcriptomics section over the sampled cells. |
run ¶
Assay a 10x Visium spatial-transcriptomics section over the sampled cells.
Lays out a grid_side x grid_side grid of spots, pools each spot's
cells, applies lateral mRNA diffusion and a smooth spatial capture field, and
draws per-spot UMI counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_data
|
dict
|
Per-cell ground-truth tables from the sampling stage; uses the expression
table |
required |
grid_side
|
int
|
Number of spots along each side of the (square) section. |
required |
Returns:
| Type | Description |
|---|---|
Visium
|
|
Technology presets¶
| Platform | Parameters | Notes |
|---|---|---|
| 10x Visium | defaults (spot_pitch = 2, spot_radius = 1, mu_counts ≈ 20000) |
~55 µm spots, ~1–10 cells / spot. |
| Visium HD | smaller spot_pitch / spot_radius, lower mu_counts |
High-resolution (near-single-cell): many more, smaller spots. |