How is a 10x Visium tissue section represented in SpatialData, and what does one observation actually measure?
Which quality-control filters change this breast-cancer section, and by how much?
What evidence supports carrying one Leiden resolution forward rather than choosing a partition from its UMAP appearance?
What do Squidpy spatial statistics, CellTypist reference transfer and LIANA rankings establish about a tumour microenvironment, and what can they not establish?
Objectives:
Export the expression table from a Visium SpatialData object and inspect its dimensions
Evaluate count- and complexity-based quality-control metrics as distributions and mapped onto the histology
Apply spot and gene filters in sequence and quantify what each threshold removes
Execute normalisation, feature selection, dimensionality reduction and Leiden clustering on the non-regressed expression branch
Justify a Leiden resolution from partition stability and marker evidence rather than from appearance
Distinguish the Squidpy spatial-neighbour graph from the Scanpy expression-neighbour graph and interpret centrality, neighbourhood enrichment and Moran’s I
Appraise CellTypist and LIANA outputs for multicellular capture spots and state what each one does not establish
Breast tumours are mixtures of malignant epithelial cells, fibroblasts, vascular cells and infiltrating immune populations, and the location of those populations can be as informative as their expression state (Mehraj et al. 2021, Croizer et al. 2024). Spatial transcriptomics (ST) preserves that positional information, making it possible to ask whether expression programmes form coherent territories, meet at interfaces or avoid one another (Ståhl et al. 2016, Rao et al. 2021). Applied to breast tumours, the same approach has been used to show that regions of one tumour can differ enough to matter clinically (Wang et al. 2024).
This tutorial uses the 10x Genomics Human Breast Cancer, Block A Section 1 dataset 10x Genomics 2020. 10x Genomics obtained fresh-frozen invasive ductal carcinoma tissue, cryosectioned it at 10 µm onto a Visium Gene Expression slide and imaged the section with haematoxylin and eosin (H&E) before library preparation. The sample is described as AJCC/UICC Stage Group IIA, ER positive, PR negative and HER2 positive, and the section is annotated as containing ductal carcinoma in situ, lobular carcinoma in situ and invasive carcinoma. This tutorial uses the Space Ranger 1.1.0 release of the dataset, which reports 3,798 spots under tissue and quantifies 36,601 genes.
Figure 1: The H&E section as captured on the Visium slide. Every measurement in this tutorial comes from a capture spot positioned on this image, which is why results are checked against the histology at each stage.
The expression table entering this analysis contains 3,798 observations and 36,601 genes.
The unit of measurement matters throughout this tutorial. In the original 10x Genomics Visium Gene Expression platform, each observation represents a capture spot rather than a segmented cell. The spots are 55 µm in diameter, with 100 µm between their centres, and are arranged in a fixed hexagonal lattice. Depending on the cellular density and tissue architecture, a spot may capture RNA from approximately one to ten cells, although the number and composition vary between tissue regions (10x Genomics). Consequently, the expression profile of an individual spot can contain transcripts from several cell populations.
This distinction shapes how the results should be interpreted. Leiden clustering groups spots according to transcriptional similarity, using the expression-neighbour graph constructed by Scanpy. A Leiden group therefore represents an expression-defined group of capture spots, not necessarily a single cell type or a spatially continuous tissue compartment. Whether its members occupy coherent regions, occur at tissue interfaces or are distributed across the section must be investigated using their spatial coordinates and the histological image (Wolf et al. 2018, Palla et al. 2022).
The same caution applies to downstream annotation and interaction analysis. CellTypist compares each mixed spot expression profile with labelled single-cell references and assigns the closest reference category; this does not reveal the proportions or exact identities of the cells contributing RNA to that spot (Xu et al. 2023). LIANA uses expression associated with the selected Leiden groups to prioritise candidate ligand-receptor relationships, but these rankings do not demonstrate direct cellular contact, receptor activation or functional signalling (Dimitrov et al. 2022). Throughout this tutorial, biological interpretations are therefore based on the combined evidence from marker genes, spatial organisation, reference annotations and tissue morphology, while recognising the multicellular resolution of Visium.
Comment: Why this pipeline has no doublet detection and no deconvolution step
Two steps that are routine in single-cell tutorials are deliberately absent here, and both omissions follow from the size of a capture spot.
Doublet detection is not applicable. Tools such as Scrublet look for droplets that accidentally captured two cells, because in droplet-based single-cell RNA-seq a two-cell measurement is a technical artefact (Wolock et al. 2019). A Visium spot is multicellular by design, so flagging multicellular spots would discard valid data rather than clean it.
Deconvolution is not run. Methods such as cell2location and RCTD estimate the contributions of different cell populations to spatial transcriptomics measurements by using expression signatures derived from a single-cell or single-nucleus reference (Kleshchevnikov et al. 2022, Cable et al. 2022). An appropriate reference should represent the relevant tissue and cell populations, but it does not necessarily have to come from the same specimen.
Deconvolution is a separate analytical task requiring reference selection, compatibility checks and assessment of uncertainty. It is not included in this tutorial. Consequently, the Leiden groups below are interpreted as expression-defined tissue programmes, while CellTypist predictions are treated as closest reference matches rather than estimates of cell-type proportions.
The prepared SpatialData input and supporting analysis outputs are available from the Zenodo record. A reference Galaxy history provides a worked example of the analysis. Throughout the tutorial, reported dimensions, quality-control summaries, marker-gene rankings and spatial statistics provide checkpoints for interpreting the results generated at each stage. Comparing these outputs with the reference analysis helps assess reproducibility while keeping the biological interpretation grounded in the observed data.
Tools are frequently updated to new versions. Your Galaxy may have multiple versions of the same tool available. By default, you will be shown the latest version of the tool. This may NOT be the same tool used in the tutorial you are accessing. Furthermore, if you use a newer tool in one step, and try using an older tool in the next step… this may fail! To ensure you use the same tool versions of a given tutorial, use the Tutorial mode feature.
Open your Galaxy server
Click on the curriculum icon on the top menu, this will open the GTN inside Galaxy.
Navigate to your tutorial
Tool names in tutorials will be blue buttons that open the correct tool for you
Note: this does not work for all tutorials (yet)
You can click anywhere in the grey-ed out area outside of the tutorial box to return back to the Galaxy analytical interface
Warning: Not all browsers work!
We’ve had some issues with Tutorial mode on Safari for Mac users.
Try a different browser if you aren’t seeing the button.
Figure 2: The main path uses non-regressed log-normalised expression for PCA, transcriptomic neighbours and downstream analysis. The total-count regression branch is an optional PCA/QC comparison only.
Analysis stage
Question it answers
Main output
SpatialData input and extraction
How are Visium expression measurements, spot positions and tissue images represented together?
SpatialData object and extracted AnnData table
QC before filtering
How do total counts and detected genes vary across spots, and where are low-information spots located?
Per-spot QC metrics, distribution plots and spatial QC maps
Spot and gene filtering
How do the selected thresholds affect the numbers of spots and genes retained?
Filtered AnnData object and updated matrix dimensions
QC after filtering
How have filtering steps changed the QC distributions and spatial coverage of the tissue?
Recalculated QC metrics, distribution plots and spatial QC maps
Normalisation and HVG selection
How can differences in total counts be adjusted, and which genes are selected as highly variable?
Log-normalised AnnData, HVG annotations and variability plot
PCA and optional regression
How is PCA structure associated with total counts, and what changes after regressing out this covariate?
PCA on non-regressed expression and optional PCA after total-count regression
Expression graph, UMAP and Leiden
Which spots have similar expression profiles, and how do Leiden partitions change with resolution?
Expression-neighbour graph, UMAP embedding and alternative Leiden partitions
Marker gene ranking
Which genes distinguish the selected Leiden groups, and what tissue programmes do they suggest?
Wilcoxon-ranked gene table, marker plots and marker-based interpretation
Squidpy spatial analysis
How are Leiden groups organised across the tissue, and which genes show spatial autocorrelation?
Spatial-neighbour graph, centrality scores, neighbourhood enrichment, Moran’s I and gene-expression map
CellTypist reference annotation
Which adult-breast reference profiles most closely match the expression measured in each Visium spot?
Direct reference-label predictions, prediction scores and dot plot
LIANA ligand-receptor analysis
Which ligand-receptor pairs are ranked from expression profiles within and between Leiden groups?
Candidate ligand-receptor rankings stored in liana_res
SpatialData output
Where are the selected transcriptomic groups located on the tissue section?
Processed SpatialData object and Leiden-group overlay on the histology
Get the data
The tutorial starts from V1_Breast_Cancer_Block_A_Section_1.spatialdata.zip. SpatialData holds the histology image, the Visium spot geometry, the coordinate system relating them and the annotated expression table in a single object, so the alignment between expression and tissue survives every operation applied to it (Marconato et al. 2024).
Hands On: Data upload
Create a new Galaxy history and name it Visium breast cancer TME.
To create a new history simply click the new-history icon at the top of the history panel:
Click on galaxy-pencil (Edit) next to the history name (which by default is “Unnamed history”)
Type the new name
Click on Save
To cancel renaming, click the galaxy-undo “Cancel” button
If you do not have the galaxy-pencil (Edit) next to the history name (which can be the case if you are using an older version of Galaxy) do the following:
Click on Unnamed history (or the current name of the history) (Click to rename history) at the top of your history panel
Type the new name
Press Enter
Import the prepared SpatialData object from Zenodo:
Click galaxy-uploadUpload at the top of the activity panel
Select galaxy-wf-editPaste/Fetch Data
Paste the link(s) into the text field
Press Start
Close the window
Confirm that Galaxy assigns the datatype spatialdata.zip.
Click on the galaxy-pencilpencil icon for the dataset to edit its attributes
In the central panel, click galaxy-chart-select-dataDatatypes tab on the top
In the galaxy-chart-select-dataAssign Datatype, select spatialdata.zip from “New Type” dropdown
Tip: you can start typing the datatype into the field to filter the dropdown menu
Click the Save button
What the SpatialData object represents
Visium measures expression at printed capture spots rather than at segmented cells. This is the defining difference between sequencing-based spatial transcriptomics and the imaging-based platforms, such as Xenium, MERSCOPE and CosMx, which localise individual transcripts and assign them to cell boundaries drawn from a stain. Imaging-based data therefore arrive as cells with morphology measurements attached, while Visium data arrive as a fixed grid of multicellular areas. The trade-off runs the other way for gene coverage: Visium captures the whole polyadenylated transcriptome, whereas imaging platforms read a targeted panel.
Inside the object, that distinction appears in which elements exist. The capture spots are stored as shapes, circles of fixed radius registered to the tissue image, and the table holds the expression matrix and per-spot annotation. There is no labels element, because no segmentation was performed.
This tutorial starts from a prepared .spatialdata.zip object, so this section is not needed to follow the analysis. It is here because assembling that object is the step most often required when you bring your own Visium data, and the files that went into it are on the same record.
Space Ranger writes a spatial/ folder alongside the count matrix, and SpatialData IO reads the two together into a single object. Each input supplies a different part of it:
Space Ranger file
What it contributes
filtered_feature_bc_matrix.h5
The count matrix, restricted to barcodes Space Ranger judged to be under tissue
tissue_positions_list.csv
Array row and column, and the full-resolution pixel coordinates of every spot
scalefactors_json.json
Spot diameter in full-resolution pixels, and the factors that rescale coordinates onto the downsampled images
V1_Breast_Cancer_Block_A_Section_1_image.tif
The full-resolution H&E image
tissue_hires_image.png, tissue_lowres_image.png
Downsampled images used for most plotting
Import the data needed to build the SpatialData object from Zenodo:
Two details are worth knowing before you try this on your own data. The dataset identifier becomes the prefix of the image, shapes and coordinate-system names, so every later plotting step refers back to whatever you type here. And the filtered matrix, not the raw one, is the right input: the raw matrix contains all 4,992 printed spots including those outside the tissue, while the filtered matrix contains only the spots Space Ranger placed under tissue.
Finally, do not mix files from different Space Ranger versions of the same section. Reprocessing can change which spots are treated as under tissue and which reference annotation was used, so the counts will not match even though the histology is identical.
Extract the expression table
The Scanpy tools work on AnnData, the container that pairs an expression matrix with per-observation and per-gene annotation (Virshup et al. 2024), so the first analysis step pulls the table element out of the SpatialData object. The object itself stays in the history, because every spatial plot later in this tutorial needs it again.
Hands On: Export and inspect the AnnData table
SpatialData Operations ( Galaxy version 0.8.0+galaxy0) with the following parameters:
“Operation”: Export the table of a SpatialData object to anndata
“Table name”: table
Renamegalaxy-pencil the generated file Initial AnnData table.
Click on the galaxy-pencilpencil icon for the dataset to edit its attributes
In the central panel, change the Name field to Initial AnnData table
Click the Save button
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: Initial AnnData table
“What to inspect?”: General information about the object
Question: Check the dimensions before doing anything else
AnnData object with n_obs × n_vars = 3798 × 36601
What do the two numbers mean in a Visium experiment, and why should the first not be called a cell count?
n_obs is the number of capture-spot observations in this prepared table and n_vars is the number of genes. A Visium spot covers an area large enough to receive RNA from several cells, so 3,798 observations does not mean 3,798 cells.
Checking these dimensions before filtering also provides the denominator for every removal tally later in the tutorial.
Quality control before filtering
total_counts measures the amount of expression signal recorded for each spot, while n_genes_by_counts records how many distinct genes are detected. The pct_counts_in_top_N_genes columns show how concentrated the counts are in the most abundant genes. A spot with a small detected-gene set and low total counts may be poorly captured, but low RNA can also reflect a genuine tissue region, which is why the same metrics are inspected both as distributions and on the histology.
No mitochondrial or ribosomal gene set is defined here, and no threshold is applied to either. In single-cell work a high mitochondrial fraction flags a dying cell whose cytoplasmic RNA has leaked away. A Visium spot averages over several cells, so the same measurement no longer isolates a failing cell, and a region of genuinely stressed or hypoxic tumour would be penalised for its biology. The metrics below are all count- and complexity-based for that reason.
Hands On: Compute QC metrics
Scanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: Initial AnnData table
“Method used for inspecting”: Calculate quality control metrics, using 'pp.calculate_qc_metrics'
“Name of kind of values in X”: counts
“The kind of thing the variables are”: genes
“Proportions of top genes to cover”: 50,100,200,300
“Use ‘raw’ attribute of input if present”: No
“Compute log1p transformed annotations”: Yes
Renamegalaxy-pencil the generated file QC metrics before filtering.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics before filtering
“What to inspect?”: General information about the object
The scatter and violin plots show the distributions of sequencing depth and detected-gene complexity across spots. To obtain the numerical summaries behind these plots, export the observation annotations and calculate the minimum, median and maximum values for the two QC metrics.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics before filtering
“What to inspect?”: Key-indexed observations annotation (obs)
This exports one row per capture spot, including total_counts and n_genes_by_counts.
Query Tabular ( Galaxy version 3.3.2) with the following parameters:
In “Database Table”:
param-file“Tabular Dataset for Table”: the observation table from the previous Inspect AnnData ( Galaxy version 0.13.3+galaxy0) step
The output contains one summary row for the section. Compare the medians with the minimum and maximum values before choosing quality-control thresholds. A low count or detected-gene value may indicate reduced capture efficiency, but it may also reflect a tissue region with low RNA abundance or cellularity.
For this section the median total_counts is 20,761.5 and the median n_genes_by_counts is 6,026.5. Both distributions are wide: the minimum total count is 578, and the minimum number of detected genes is 430, the strongest 81,624 counts, and the most complex spot detects 10,153 genes. Those two tails are what the filters in the next section act on, and knowing where they sit is what makes a threshold a decision rather than a guess.
Hands On: Visualise QC metrics
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics before filtering
“Method used for plotting”: Generic: Scatter plot along observations or variables axes, using 'pl.scatter'
“x coordinate”: total_counts
“y coordinate”: n_genes_by_counts
“Color by”: pct_counts_in_top_50_genes
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics before filtering
“Method used for plotting”: Generic: Violin plot, using 'pl.violin'
“Keys for accessing variables”: Subset of variables in 'adata.var_names' or fields of '.obs'
“Keys for accessing variables”: n_genes_by_counts, total_counts
Figure 3: The number of detected genes increases with total counts, although the relationship is nonlinear as additional sequencing captures more transcripts from genes already detected.Open image in new tab
Figure 4: The distributions reveal variation in sequencing depth and detected-gene complexity across capture spots, including a tail of low-count observations.
The distributions show how unusual a spot is, but not where it sits. Before removing the tail, map the same QC fields back onto the section.
Hands On: Map the QC metrics onto histology
SpatialData Operations ( Galaxy version 0.8.0+galaxy0) with the following parameters:
Figure 5: Spatial distribution of total transcript counts across Visium spots, showing differences in RNA abundance throughout the tissue.Open image in new tab
Figure 6: Spatial distribution of detected-gene complexity across the section. Regions with higher complexity generally contain more distinct expressed genes.
Question: Interpret the QC output
Why is n_genes_by_counts expected to increase with total_counts but not in a perfectly linear way?
Why is a spatial map useful before removing a low-count tail?
The minimum is 578 counts, while the later count threshold is 1,000. Does that mean every spot below 1,000 is necessarily a technical failure?
As more transcripts are sampled, an increasing fraction are repeats of genes already detected, so the number of distinct genes does not grow one-for-one with the count total.
A low value can be technical, but it can also correspond to tissue with genuinely low RNA abundance or poor cellularity. A spatial map shows whether low values are scattered or associated with a coherent anatomical region that should be reported.
No. The threshold is a filtering decision made for this dataset, not a biological definition of failure. A spot below it may sit on sparse stroma or on a tear in the section, and the only way to tell is to look at where the removed spots were.
Filtering
Filtering proceeds in two stages: first the spots that carry too little signal to interpret, then the genes that are detected too rarely to contribute. Each step below takes the output of the previous one, and the object is inspected after each stage so that the effect of every threshold is visible rather than assumed.
Spot filters
Hands On: Remove spots with very low detected-gene complexity
Scanpy filter ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics before filtering
“Method used for filtering”: Filter cell outliers based on counts and numbers of genes expressed, using 'pp.filter_cells'
“Filter”: Minimum number of genes expressed
“Minimum number of genes expressed required for a cell to pass filtering”: 500
The tool label says cell because pp.filter_cells operates on AnnData observations, and Scanpy’s vocabulary comes from single-cell work. Here those observations are Visium spots. Both thresholds are applied before the object is inspected, so the count recorded below is their combined effect.
Hands On: Remove spots with very low total counts
Scanpy filter ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The filtered AnnData output from the previousScanpy filter ( Galaxy version 1.11.5+galaxy0)step
“Method used for filtering”: Filter cell outliers based on counts and numbers of genes expressed, using 'pp.filter_cells'
“Filter”: Minimum number of counts
“Minimum number of counts required for a cell to pass filtering”: 1000
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The filtered AnnData output from the previousScanpy filter ( Galaxy version 1.11.5+galaxy0)step
“What to inspect?”: General information about the object
Question: What did the second threshold add?
AnnData object with n_obs × n_vars = 3795 × 36601
How many spots have the two lower filters removed between them, what fraction of the starting observations is that, and why has the gene count not changed?
Together the two lower filters remove 3,798 − 3,795 = 3 spots, about 0.08% of the starting observations, so more than 99.9% are retained. The filters therefore trim a very small tail rather than removing a tissue compartment. The gene count is unchanged because pp.filter_cells acts on observations only; nothing about a gene’s detection has been tested yet.
Gene filters
Hands On: Remove genes detected in too few spots
Scanpy filter ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The filtered AnnData output from the previousScanpy filter ( Galaxy version 1.11.5+galaxy0)step
“Method used for filtering”: Filter genes based on number of cells or counts, using 'pp.filter_genes'
“Filter”: Minimum number of cells expressed
“Minimum number of cells expressed required for a gene to pass filtering”: 3
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The filtered AnnData output from the previousScanpy filter ( Galaxy version 1.11.5+galaxy0)step
“What to inspect?”: General information about the object
Question: Which gene filter changes the matrix?
AnnData object with n_obs × n_vars = 3795 × 22240
How many genes did this filter remove, and why is that number so much larger than the number of spots removed earlier?
The filter removes 14,361 genes, approximately 39% of the starting features, while the preceding spot filters remove only three observations. Many genes are detected in fewer than three retained spots, so excluding them reduces the number of sparsely observed features. This does not mean those genes are never expressed in breast tissue.
The complete filtering path is therefore:
Checkpoint
Filters applied since the previous row
Dimensions
Spots removed
Genes removed
Initial table
None
3,798 × 36,601
–
–
After spot filtering
min_genes = 500, min_counts = 1000
3,795 × 36,601
3
0
After gene filtering
min_cells = 3
3,795 × 22,240
0
14,361
The spot filters remove only 3 of 3,798 spots (0.08%), retaining almost the entire tissue section. The gene filter removes 14,361 of 36,601 genes (approximately 39%) because they are detected in fewer than three retained spots. This reduces the number of rarely detected features without removing additional spots. Genes excluded by this threshold are not necessarily absent from breast tissue; their expression may simply be undetected or too sparse in this section.
Quality control after filtering
The filtering itself modifies the matrix; the QC fields should therefore be recalculated on the retained spots and genes rather than carrying the old summaries forward.
Hands On: Recompute and visualise post-filter QC
Scanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The filtered AnnData output from the previousScanpy filter ( Galaxy version 1.11.5+galaxy0)step
“Method used for inspecting”: Calculate quality control metrics, using 'pp.calculate_qc_metrics'
“Name of kind of values in X”: counts
“The kind of thing the variables are”: genes
“Proportions of top genes to cover”: 50,100,200,300
“Use ‘raw’ attribute of input if present”: No
“Compute log1p transformed annotations”: Yes
Rename the generated file QC metrics after filtering.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics after filtering
“Method used for plotting”: Generic: Scatter plot along observations or variables axes, using 'pl.scatter'
“x coordinate”: total_counts
“y coordinate”: n_genes_by_counts
“Color by”: pct_counts_in_top_50_genes
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics after filtering
“Method used for plotting”: Generic: Violin plot, using 'pl.violin'
“Keys for accessing variables”: Subset of variables in 'adata.var_names' or fields of '.obs'
“Keys for accessing variables”: n_genes_by_counts, total_counts
In “Violin plot attributes”:
“Display keys in multiple panels”: Yes
SpatialData Operations ( Galaxy version 0.8.0+galaxy0) with the following parameters:
Figure 7: The positive relationship between total counts and detected genes remains after filtering, with low-count and low-complexity observations excluded.Open image in new tab
Figure 8: The retained spots preserve the broad distributions of sequencing depth and gene complexity, with the lowest-quality observations removed.Open image in new tab
Figure 9: Spatial distribution of total transcript counts after filtering, showing the retained capture spots across the tissue section.Open image in new tab
Figure 10: Spatial distribution of detected-gene complexity after filtering, illustrating variation in transcriptomic richness across the retained tissue regions.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics after filtering
“What to inspect?”: Key-indexed observations annotation (obs)
Query Tabular ( Galaxy version 3.3.2) with the following parameters:
Add an entry under “Database Table”.
param-file“Tabular Dataset for Table”: the observations table from step 1
In “Table Options”:
“Specify Name for Table”: obs
“Use first line as column names”: Yes
“SQL Query to generate tabular output”: use the same SQL query as in Optional: read the QC distributions as numbers.
“include query result column headers”: Yes
“Prefix character for column_header line”: #
Compare the spot count and the medians of total_counts and n_genes_by_counts with the pre-filter summary.
After filtering, 3,795 spots and 22,240 genes remain. The median total_counts is 20,778, and the median n_genes_by_counts is 6,029. These values are close to the corresponding pre-filter medians of 20,761.5 and 6,026.5. The QC distributions remain broadly similar because only three spots were removed, while gene filtering reduced the number of rarely detected features.
Normalisation and feature selection
Count depth differs between spots. pp.normalize_total rescales each spot so that its expression sums to the same target, and pp.log1p compresses the dynamic range. The validated main branch uses a target sum of 10,000 counts per spot, which also produces the form of log-normalised expression expected later by CellTypist (CellTypist developers).
Hands On: Normalise and log-transform the filtered expression matrix
Scanpy normalize ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: QC metrics after filtering
“Method used for normalization”: Normalize counts per cell, using 'pp.normalize_total'
“Target sum”: 10000.0
“Exclude (very) highly expressed genes for the computation of the normalization factor (size factor) for each cell”: No
Scanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The Normalised h5ad AnnData from the previousScanpy normalize ( Galaxy version 1.11.5+galaxy0)step
“Method used for inspecting”: Logarithmize the data matrix, using 'pp.log1p'
Rename the generated file Log-normalised AnnData.
Highly variable genes (HVGs) are genes whose between-spot variation is high relative to genes of similar abundance. They are useful for building an embedding around the most informative expression differences rather than letting thousands of nearly uniform genes contribute equal noise.
Hands On: Identify highly variable genes
Scanpy filter ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The Log-normalised AnnData h5ad from the previousScanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0)step
“Method used for filtering”: Annotate (and filter) highly variable genes, using 'pp.highly_variable_genes'
“Choose the flavor for identifying highly variable genes”: Cell Ranger
“Number of highly-variable genes to keep”: 3000
“Number of bins for binning the mean gene expression”: 20
“Inplace subset to highly-variable genes”: No
Rename the generated file AnnData with HVGs.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with HVGs
“Method used for plotting”: Preprocessing: Plot dispersions versus means for genes, using 'pl.highly_variable_genes'
Figure 11: Highly variable genes show greater expression variability than other genes with similar mean expression. The selected 3,000 genes provide informative features for dimensionality reduction.
The object still contains 22,240 genes; exactly 3,000 are marked as highly variable. Inplace subset to highly-variable genes = No is important here: PCA can use the HVG flag without deleting the other genes, so ranked-gene analysis, CellTypist and LIANA still have access to the wider log-normalised expression matrix.
Question: Feature selection is not feature deletion
If the object still contains 22,240 genes, what does “3,000 HVGs” mean, and why is that distinction important later?
The 3,000 genes are flagged as highly variable and are the informative feature set used by PCA; the remaining genes stay in the object because subsetting is disabled. A gene does not have to drive PCA to be biologically useful as a marker, reference feature or ligand/receptor partner.
Dimensionality reduction and clustering
principal component analysis (PCA) compresses correlated expression patterns into a smaller set of orthogonal components, and Scanpy reads the highly_variable flag set in the previous step so the decomposition is driven by the informative genes (Wolf et al. 2018). Fifty components are computed here.
The graph built from those components connects spots whose expression profiles are similar, not spots that sit near each other in the section. Scanpy calls this the expression-neighbour graph (Wolf et al. 2018), Leiden partitions it (Traag et al. 2019), and Uniform Manifold Approximation and Projection (UMAP) gives a two-dimensional view of it. Keeping that straight matters for every result that follows: two spots on opposite edges of the tissue can be neighbours in this graph, and a group that looks compact on UMAP has not thereby been shown to occupy one region of the slide. Squidpy builds a second, genuinely spatial graph later in this tutorial from the Visium coordinates.
Hands On: Run the main PCA
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with HVGs
“Method used”: Computes PCA (principal component analysis) coordinates, loadings and variance decomposition, using 'pp.pca'
“Number of principal components to compute”: 50
“Change to use different initial states for the optimization”: 0
“Zero center”: Yes
“Data type of the output”: float32
Rename the generated file AnnData with PCA.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with PCA
“Method used for plotting”: PCA: Scatter plot in PCA coordinates, using 'pl.pca'
“Keys for annotations of observations/cells or variables/genes”: log1p_total_counts,log1p_n_genes_by_counts,total_counts
Figure 12: Variation in sequencing depth and detected-gene complexity is associated with the distribution of spots in principal-component space, indicating that these covariates contribute to the observed expression structure.
In this section, total_counts correlates with PC1 at approximately −0.479, PC2 at +0.262 and PC3 at −0.352. Sequencing depth is therefore associated with variation along several principal components, but these correlations do not establish whether that variation is technical or biological. Differences in cell density, tissue composition and transcriptional activity can also contribute to count-depth variation across a tissue section.
Scanpy remove confounders ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with HVGs
“Method used for plotting”: Regress out unwanted sources of variation, using 'pp.regress_out'
“Keys for observation annotation on which to regress on”: total_counts
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The regressed AnnData h5ad from the previousScanpy remove confounders ( Galaxy version 1.11.5+galaxy0)step
“Method used”: Computes PCA (principal component analysis) coordinates, loadings and variance decomposition, using 'pp.pca'
“Number of principal components to compute”: 50
“Change to use different initial states for the optimization”: 0
“Zero center”: Yes
“Data type of the output”: float32
Rename the generated file PCA after regression AnnData.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: PCA after regression AnnData
“Method used for plotting”: PCA: Scatter plot in PCA coordinates, using 'pl.pca'
“Keys for annotations of observations/cells or variables/genes”: log1p_total_counts,log1p_n_genes_by_counts,total_counts
Figure 13: Principal-component structure after regressing out total counts. The distribution illustrates how accounting for sequencing depth changes the representation of expression variation.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with PCA
“What to inspect?”: Key-indexed observations annotation (obs)
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with PCA
“What to inspect?”: Multi-dimensional observations annotation (obsm)
“Which annotation to inspect for the observations?”: PCA coordinates (X_pca)
Query Tabular ( Galaxy version 3.3.2) with the following parameters:
Add an entry under “Database Table”.
param-file“Tabular Dataset for Table”: the observations table from step 1
In “Table Options”:
“Specify Name for Table”: obs
“Use first line as column names”: Yes
Add an entry under “Database Table”.
param-file“Tabular Dataset for Table”: the PCA coordinates from step 2
The query joins the tables by row position and calculates the Pearson correlation of total_counts with each of the first three components. Use the exports in their original row order.
If you ran the regression comparison, repeat step 2 using PCA after regression AnnData. Repeat step 3 with the new PCA coordinates as pcs and the observations table from step 1 as obs. Compare the three correlations before and after regression.
After regression the association between total_counts and the early components is effectively zero. That shows the operation did what it was asked to do. It does not show that the residualised matrix is the better one to analyse.
Comment: What "removing biological signal" means here
Total counts at a spot rise for two different reasons, and regress_out cannot distinguish them.
The technical reason is capture efficiency. Permeabilisation, section thickness and local tissue integrity all vary across a slide, and a spot that released its mRNA less efficiently reports fewer counts for the same underlying biology. Variation of this kind is noise and is worth removing.
The biological reason is that spots genuinely differ in what they contain. A 55 µm spot over densely packed tumour epithelium holds more cells, and more transcriptionally active ones, than a spot over loose collagen-rich stroma or adipose tissue. Its higher count is a real measurement of the tissue.
regress_out(total_counts) removes the fitted linear association between each gene’s expression and total counts. If total counts vary with tissue composition, the adjustment can also reduce biological variation. Here the regression serves as a sensitivity check for PCA, and the non-regressed matrix is used for downstream analysis.
Question: Which branch should continue?
Why is the post-regression PCA useful even though it is not used for the main clustering branch?
Why would sending the residualised .X to CellTypist be a category error?
It is a diagnostic comparison: it shows how strongly the early components change when the total-count association is removed. That helps you judge whether depth is influencing the embedding without automatically deciding that every depth-associated component is technical.
CellTypist expects log1p-normalised expression scaled to 10,000 counts per observation (CellTypist developers). regress_out replaces .X with residuals that include negative values, so the matrix no longer carries that interpretation and the model would be reading values it was never trained on. CellTypist and the expression-neighbour graph both stay on the non-regressed branch for this reason.
The expression-neighbour graph and UMAP
Two steps follow from the PCA. pp.neighbors builds the expression-neighbour graph by connecting each spot to its 15 nearest neighbours in PCA space, and tl.umap embeds that graph in two dimensions for inspection (Wolf et al. 2018). Both run on AnnData with PCA, the non-regressed branch.
Colouring the embedding by the quality-control covariates is the check worth making at this point: if the count-depth gradient dominated the layout entirely, the groups found in the next section would be separating spots by how much signal they carry rather than by what they express.
Hands On: Compute the neighbourhood graph and UMAP
Scanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with PCA
“Method used for inspecting”: Compute a neighborhood graph of observations, using 'pp.neighbors'
“The size of local neighborhood (in terms of number of neighboring data points) used for manifold approximation”: 15
“Use a hard threshold to restrict the number of neighbors to n_neighbors?”: Yes
“Method for computing connectivities”: umap (McInnes et al, 2018)
“Distance metric”: euclidean
“Numpy random seed”: 0
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The AnnData h5ad from the previousScanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0)step
“Method used”: Embed the neighborhood graph using UMAP, using 'tl.umap'
“Minimum distance”: 0.5
“Spread”: 1.0
“Random state”: 0
Rename the generated file AnnData with UMAP.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with UMAP
“Method used for plotting”: Embeddings: Scatter plot in UMAP basis, using 'pl.umap'
“Keys for annotations of observations/cells or variables/genes”: log1p_total_counts,log1p_n_genes_by_counts,total_counts
Figure 14: The UMAP displays transcriptionally similar spots near one another and reveals how sequencing depth and gene complexity vary across the expression-based embedding.
Clustering at three resolutions
Leiden clustering partitions a graph into communities (Traag et al. 2019). The resolution controls how readily larger communities are subdivided. No single resolution is intrinsically correct: the useful question is whether an extra split produces stable and interpretable expression programmes or merely fragments an already coherent group.
The learner-facing comparison is deliberately limited to 0.4, 0.8 and 1.2.
Hands On: Cluster the expression-neighbour graph
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with UMAP
“Method used”: Cluster cells into subgroups, using 'tl.leiden'
“Coarseness of the clustering”: 0.4
“Key under which to add the cluster labels”: leiden_res_0.4
“Use weights from knn graph?”: Yes
“How many iterations of the Leiden clustering algorithm to perform”: 2
“Random state”: 0
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The AnnData from previousScanpy cluster, embed ( Galaxy version 1.11.5+galaxy0)step
“Method used”: Cluster cells into subgroups, using 'tl.leiden'
“Coarseness of the clustering”: 0.8
“Key under which to add the cluster labels”: leiden_res_0.8
“Use weights from knn graph?”: Yes
“How many iterations of the Leiden clustering algorithm to perform”: 2
“Random state”: 0
Scanpy cluster, embed ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: The AnnData from previousScanpy cluster, embed ( Galaxy version 1.11.5+galaxy0)step
“Method used”: Cluster cells into subgroups, using 'tl.leiden'
“Coarseness of the clustering”: 1.2
“Key under which to add the cluster labels”: leiden_res_1.2
“Use weights from knn graph?”: Yes
“How many iterations of the Leiden clustering algorithm to perform”: 2
“Random state”: 0
Rename the generated file AnnData with Leiden comparison 0.4 and 0.8 and 1.2.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with Leiden comparison 0.4 and 0.8 and 1.2
“Method used for plotting”: Embeddings: Scatter plot in UMAP basis, using 'pl.umap'
“Keys for annotations of observations/cells or variables/genes”: leiden_res_0.4,leiden_res_0.8,leiden_res_1.2
Figure 15: Increasing Leiden resolution produces progressively finer partitions, from 9 groups at resolution 0.4 to 11 at 0.8 and 16 at 1.2. These groups represent expression-defined domains of Visium spots rather than individual cell types.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with Leiden comparison 0.4 and 0.8 and 1.2
“What to inspect?”: Key-indexed observations annotation (obs)
Query Tabular ( Galaxy version 3.3.2) with the following parameters:
Add an entry under “Database Table”.
param-file“Tabular Dataset for Table”: the observations table from step 1
In “Table Options”:
“Specify Name for Table”: obs
“Use first line as column names”: Yes
“SQL Query to generate tabular output”: run one query per job using the four queries below.
Use the group-size output to compare the partitions. The adjusted Rand index summarises agreement after accounting for chance. The two group-membership tables show which spots were assigned together at one resolution and split across groups at the next.
Resolution
Number of groups
Largest group
Interpretation
0.4
9
1,390 spots
Coarser expression-based partition
0.8
11
609 spots
Intermediate partition used for subsequent analyses
1.2
16
448 spots
Finer expression-based partition
The three resolutions produce different partitions of the same expression-neighbour graph. The adjusted Rand index is 0.654 between resolutions 0.4 and 0.8 and 0.704 between 0.8 and 1.2, indicating that changing the resolution changes group membership.
At resolution 0.4, group 0 contains 1,390 spots. Of these, 608 are assigned to group 0, 556 to group 1 and 194 to group 7 at resolution 0.8, with smaller numbers distributed among other groups. Their marker profiles differ: group 0 is enriched for stromal and extracellular-matrix-associated genes, group 1 for immunoglobulin transcripts, and group 7 for antigen-presentation and myeloid-associated genes.
Resolution 0.8 is retained as an intermediate level of detail for investigating these expression programmes and their spatial distribution. Neither the number of groups nor their separation on UMAP is sufficient to establish distinct cell types.
Question: Choose a resolution from evidence
Which argument best supports carrying leiden_res_0.8 forward?
A. It produces a fixed number of biologically distinct cell types.
B. It provides an intermediate partition in which the large group at resolution 0.4 separates into groups with distinguishable marker-gene programmes, allowing their spatial organisation to be examined.
C. Its UMAP panel appears more clearly separated than the other resolutions.
B. Resolution 0.8 distinguishes an extracellular-matrix-associated programme, an immunoglobulin-rich programme and an antigen-presentation-associated programme that were largely combined in one group at resolution 0.4. The adjusted Rand index shows that changing resolution alters group membership, while the marker evidence helps interpret the resulting partitions. Neither UMAP appearance nor group count alone establishes biological validity.
Marker genes
tl.rank_genes_groups tests each group against the union of all the others and returns the genes most strongly enriched in it (Wolf et al. 2018). The Wilcoxon rank-sum test is used here because it makes no assumption about the shape of the expression distribution, and Benjamini-Hochberg correction is applied across the genes tested.
This is the step where a numbered group starts to mean something biological. How far that meaning can be pushed depends on what a group is: 55 µm of tissue holding several cells, so a ranked gene list describes the programme that dominates a domain rather than the contents of a cell.
Hands On: Rank genes for the selected partition
Scanpy Inspect and manipulate ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with Leiden comparison 0.4 and 0.8 and 1.2
“Method used for inspecting”: Rank genes for characterizing groups, using 'tl.rank_genes_groups'
“Get ranked genes as a Tabular file?”: True
“The key of the observations grouping to consider”: leiden_res_0.8
“Use ‘raw’ attribute of input if present”: No
“Comparison”: Compare each group to the union of the rest of the group
“Method”: Wilcoxon-Rank-Sum
“Correction method”: Benjamini-Hochberg
“Use tie correction for ‘wilcoxon’ scores”: No
Rename the AnnData output AnnData with markers and the table output Rank genes for characterizing groups.
Scanpy plot ( Galaxy version 1.11.5+galaxy0) with the following parameters:
param-file“Annotated data matrix”: AnnData with markers
“Method used for plotting”: Marker genes: Plot ranking of genes, using 'pl.rank_genes_groups'
Figure 16: Wilcoxon-ranked genes highlight expression programmes that distinguish the 11 Leiden groups. Combinations of enriched genes provide evidence for interpreting the biological characteristics of each tissue domain.
Annotating the groups
The single-cell and spatial atlas of human breast cancers defines the epithelial, mesenchymal and immune lineages of this tumour type and their marker genes (Wu et al. 2021), and the adult human breast atlas gives the normal-tissue counterpart (Kumar et al. 2023). Integrated single-cell and spatial studies of breast tumours use the same marker vocabulary in a spatial setting (Janesick et al. 2023). Matching the ranked genes against those references is what turns a group number into a description.
Group
Spots
Examples among high-ranked genes
Expression programme suggested by the markers
Biological basis
0
609
TIMP1, IGFBP7, C3, DCN, BGN, SFRP2, IGHG1
Fibroblast- and extracellular-matrix-associated stromal programme with immunoglobulin signal
DCN, BGN and SFRP2 support a fibroblast-associated extracellular-matrix programme. IGHG1 indicates an additional immunoglobulin-associated contribution, consistent with mixed cellular RNA in Visium spots (Wu et al. 2021, Croizer et al. 2024).
1
578
IGHG4, IGKC, IGHG3, IGLC2, IGHG1
Immunoglobulin-rich programme compatible with antibody-producing cell contributions
Immunoglobulin heavy- and light-chain transcripts are characteristic of antibody-producing B-lineage cells, particularly plasma cells. Their enrichment does not establish that each spot consists exclusively of plasma cells (Wu et al. 2021).
2
451
CXCL14, CCND1, GFRA1, AGR2, KRT18, KRT8, MUC1
Luminal epithelial-associated programme
KRT8, KRT18 and MUC1 support luminal epithelial expression, while AGR2 and CCND1 are compatible with epithelial secretory and proliferative programmes. These markers alone do not establish malignant identity (Wu et al. 2021, Kumar et al. 2023).
3
436
COX6C, SLC39A6, WFDC2, SNCG, FASN
Epithelial-associated programme with metabolic and secretory features
SLC39A6 and WFDC2 are associated with epithelial expression, while FASN and COX6C reflect lipid-metabolic and mitochondrial functions. The combination distinguishes this group without establishing a specific tumour subtype (Wu et al. 2021).
4
425
CRISP3, SLITRK6, IGFBP5, VTCN1, KRT8
CRISP3-high epithelial-associated programme
CRISP3 is strongly enriched in this group, alongside genes associated with epithelial expression and regulation. Its spatially concentrated expression provides additional evidence for a distinct expression-associated tissue region, but not a definitive cell type (Wu et al. 2021).
5
359
MGP, SERPINA3, DSP, S100G, TFF3, TFF1
TFF-associated epithelial programme with additional mixed expression signals
TFF1 and TFF3 support a secretory or hormone-responsive epithelial-associated programme. Other enriched genes indicate that the group should not be assigned a single epithelial subtype solely from its marker ranking (Wu et al. 2021, Kumar et al. 2023).
6
335
CPB1, IL6ST, CFB, HLA-B, HLA-C, TAP1
CPB1-high programme with antigen-processing-associated expression
CPB1 distinguishes this expression programme, while HLA-B, HLA-C and TAP1 participate in MHC class I antigen presentation. These features do not independently establish the lineage of the contributing cells (Wu et al. 2021, Kumar et al. 2023).
7
214
HLA-DRA, CD74, LYZ, HLA-DPA1, APOE, C1QA
Antigen-presentation and myeloid-associated programme
HLA-DRA, HLA-DPA1 and CD74 support MHC class II antigen presentation, while LYZ, APOE and C1QA are compatible with myeloid-associated expression. These markers suggest immune contributions without proving an exclusive macrophage identity (Wu et al. 2021).
IFI27 and IFI6 are interferon-responsive genes. Their enrichment supports an interferon-associated expression state, but the marker combination is insufficient to assign a specific breast cell lineage (Wu et al. 2021).
9
161
MUC5B, PVALB, SLC30A8, IGFBP2
Distinct expression programme of uncertain cellular origin
The leading genes do not provide a sufficiently specific and consistent lineage signature for a confident annotation. The group is therefore retained as an expression-defined domain requiring further characterisation.
Several leading genes encode ribosomal proteins, indicating a distinctive expression programme. Ribosomal enrichment alone does not establish poor data quality: the group’s median total counts and detected-gene complexity are comparable to those of the overall section.
Several Leiden groups show related epithelial-associated programmes. Groups 2, 3, 4, 5 and 6 differ in their highest-ranked genes, including combinations of keratins, secretory-associated genes and antigen-processing genes. Their separation reflects differences in expression profiles, but does not establish distinct malignant subtypes or histological compartments.
Groups 0 and 1 illustrate the mixed nature of Visium measurements. Group 0 combines extracellular-matrix-associated genes with immunoglobulin transcripts, whereas group 1 is particularly enriched for immunoglobulin heavy- and light-chain genes. The rankings are consistent with different contributions from stromal and antibody-producing cell populations, but cannot determine their proportions within individual spots.
Group 7 is characterised by HLA-DRA, CD74, LYZ and other antigen-presentation-associated genes. This supports a myeloid-associated expression programme, although the ranking alone cannot identify all contributing cells or establish a distinct lymphoid structure.
Some groups remain incompletely characterised. Group 9 lacks a sufficiently specific combination of established breast-lineage markers, while group 10 is enriched for ribosomal-protein genes. Group 10 has a median of 6,115 detected genes and 21,682 total counts, so its marker pattern does not by itself indicate poor library complexity. Additional evidence is needed before assigning either group a more specific biological identity.
Comment: Why marker-based annotation is weaker on Visium than on single cells
In a segmented single-cell experiment, a group whose cells all express COL1A1 and DCN can reasonably be called fibroblasts. On Visium, the same ranking means that spots in that group contain more fibroblast RNA than other spots do. The spot may still contain epithelium, vessels and immune cells alongside the fibroblasts, and that mixture is why group 0 also shows immunoglobulin signal.
Recovering actual proportions requires deconvolution against a matched single-cell reference (Kleshchevnikov et al. 2022, Cable et al. 2022). Without that step, the defensible statement is about which programme dominates a domain, not about which cells are present.
Question: Interpret marker genes in multicellular spots
Group 0 is enriched for extracellular-matrix-associated genes and immunoglobulin transcripts. Why is it inappropriate to assign every spot in this group a single fibroblast identity?
Group 10 is enriched for ribosomal-protein genes. What additional evidence should be considered before describing it as a low-quality group?
A Visium spot can contain RNA from fibroblasts, immune cells, epithelial cells and other populations. Enrichment of fibroblast-associated markers indicates a contribution from that expression programme, not exclusive fibroblast identity.
Ribosomal enrichment should be considered alongside the number of detected genes, total counts, spatial location and other marker genes. Group 10 has count and detected-gene medians comparable to the overall section, so low complexity is not established by these data.
Spatial statistics with Squidpy
Up to this point, neighbourhood meant expression similarity. Squidpy now constructs a separate graph from the Visium coordinates (Palla et al. 2022).
The settings follow from how the slide is printed. Capture spots sit at fixed positions in a hexagonal lattice, so every interior spot has exactly six immediate neighbours a known distance away. Squidpy exposes this directly: coord_type = grid with n_neighs = 6 and n_rings = 1 connects each spot to the six that touch it (Palla et al. 2022).
This is where a sequencing-based analysis diverges structurally from an imaging-based one. Segmented cells occupy irregular positions with no lattice to exploit, so their graph has to be built with coord_type = generic, using Delaunay triangulation or a distance cut-off. Using the generic setting on Visium data would discard geometry the slide design already guarantees.
Comment: What `n_rings` controls
Increasing n_rings extends the graph outwards by whole rings of the lattice: two rings connect each spot to its six immediate neighbours plus the twelve beyond them. A wider graph smooths the statistics that follow, which can help when domains are large and diffuse, but it also blurs boundaries between adjacent domains. One ring keeps the analysis at the finest spatial scale Visium can support.
Hands On: Build the Visium spatial-neighbour graph
Squidpy ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with markers
“Operation”: Create a graph from spatial coordinates (gr.spatial_neighbors)
“Spatial key”: spatial
“Coordinate type”: grid
“Number of neighbors”: 6
“Number of rings”: 1
“Delaunay triangulation”: No
“Set diagonal”: No
“Key added”: spatial
The resulting spatial_connectivities matrix describes physical adjacency on the capture grid. It does not replace the Scanpy graph used for UMAP and Leiden; both graphs remain in the object for different analyses.
Spatial centrality measures
Squidpy calculates centrality for each Leiden group on the spatial graph. Degree centrality is the fraction of spots outside the group that share an edge with at least one group member. Closeness centrality describes how close the group is to the other spots along paths in the graph (Palla et al. 2022).
Hands On: Calculate group-level spatial statistics
Squidpy ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with spatial neighbours from the previous <span class="tool" data-tool="toolshed.g2.bx.psu.edu/repos/iuc/squidpy_graph/squidpy_graph/1.8.1+galaxy0" title="Squidpy tool" aria-role="button"><i class="fas fa-wrench" aria-hidden="true"></i> <strong>Squidpy</strong> (<i class="fas fa-cubes" aria-hidden="true"></i> Galaxy version 1.8.1+galaxy0)</span> step`
“Operation”: Compute centrality scores per cluster or cell type (gr.centrality_scores)
“Key in adata.obs where clustering is stored”: leiden_res_0.8
“Connectivity key”: spatial_connectivities
Squidpy Plot ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with centrality scores from previousSquidpy Plot ( Galaxy version 1.8.1+galaxy0)step
“Key in adata.obs where clustering is stored”: leiden_res_0.8
Squidpy ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with centrality scores from previousSquidpy Plot ( Galaxy version 1.8.1+galaxy0)step
“Operation”: Compute neighborhood enrichment by permutation test (gr.nhood_enrichment)
“Key in adata.obs where clustering is stored”: leiden_res_0.8
“Connectivity key”: spatial_connectivities
“Number of permutations”: 1000
Squidpy Plot ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with neighborhood enrichment from previousSquidpy Plot ( Galaxy version 1.8.1+galaxy0)step
Figure 17: Squidpy centrality measures describe the spatial organisation of Leiden groups within the Visium-neighbour graph, including local connectivity and their positions relative to the wider tissue network.
Group 0 has the highest degree centrality (0.220) and closeness centrality (0.253). Group 1 also has relatively high values (0.212 and 0.216), while group 7 has degree centrality of 0.140 and closeness centrality of 0.190. These scores reflect how each expression-defined group is positioned within the spatial-neighbour graph. They describe the organisation of the groups across the section, not their biological importance or signalling activity.
Neighbourhood enrichment
Neighbourhood enrichment asks whether two group labels sit next to each other in the spatial graph more or less often than chance allows. Squidpy counts the observed adjacencies, shuffles the group labels across spots many times, and reports how far the observed count sits from the permuted distribution as a z-score (Palla et al. 2022). A positive value means the two labels are neighbours more often than expected, a negative value less often.
Figure 18: Neighbourhood-enrichment z-scores measure whether spots belonging to the same or different Leiden groups occur next to one another more or less frequently than expected under random reassignment of group labels.
The diagonal values show strong within-group spatial enrichment. For example, group 4 has a diagonal z-score of approximately +97.97, while group 7 has a diagonal z-score of approximately +36.23. These positive values indicate that spots assigned to the same Leiden group occur next to one another more frequently than expected under random reassignment of the group labels.
Off the diagonal, groups 6–7 show positive enrichment (z ≈ +6.31), as do groups 0–1 (z ≈ +3.79). The value for 0–7 is much smaller (z ≈ +0.29) and should not be interpreted as strong enrichment. In contrast, adjacency between groups 1–2 (z ≈ −22.06) and 0–2 (z ≈ −19.99) is strongly depleted. These results describe the physical arrangement of expression-defined groups across the Visium grid. Positive enrichment supports non-random adjacency between group labels; it does not establish direct molecular communication or signalling direction.
Question: Adjacency is not communication
Groups 6 and 7 are adjacent more often than expected. Which statement is justified?
A. Group 6 sends a signal to group 7.
B. Spots carrying labels 6 and 7 share edges in the Visium spatial graph more often than expected under the permutation null.
B. The enrichment analysis works on group labels and physical adjacency. It contains no ligand-receptor model and establishes neither molecular interaction nor causal direction.
Spatially variable genes
Moran’s I asks whether expression values for a gene are spatially autocorrelated over the graph: a high positive value means similar expression tends to occur in neighbouring spots. It is a statement about pattern, not mechanism.
Hands On: Calculate Moran's I
Squidpy ( Galaxy version 1.8.1+galaxy0) with the following parameters:
param-file“spatial object (in SpatialData or AnnData format)”: AnnData with neighborhood enrichment from previousSquidpy Plot ( Galaxy version 1.8.1+galaxy0)step
“Operation”: Calculate Global Autocorrelation Statistic (Moran’s I or Geary's C) (gr.spatial_autocorr)
“Connectivity key”: spatial_connectivities
“Mode”: Moran's I
“Attribute”: X
“Transformation”: Yes
“Number of permutations”: 1000
“Two tailed”: No
“Use raw counts”: No
Rename the generated file AnnData with Moran's I.
The ten highest-ranked genes in the reference run are shown below.
Moran’s I was calculated for the 3,000 highly variable genes. Three immunoglobulin genes appear in the top ten, indicating spatial structure in immunoglobulin-associated expression across this section.
Visual confirmation on the tissue
A high Moran’s I indicates that a gene is more spatially structured than random, but the statistic alone does not show what that structure looks like. Plotting a high-scoring gene back onto the section is therefore a necessary check: a gene that is genuinely spatially informative should resolve into a coherent territory or gradient rather than scattered speckle. The plot also helps separate a real biological pattern from an apparent one driven by a handful of very high-expressing spots.
To do this we import the AnnData table carrying the Squidpy results back into the SpatialData object, then colour the capture spots by expression of the gene of interest. The steps below use CRISP3, the highest-scoring gene in this section.
Hands On: Visualise a high-scoring gene on the tissue
SpatialData Operations ( Galaxy version 0.8.0+galaxy0) with the following parameters:
Visium capture spots are stored in the SpatialData object as shapes, that is, circles of fixed radius positioned on the capture grid. They are not a segmentation mask, so there is no labels element to render. Use “Render Shapes” for any Visium overlay. In a Xenium analysis, where cells really are segmented, the equivalent overlay would use “Render Labels” instead.
Figure 19: CRISP3 expression is concentrated toward the lower-right region of the tissue section, illustrating a spatially restricted expression pattern.
CRISP3 was the top-ranked marker for Leiden group 4, which had the highest mean expression of the gene. The map shows where high-expression spots occur across the tissue. The strongest signal is concentrated in the region occupied by group 4, with lower expression also detected in other groups.
Question: Read the statistic and the map together
CRISP3 and C3 have Moran’s I values of 0.729 and 0.614, respectively. What does the difference tell you, and what would you need to inspect on the tissue maps?
A gene returns a low Moran’s I but is clearly a strong marker for one Leiden group in the ranked-gene table. Is that a contradiction?
CRISP3 has stronger positive spatial autocorrelation on this graph. Compare the tissue maps to see where high expression occurs and how much of the section it covers
No. The two statistics ask different questions. Ranked genes ask whether expression differs between groups of spots defined in expression space; Moran’s I asks whether expression is arranged coherently in physical space. A marker for a group whose spots are scattered across several parts of the section can be highly discriminative and still have low spatial autocorrelation.
Question: What does a high Moran's I leave unanswered?
CRISP3 has Moran’s I ≈ 0.729. Which of the following still requires additional evidence: whether its expression is spatially patterned, why that pattern occurs, or whether the gene causes the neighbouring tissue state?
The statistic supports the first statement: expression is spatially autocorrelated on this graph. The cause of the pattern and any functional effect remain unanswered. A spatial statistic does not provide a mechanism.
Cell type annotation with CellTypist
CellTypist was designed to compare query expression profiles with labelled single-cell references (Xu et al. 2023). The model used here contains cell states from adult human breast tissue (Kumar et al. 2023); the full catalogue of available models is published by the CellTypist developers (CellTypist developers). For this Visium analysis, the appropriate interpretation is therefore reference-based label transfer: each mixed spot is assigned the reference profile with the largest score, not proven to be one cell of that type.
The input is AnnData with Moran's I, which still carries the non-regressed, log1p-normalised expression matrix scaled to 10,000 counts per spot.
Hands On: Transfer adult-breast reference labels to the spots
CellTypist ( Galaxy version 1.7.1+galaxy2) with the following parameters:
param-file“Input AnnData file”: AnnData with Moran's I
“Select model from”: Cached
“Choose CellTypist model”: cell types from the adult human breast (v1)
“Annotation mode”: Choose the cell type with the largest score/probability as the final prediction
“Refine the predicted labels by running the majority voting classifier after over-clustering”: No
“Generate a dotplot of the predicted cell types”: Yes
“Reference column in AnnData.obs for dotplot”: leiden_res_0.8
“Prediction label in AnnData.obs for dotplot”: predicted_labels
The direct predictions can be summarised numerically to check how often each reference label is assigned and how those assignments vary between Leiden groups.
Inspect AnnData ( Galaxy version 0.13.3+galaxy0) with the following parameters:
param-file“Annotated data matrix”: the annotated AnnData output from the previous CellTypist ( Galaxy version 1.7.1+galaxy2) step
“What to inspect?”: Key-indexed observations annotation (obs)
This exports the per-spot reference predictions, including predicted_labels, conf_score and leiden_res_0.8.
Query Tabular ( Galaxy version 3.3.2) with the following parameters:
In “Database Table”:
param-file“Tabular Dataset for Table”: the observation table from the previous Inspect AnnData ( Galaxy version 0.13.3+galaxy0) step
Set “include query result column headers” to Yes with prefix #.
The output shows how many spots in each Leiden group receive each reference label. Use these values to compare CellTypist predictions with the marker-gene interpretation.
The direct result contains 32 distinct predicted_labels across 3,795 spots. The most frequent labels are shown below.
Reference label
Spots
Percentage
plasma_IgG
1,836
48.38%
LummHR-SCGB
1,137
29.96%
CD8-activated
204
5.38%
Fibro-matrix
127
3.35%
LummHR-major
126
3.32%
Lumsec-prol
104
2.74%
Macro-lipo
52
1.37%
The two most frequent labels account for 78.34% of spots, and the median CellTypist confidence across spots is 0.743. The confidence score reflects the classifier’s support for its closest reference match to the combined RNA profile of a spot.
Figure 20: Dot size represents the proportion of spots assigned each reference label within a Leiden group, while colour indicates mean prediction probability. These annotations reflect similarity to reference cell profiles rather than definitive cell identities.
The relationship with the marker evidence is informative in both directions.
Where the two agree, the reference matches support the marker-based interpretation. Group 1, whose markers are dominated by immunoglobulin chains, matches plasma_IgG for 313 of its 578 spots (54.15%). Groups 2, 4 and 5 have epithelial-associated marker programmes, and LummHR-SCGB is their most frequent reference match, accounting for 210 of 451 spots (46.56%), 216 of 425 spots (50.82%) and 167 of 359 spots (46.52%), respectively. You can check these values in the optional cross-tabulation above.
Where they disagree, the disagreement is the lesson. Group 0 carries fibroblast- and extracellular-matrix-associated markers alongside immunoglobulin expression. Its most frequent reference match is plasma_IgG, assigned to 404 of 609 spots (66.34%), and 29 distinct reference labels appear across the group. Abundant immunoglobulin transcripts can influence the closest reference match for a mixed spot. The percentage describes how many spots received the label.
Majority voting refines the direct predictions using the most common reference label within transcriptionally similar subclusters (Domínguez Conde et al. 2022). For multicellular Visium spots, this can suppress minority reference signals and make mixed expression profiles appear more uniform than they are.
Those minority signals may be informative in a tumour microenvironment analysis, so majority voting is left off here and the direct predicted_labels are used instead. The resulting annotations preserve variation in reference similarity across spots, but still do not identify their individual constituent cells.
Question: Is a CellTypist label a cell identity?
Which sentence is better supported by this experiment?
A. “This spot is a plasma cell.”
B. “This spot has its closest reference match to the plasma_IgG profile.”
B. The measurement is a Visium spot that can contain RNA from several cells. CellTypist reports transcriptional similarity to categories in a single-cell reference. A defensible interpretation combines that result with Leiden markers, spatial position, histology and biological knowledge.
Ligand-receptor rankings with LIANA
LIANA combines ligand-receptor resources and inference methods to rank expression-compatible source-to-target pairs (Dimitrov et al. 2022, Dimitrov et al. 2024). Here the source and target categories are the leiden_res_0.8 groups of Visium spots, not purified cell populations. That distinction makes the results hypotheses about tissue regions/programmes rather than direct observations of cell-to-cell signalling.
Hands On: Rank candidate ligand-receptor pairs
Liana Methods ( Galaxy version 1.7.3+galaxy1) with the following parameters:
param-file“Annotated data matrix”: AnnData with Moran's I
“Method for ligand-receptor inference”: Aggregate ligand-receptor scores from multiple methods (rank_aggregate)
“Consensus options”: Default (Specificity and Magnitude)
“Return all interactions”: No
“Results key in adata.uns”: liana_res
“Use raw counts”: No
Renamegalaxy-pencil the generated file Final LIANA AnnData.
The retained liana_res table contains 141,756 rows. Each row represents a ligand–receptor pair for a particular source and target group. The seven highest-ranked results by specificity are shown below.
Source
Target
Ligand
Receptor
Specificity rank
10
7
PIP
CD4
2.28 × 10⁻⁹
5
5
ALB
LRP2
6.13 × 10⁻⁹
10
0
PIP
CD4
7.47 × 10⁻⁹
0
6
IGHG1_IGLC1
FCGR3B
1.97 × 10⁻⁸
0
7
C3
CD19
4.83 × 10⁻⁸
5
8
ALB
LRP2
5.42 × 10⁻⁸
10
6
PIP
NPTN
5.58 × 10⁻⁸
Smaller values indicate a higher ranking. PIP–CD4 from group 10 to group 7 ranks first by specificity, yet spots in those groups share spatial edges less often than expected under the permutation null (z ≈ −2.94). LIANA ranks candidates from group-level expression. The spatial graph adds separate evidence about whether the groups tend to be neighbours.
Sorting by magnitude_rank puts HLA-A–ERBB2 at the top for several source–target combinations. Its two highest-ranked combinations are 8 → 6 (4.48 × 10⁻¹⁰) and 7 → 6 (4.03 × 10⁻⁹).
Magnitude ranks candidates by the strength of their expression-based scores. Specificity ranks them by how selectively the scores favour particular source and target groups. Smaller values indicate a higher ranking in either column.
Question: Read LIANA together with the spatial graph
HLA-A–ERBB2 ranks first by magnitude for 8 → 6 and second for 7 → 6. Which combination has more support from the spatial graph for a hypothesis that depends on the groups being neighbours?
Groups 7 and 6 share spatial edges more often than expected (z ≈ +6.31), whereas groups 8 and 6 share fewer than expected (z ≈ −10.61). The 7 → 6 candidate therefore has more support from the neighbourhood graph. The graph measures adjacency between spot groups. Testing signalling direction, receptor activation or a functional effect would require additional evidence.
Comment: What would make a ligand-receptor candidate worth following up?
Look for several independent forms of support: ligand and receptor expression in the relevant source and target groups; a good specificity as well as magnitude ranking; spatial adjacency or a biologically plausible diffusible mechanism; marker genes that independently support the interpretation of the source and target programmes; literature in breast cancer or the relevant tissue context; and replication in another section. Protein-level or perturbation evidence is needed before the language moves from “candidate” to a functional interaction.
Return the processed table to SpatialData
Everything computed so far lives in the AnnData table: quality-control fields, PCA and UMAP coordinates, three Leiden assignments, ranked-gene metadata, the spatial graph and its statistics, CellTypist labels and the LIANA rankings. None of it is yet attached to the tissue. Writing the table back into the SpatialData object restores that link, so each annotation can be drawn on the histology it came from and the object can be shared as a single self-describing unit.
Hands On: Create the final processed SpatialData object
SpatialData Operations ( Galaxy version 0.8.0+galaxy0) with the following parameters:
Figure 21: The 11 Leiden groups occupy different regions of the breast-cancer tissue section, with several groups forming broad territories and others appearing across multiple regions. Each spot represents a mixed tissue measurement rather than an individual cell.
The tissue view is the final consistency check. A UMAP group that looked coherent in expression space can now be judged against histology and neighbouring groups. Group territories that are spatially coherent strengthen the interpretation that clustering has captured reproducible tissue programmes, while mixed boundaries are expected where Visium spots collect RNA from more than one cell population.
Question: Interpret group 7 across the analyses
Group 7 has high-ranking markers such as HLA-DRA, CD74 and LYZ, which support an antigen-presentation and myeloid-associated expression programme. Its most frequent CellTypist match is plasma_IgG, assigned to 120 of 214 spots (56.07%). Squidpy shows that groups 7 and 6 are neighbours more often than expected (z ≈ +6.31), and LIANA ranks HLA-A–ERBB2 second by magnitude for 7 → 6. The final map shows where the spots lie on the tissue.
How can the marker programme and the CellTypist result both describe group 7? What do the other results add?
The marker ranking describes genes enriched across group 7. CellTypist assigns each spot the closest reference match to its mixed expression profile, so the two results can capture different signals from the same spots. Squidpy describes how often groups 7 and 6 are neighbours, while the histology map shows where those spots are located. LIANA adds an expression-based candidate for follow-up. Establishing the cellular composition of the spots or testing whether the candidate mediates signalling would require additional evidence (Dimitrov et al. 2024).
Conclusion
We analysed the Human Breast Cancer, Block A Section 1 Visium tissue section as a spatial transcriptomics experiment rather than as a single-cell dataset. The prepared expression table began with 3,798 capture spots × 36,601 genes. Sequential spot and gene filtering retained 3,795 spots × 22,240 genes: only 3 spots were removed, while the requirement that a gene be detected in at least three spots removed 14,361 rarely detected features.
The filtered expression matrix was normalised to 10,000 counts per spot, log-transformed and annotated with 3,000 highly variable genes without subsetting away the remaining genes. The main 50-component PCA was calculated on this non-regressed log-normalised branch and used to build a 15-neighbour expression graph and UMAP. A separate regress_out(total_counts) branch showed that the association of early PCs with total count could be removed, but that residualised matrix was deliberately kept out of CellTypist and the main graph because it no longer represents log-normalised expression.
Leiden resolutions 0.4, 0.8 and 1.2 yielded 9, 11 and 16 groups, respectively. Resolution 0.8 was carried forward as an intermediate partition supported by changes in group membership and marker-gene interpretation, rather than UMAP appearance alone. The adjusted Rand index was 0.654 between resolutions 0.4 and 0.8, and 0.704 between 0.8 and 1.2. At resolution 0.4, group 0 contained 1,390 spots, of which 608, 556 and 194 were assigned to groups 0, 1 and 7, respectively, at resolution 0.8. Their marker rankings suggest stromal and extracellular-matrix-associated, immunoglobulin-rich, and antigen-presentation/myeloid-associated expression programmes, respectively (Wu et al. 2021). This provides a biological rationale for examining the intermediate partition while recognising that the Leiden groups are expression-defined groups of multicellular Visium spots, not necessarily distinct cell types.
Squidpy used physical adjacency on the Visium grid to describe spatial organisation. Centrality described graph position, neighbourhood enrichment compared observed adjacency with shuffled group labels, and Moran’s I identified spatially autocorrelated genes such as CRISP3 (0.729) and CPB1 (0.712). The tissue map showed where CRISP3 expression was concentrated, consistent with its enrichment in Leiden group 4.
CellTypist assigned each of the 3,795 spots its closest adult-breast reference label, yielding 32 distinct labels. The reference matches summarised expression at the spot level, while the marker rankings described expression programmes across Leiden groups. LIANA then ranked 141,756 combinations of ligand–receptor pairs and source and target groups. PIP–CD4 from group 10 to group 7 ranked first by specificity, even though those groups shared fewer spatial edges than expected under permutation (z ≈ −2.94). Comparing the LIANA rankings with the spatial graph helps identify which candidates have both expression and neighbourhood support for follow-up (Dimitrov et al. 2024).
Finally, the processed AnnData table was returned to the original SpatialData object as table_processed, and leiden_res_0.8 was drawn over the histology. The final object therefore keeps expression-derived groups, reference annotations, spatial statistics and ligand-receptor rankings attached to the tissue coordinates that give them context.
This analysis maps expression-defined groups of Visium capture spots. A spot can contain RNA from several cells, and methods such as cell2location and RCTD use suitable reference expression profiles to estimate cell-type contributions within spots (Kleshchevnikov et al. 2022, Cable et al. 2022). The companion Xenium melanoma tutorial works at the level of segmented cells, where transcript assignment depends on the inferred cell boundaries.
You've Finished the Tutorial
Please also consider filling out the Feedback Form as well!
Key points
A standard Visium observation represents a multicellular capture spot rather than a segmented cell. Each observation measures RNA collected from a defined area of tissue, so its expression profile may contain contributions from several cell populations.
Quality-control thresholds must be assessed against both expression distributions and tissue morphology. In this section, the two lower spot filters remove only three observations, while requiring gene detection in at least three spots removes 14,361 rarely detected genes.
Normalisation and highly variable gene selection prepare the expression matrix for dimensionality reduction. Regressing out total_counts creates a residualised expression matrix, which is retained as a diagnostic comparison rather than used for the main clustering and reference-annotation analyses.
Leiden clustering identifies groups of transcriptionally similar spots from the Scanpy expression-neighbour graph. These groups are not automatically distinct cell types or spatially continuous tissue domains.
Leiden resolution should be evaluated using changes in group membership and marker-gene programmes. Adjusted Rand indices and marker rankings help assess the consequences of different resolutions, but neither establishes a uniquely correct biological partition.
Scanpy expression neighbours represent transcriptomic similarity, whereas Squidpy spatial neighbours represent adjacency on the Visium capture grid. Centrality, neighbourhood enrichment and Moran’s I describe different aspects of spatial organisation.
Marker-gene rankings identify expression programmes associated with Leiden groups. CellTypist transfers reference labels to mixed spot profiles, while LIANA prioritises candidate ligand-receptor interactions. These methods provide complementary evidence but do not independently establish cellular composition, direct signalling or causal interactions.
Frequently Asked Questions
Have questions about this tutorial? Have a look at the available FAQ pages and support channels
Further information, including links to documentation and original publications, regarding the tools, analysis techniques and the interpretation of results described in this tutorial can be found here.
Ståhl, P. L., F. Salmén, S. Vickovic, A. Lundmark, J. Fernández Navarro et al., 2016 Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science 353: 78–82. 10.1126/science.aaf2403
Wolf, F. A., P. Angerer, and F. J. Theis, 2018 SCANPY: large-scale single-cell gene expression data analysis. Genome Biology 19: 10.1186/s13059-017-1382-0
Traag, V. A., L. Waltman, and N. J. van Eck, 2019 From Louvain to Leiden: guaranteeing well-connected communities. Scientific Reports 9: 10.1038/s41598-019-41695-z
Wolock, S. L., R. Lopez, and A. M. Klein, 2019 Scrublet: Computational Identification of Cell Doublets in Single-Cell Transcriptomic Data. Cell Systems 8: 281–291.e9. 10.1016/j.cels.2018.11.005
Mehraj, U., R. A. Ganai, M. A. Macha, A. Hamid, M. A. Zargar et al., 2021 The tumor microenvironment as driver of stemness and therapeutic resistance in breast cancer: New challenges and therapeutic opportunities. Cellular Oncology 44: 1209–1229. 10.1007/s13402-021-00634-9
Rao, A., D. Barkley, G. S. França, and I. Yanai, 2021 Exploring tissue architecture using spatial transcriptomics. Nature 596: 211–220. 10.1038/s41586-021-03634-9
Wu, S. Z., G. Al-Eryani, D. L. Roden, S. Junankar, K. Harvey et al., 2021 A single-cell and spatially resolved atlas of human breast cancers. Nature Genetics 53: 1334–1347. 10.1038/s41588-021-00911-1
Cable, D. M., E. Murray, L. S. Zou, A. Goeva, E. Z. Macosko et al., 2022 Robust decomposition of cell type mixtures in spatial transcriptomics. Nature Biotechnology 40: 517–526. 10.1038/s41587-021-00830-w
Dimitrov, D., D. Türei, M. Garrido-Rodriguez, and others, 2022 Comparison of methods and resources for cell-cell communication inference from single-cell RNA-Seq data. Nature Communications 13: 3224. 10.1038/s41467-022-30755-0
Domínguez Conde, C., C. Xu, L. B. Jarvis, D. B. Rainbow, S. B. Wells et al., 2022 Cross-tissue immune cell analysis reveals tissue-specific features in humans. Science 376: eabl5197. 10.1126/science.abl5197
Kleshchevnikov, V., A. Shmatko, E. Dann, A. Aivazidis, H. W. King et al., 2022 Cell2location maps fine-grained cell types in spatial transcriptomics. Nature Biotechnology 40: 661–671. 10.1038/s41587-021-01139-4
Palla, G., H. Spitzer, M. Klein, and others, 2022 Squidpy: a scalable framework for spatial omics analysis. Nature Methods 19: 171–178. 10.1038/s41592-021-01358-2
Janesick, A., R. Shelansky, A. D. Gottscho, and others, 2023 High resolution mapping of the tumor microenvironment using integrated single-cell, spatial and in situ analysis. Nature Communications 14: 8353. 10.1038/s41467-023-43458-x
Kumar, T., K. Nee, R. Wei, S. He, Q. H. Nguyen et al., 2023 A spatially resolved single-cell genomic atlas of the adult human breast. Nature 620: 181–191. 10.1038/s41586-023-06252-9
Xu, C., M. Prete, S. Webb, L. Jardine, B. J. Stewart et al., 2023 Automatic cell-type harmonization and integration across Human Cell Atlas datasets. Cell 186: 5876–5891.e20. 10.1016/j.cell.2023.11.026
Croizer, H., R. Mhaidly, Y. Kieffer, G. Gentric, L. Djerroudi et al., 2024 Deciphering the spatial landscape and plasticity of immunosuppressive fibroblasts in breast cancer. Nature Communications 15: 2806. 10.1038/s41467-024-47068-z
Dimitrov, D., M. H. Schaefer, and others, 2024 LIANA+ provides an all-in-one framework for cell-cell communication inference. Nature Cell Biology 26: 1613–1622. 10.1038/s41556-024-01469-w
Marconato, L., G. Palla, K. A. Yamauchi, I. Virshup, L. Heumos et al., 2024 SpatialData: an open and universal data framework for spatial omics. Nature Methods 21: 2196–2209. 10.1038/s41592-024-02212-x
Virshup, I., S. Rybakov, F. J. Theis, P. Angerer, and F. A. Wolf, 2024 anndata: Access and store annotated data matrices. Journal of Open Source Software 9: 4371. 10.21105/joss.04371
Wang, X., D. Venet, F. Lifrange, and others, 2024 Spatial transcriptomics reveals substantial heterogeneity in triple-negative breast cancer with potential clinical implications. Nature Communications 15: 10232. 10.1038/s41467-024-54145-w
CellTypist developers CellTypist: automated cell type annotation for scRNA-seq datasets. https://www.celltypist.org/
Did you use this material as an instructor? Feel free to give us feedback on how it went.
Did you use this material as a learner or student? Click the form below to leave feedback.
Hiltemann, Saskia, Rasche, Helena et al., 2023 Galaxy Training: A Powerful Framework for Teaching! PLOS Computational Biology 10.1371/journal.pcbi.1010752
Batut et al., 2018 Community-Driven Data Analysis Training for Biology Cell Systems 10.1016/j.cels.2018.05.012
@misc{single-cell-spatial-breast-cancer-tme-SPICA,
author = "Khaled Jum'ah and Krzysztof Poterlowicz",
title = "Spatial transcriptomics analysis of the breast cancer tumour microenvironment with Visium (Galaxy Training Materials)",
year = "",
month = "",
day = "",
url = "\url{https://training.galaxyproject.org/training-material/topics/single-cell/tutorials/spatial-breast-cancer-tme-SPICA/tutorial.html}",
note = "[Online; accessed TODAY]"
}
@article{Hiltemann_2023,
doi = {10.1371/journal.pcbi.1010752},
url = {https://doi.org/10.1371%2Fjournal.pcbi.1010752},
year = 2023,
month = {jan},
publisher = {Public Library of Science ({PLoS})},
volume = {19},
number = {1},
pages = {e1010752},
author = {Saskia Hiltemann and Helena Rasche and Simon Gladman and Hans-Rudolf Hotz and Delphine Larivi{\`{e}}re and Daniel Blankenberg and Pratik D. Jagtap and Thomas Wollmann and Anthony Bretaudeau and Nadia Gou{\'{e}} and Timothy J. Griffin and Coline Royaux and Yvan Le Bras and Subina Mehta and Anna Syme and Frederik Coppens and Bert Droesbeke and Nicola Soranzo and Wendi Bacon and Fotis Psomopoulos and Crist{\'{o}}bal Gallardo-Alba and John Davis and Melanie Christine Föll and Matthias Fahrner and Maria A. Doyle and Beatriz Serrano-Solano and Anne Claire Fouilloux and Peter van Heusden and Wolfgang Maier and Dave Clements and Florian Heyl and Björn Grüning and B{\'{e}}r{\'{e}}nice Batut and},
editor = {Francis Ouellette},
title = {Galaxy Training: A powerful framework for teaching!},
journal = {PLoS Comput Biol}
}
Congratulations on successfully completing this tutorial!
You can use Ephemeris's shed-tools install command to install the tools used in this tutorial.