For the complete documentation index, see llms.txt. This page is also available as Markdown.

Spatial slide display

Display Visium spots on a slide colored by metadata, gene expression, cell type deconvolution, or spatial colocalization.

Display Visium spots on a slide colored by metadata, gene expression, cell type deconvolution, or spatial colocalization.

Spots coloured by categorical metadata

Description

Analysis summary

Shows each Visium spot on the slide coloured by a categorical metadata column such as tumour region, pathologist annotation, or dominant cell type. Useful to see where categorical features sit on the tissue.

Computation

Each spot is placed at its slide coordinates and coloured by its category from the value column; the data is displayed as-is, with no transformation. The analysis also computes spatial statistics: each category is tested in turn — its Moran's I over the spots carrying it, with z-score, p-value and Benjamini-Hochberg-adjusted q-value across the categories — on a spot adjacency within a two-spot radius, telling whether that category's spots cluster spatially or scatter. The descriptive stats add the spot count per category.

When to use

Use for where-is-it questions on categorical annotations: tumor region, cell type annotation, pathologist annotation, dominantcelltype_cohort_level_2, or any categorical metadata column.

Caveats

One slide per run: with several sample_ids the analysis keeps the first (alphabetical) and reports a note — run it once per sample to see each slide.

Example questions

example questions
  • Spatial slide display colored by metadata variable

Input columns

input columns
column
type
required
description

spot_id

any

required

Spot identifier shown in the hover tooltip.

spatial_1

numeric

required

Raw (unscaled) x-coordinate of the spot.

spatial_2

numeric

required

Raw (unscaled) y-coordinate of the spot.

tissue_hires_scalef

numeric

required

Scale factor used to convert raw coordinates to image coordinates.

spot_diameter_fullres

numeric

required

Spot diameter in full-resolution image pixels; used to size spot circles.

hires_image_path

any

required

File-system or S3 path to the high-resolution H&E image.

alignment_status

any

required

Boolean — whether the H&E image has been aligned with the spot grid.

value

categorical, numeric

required

Value to color each spot by. Alias any metadata column or expression value to 'value' in SQL. String/categorical values trigger mode='categorical'; numeric val…

sample_id

any

required

Sample identifier. When multiple samples are present, the first (alphabetically) is selected and the others are discarded.

patient_id

categorical

required

Patient identifier required for population summary plots.

Visualizations

  • spt_slide_display How to read: One dot per Visium spot, placed at its raw slide coordinates over the H&E tissue image when the slide is aligned; dot colour is the spot's category, keyed by the legend titled with value_label. Read it as a map of where each categorical feature sits on the tissue. The accompanying statistics give, one row per category, that category's Moran's I with z-score, p-value and FDR-adjusted q-value — a significant positive score marks a category whose spots cluster spatially rather than scatter — plus the spot count per category.

Example analysis 1

Name — Tumor Region Distribution — PAT_B_099UHY7A

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — spt_slide_display

Tumor Region Distribution — PAT_B_099UHY7A

Output table

descriptive_stats (3 rows)
category
n

Stroma

1747

Tumor Edge

188

Tumor Islet

2845

statistical_tests (3 rows)
Test used for pairwise comparison
Group
Statistic
P-value
Adjusted P-value
Score

Moran's I test

value_Stroma

0.8518

Moran's I test

value_Tumor Edge

0.1417

Moran's I test

value_Tumor Islet

0.8299

Spots coloured by continuous value

Description

Analysis summary

Shows each Visium spot on the slide coloured by a continuous value such as gene expression or a signature score. Useful to see the spatial distribution of a quantitative measurement on the tissue.

Computation

Each spot is placed at its slide coordinates and coloured by its continuous value from the value column; the data is displayed as-is, with no transformation. The analysis also computes spatial statistics: Moran's I on the value — whether similar values form spatial patches — with its z-score and p-value, and, in the descriptive stats, the summary of the value distribution.

When to use

Use for spatial-distribution questions on quantitative values: log-normalized gene expression, a gene-signature score, or any continuous metadata value.

Caveats

One slide per run: with several sample_ids the analysis keeps the first (alphabetical) and reports a note — run it once per sample to see each slide.

Example questions

example questions
  • Spatial slide display colored by gene expression

Input columns

input columns
column
type
required
description

spot_id

any

required

Spot identifier shown in the hover tooltip.

spatial_1

numeric

required

Raw (unscaled) x-coordinate of the spot.

spatial_2

numeric

required

Raw (unscaled) y-coordinate of the spot.

tissue_hires_scalef

numeric

required

Scale factor used to convert raw coordinates to image coordinates.

spot_diameter_fullres

numeric

required

Spot diameter in full-resolution image pixels; used to size spot circles.

hires_image_path

any

required

File-system or S3 path to the high-resolution H&E image.

alignment_status

any

required

Boolean — whether the H&E image has been aligned with the spot grid.

value

categorical, numeric

required

Value to color each spot by. Alias any metadata column or expression value to 'value' in SQL. String/categorical values trigger mode='categorical'; numeric val…

sample_id

any

required

Sample identifier. When multiple samples are present, the first (alphabetically) is selected and the others are discarded.

patient_id

categorical

required

Patient identifier required for population summary plots.

Visualizations

  • spt_slide_display How to read: One dot per Visium spot over the H&E tissue image (when the slide is aligned), coloured on a Viridis gradient by the continuous value; the legend is titled with value_label. A smooth gradient tracks the measurement across the tissue; sharp patches mark locally elevated values. The accompanying statistics report Moran's I with its z-score and p-value — whether high values form spatial patches rather than scatter.

Example analysis 1

Name — ERBB2 expression — PAT_B_099UHY7A

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — spt_slide_display

ERBB2 expression — PAT_B_099UHY7A

Output table

descriptive_stats (1 rows)
n
n_zeros
mean_all
mean_non_zero
std_non_zero
p50_non_zero
max_non_zero

4780

1702

3.02

4.69

0.5807

4.735

6.888

statistical_tests (1 rows)
test
score
statistic
p_value

Moran's I test

0.3942

Pie-chart spots from cell-type deconvolution

Description

Analysis summary

Shows each Visium spot's cell-type deconvolution fractions, each spot rendered as a tiny pie chart. Useful for a one-glance view of cell-population composition across the tissue, including immune infiltration patterns.

Computation

Each spot's pie slices are its cell-type deconvolution fractions (cohort-level-2). The deconvolution columns are auto-detected — every column ending in the cohort-level-2 suffix — unless an explicit list is given. The analysis also computes composition statistics: per cell type, its mean deconvolution fraction across the slide's spots and the share of spots where it is the dominant type.

When to use

Use when asked about cell type distribution, immune infiltration, tumor-immune colocalization, or spatial distribution of cell populations.

Caveats

One slide per run: with several sample_ids the analysis keeps the first (alphabetical) and reports a note — run it once per sample to see each slide.

Example questions

example questions
  • Spatial slide display with per-spot cell type deconvolution pie charts

Input columns

input columns
column
type
required
description

spot_id

any

required

Spot identifier shown in the hover tooltip.

spatial_1

numeric

required

Raw (unscaled) x-coordinate of the spot.

spatial_2

numeric

required

Raw (unscaled) y-coordinate of the spot.

tissue_hires_scalef

numeric

required

Scale factor used to convert raw coordinates to image coordinates.

spot_diameter_fullres

numeric

required

Spot diameter in full-resolution image pixels; used to size spot circles.

hires_image_path

any

required

File-system or S3 path to the high-resolution H&E image.

alignment_status

any

required

Boolean — whether the H&E image has been aligned with the spot grid.

*_deconv_cohort_level_2_frac

numeric

required

Cell type deconvolution fraction columns (one per cell type). Each column is named after a cell type with the suffix '_deconv_cohort_level_2_frac' (for instanc…

sample_id

any

required

Sample identifier. When multiple samples are present, the first (alphabetically) is selected and the others are discarded.

patient_id

categorical

required

Patient identifier required for population summary plots.

Visualizations

  • spt_slide_display How to read: One tiny pie chart per Visium spot over the H&E tissue image (when the slide is aligned); each slice is a cell type's deconvolution fraction at that spot, coloured by the shared cell-type palette (cell_type_colors overrides it). Glance across the slide for composition gradients — immune-infiltration rims, tumour-dominated cores. The statistics table lists each cell type's mean fraction across spots and the share of spots where it is the dominant type.

Example analysis 1

Name — Cell Type Distribution in Tissue for PAT_B_099UHY7A

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — spt_slide_display

Cell Type Distribution in Tissue for PAT_B_099UHY7A

Output table

statistical_tests (first 10 of 13 rows)
cell_type
mean_fraction
dominant_spot_count
dominant_fraction

malignant

0.2984

2146

0.449

muscle

0.2852

1867

0.3906

fibroblast

0.1453

422

0.08828

momac

0.07316

11

0.002301

t_nk

0.04578

81

0.01695

plasma

0.0339

117

0.02448

endothelial

0.02938

33

0.006904

b_cell

0.0224

97

0.02029

mast

0.01566

1

0.0002092

granulocyte

0.01554

1

0.0002092

Spatial colocalization (LIANA+ bivariate)

Description

Analysis summary

Shows local spatial similarity between two features (gene-gene or gene-cell-type) on each Visium spot, computed by LIANA+'s bivariate analysis. High scores indicate neighbourhoods where the two features co-occur. Useful for spatial colocalization questions like 'are T cells and tumour cells colocalized here?'.

Computation

Computes LIANA+'s bivariate cosine similarity per spot between the two features — gene-gene (a second gene) or gene-vs-cell-type (a deconvolution fraction) — over the spot × gene expression matrix built on the Visium array grid, with a permutation test per spot; the long spot × gene input is then collapsed to one row per spot carrying its score. The stats table reports the mean association score across spots and the fraction of spots with a significant score (p < 0.05).

When to use

Use for spatial colocalization questions like 'are T cells and tumour cells colocalized here?' — gene-gene co-expression or gene-cell-type colocalization on a single slide.

Caveats

One slide per run: with several sample_ids the analysis keeps the first (alphabetical) and reports a note — run it once per sample to see each slide.

LIANA+ — the ligand-receptor / bivariate spatial analysis toolkit. Documentation: https://liana.readthedocs.io/en/stable/ — method paper: https://www.nature.com/articles/s41556-024-01469-w.

Example questions

example questions
  • Spatial slide display gene-gene colocalization

  • Spatial slide display gene-cell type colocalization

Input columns

input columns
column
type
required
description

spot_id

any

required

Spot identifier shown in the hover tooltip.

spatial_1

numeric

required

Raw (unscaled) x-coordinate of the spot.

spatial_2

numeric

required

Raw (unscaled) y-coordinate of the spot.

tissue_hires_scalef

numeric

required

Scale factor used to convert raw coordinates to image coordinates.

spot_diameter_fullres

numeric

required

Spot diameter in full-resolution image pixels; used to size spot circles.

hires_image_path

any

required

File-system or S3 path to the high-resolution H&E image.

alignment_status

any

required

Boolean — whether the H&E image has been aligned with the spot grid.

*_deconv_cohort_level_2_frac

numeric

required

Cell type deconvolution fraction columns (one per cell type). Each column is named after a cell type with the suffix '_deconv_cohort_level_2_frac' (for instanc…

gene_name

any

required

Gene name column. Include in the SELECT for mode='continuous' (gene expression) and mode='colocalization' (long-format, one row per spot × gene). Required for …

count_lognorm

numeric

required

Log-normalised gene expression value. Used to build the per-spot × gene expression matrix for LIANA+. Required for mode='colocalization'.

array_row

numeric

required

Spot array row index from Space Ranger. Used together with array_col to normalise spatial coordinates for LIANA. Required for mode='colocalization'.

array_col

numeric

required

Spot array column index from Space Ranger. Required for mode='colocalization'.

sample_id

any

required

Sample identifier. When multiple samples are present, the first (alphabetically) is selected and the others are discarded.

patient_id

categorical

required

Patient identifier required for population summary plots.

Visualizations

  • spt_slide_display How to read: One dot per Visium spot over the H&E tissue image (when the slide is aligned), coloured by the local colocalization score between the two features — high scores mark neighbourhoods where they co-occur. Hovering a spot gives the score and its permutation-based p-value. The statistics report the mean association score and the fraction of spots with p < 0.05.

Example analysis 1

Name — Spatial Co-expression of ERBB2 and TP53 — PAT_B_099UHY7A

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — spt_slide_display

Spatial Co-expression of ERBB2 and TP53 — PAT_B_099UHY7A

Output table

descriptive_stats (1 rows)
n
n_zeros
mean_all
mean_non_zero
std_non_zero
p50_non_zero
max_non_zero

4780

2261

0.3233

0.6135

0.2955

0.684

0.9835

statistical_tests (1 rows)
mean_sp_association
fraction_significant

0.3233

0.2117

Last updated

Was this helpful?