Visium HD End-to-End Pipeline¶
This tutorial walks through end‑to‑end processing of 10x Visium HD data with CartLoader: converting inputs, running FICTURE, importing cell results and histology, packaging assets, and uploading for sharing.
Prepare Input¶
Data Access¶
Download the ST data from the 10x Genomics Dataset portal.
If you have wget installed, use the following commands to download the output from 10X.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
If you have curl installed, use the following commands to download the output from 10X.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Data Structure and Format¶
See Space Ranger output details in the official documentation: Space Ranger Outputs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
Visium HD slides use a 2×2 µm grid of barcoded squares (square_002um) for high-resolution spatial gene mapping. Use filtered_feature_bc_matrix to only process tissue-associated signals.
ATTENTION
The file‑format examples below use a sample Visium HD dataset. Paths, IDs, and values are illustrative and may not match the dataset used in this tutorial.
SGE comprises several key files as follows:
filtered_feature_bc_matrix/barcodes.tsv.gz – spatial barcode for tissue locations
1 2 3 | |
- Column 1: Spatial barcodes corresponding to specific locations on the tissue section.
filtered_feature_bc_matrix/features.tsv.gz – feature metadata
1 2 3 | |
- Column 1: Feature ID
- Column 2: Feature symbol
- Column 3: Feature type
filtered_feature_bc_matrix/matrix.mtx.gz – expression count matrix
1 2 3 4 5 6 | |
Header: Initial lines form the header, declaring the matrix's adherence to the Market Matrix (MTX) format, outlining its traits. This may include comments (lines beginning with%) for extra metadata, all marked by a “%”.Dimensions: Following the header, the first line details the matrix dimensions: the count of rows (features), columns (barcodes), and non-zero entries.Data Entries: After the dimensions, each subsequent line provides three fields: row index (feature index), column index (barcode index), and the expression-count value.
tissue_positions.parquet – spatial barcode metadata
1 2 | |
barcode: Unique spatial barcode associated with each capture spot.in_tissue: Binary flag (1 = in tissue, 0 = background) indicating whether the spot falls within the tissue boundary.array_row,array_col: Integer indices representing the position of the spot on the capture array grid.pxl_row_in_fullres,pxl_col_in_fullres: Floating point coordinates locating the spot in full-resolution tissue image pixels.
scalefactors_json.json – pixel-to-micrometer scaling factors
1 2 3 4 5 6 7 8 9 | |
spot_diameter_fullres: Estimated diameter of a barcoded spot in full-resolution pixels.bin_size_um: Physical size (in micrometers) of the smallest bin, typically 2.0 µm for Visium HD.microns_per_pixel: Resolution of the full-res image, used to convert pixel distances to micrometers.regist_target_img_scalef: Scaling factor applied during image registration to the target image.tissue_lowres_scalef: Downscaling factor from full-res to low-resolution tissue image.fiducial_diameter_fullres: Diameter of fiducial markers in full-resolution pixels, useful for alignment.tissue_hires_scalef: Downscaling factor from full-res to high-resolution tissue image.
Cell Segmentation Mask
Location: segmented_outputs/cell_segmentations.geojson
1 2 3 | |
Cell Feature Matrix
Location: segmented_outputs/filtered_feature_cell_matrix
This contains barcodes.tsv.gz,features.tsv.gz, matrix.mtx.gz, providing cell id, feature information, and expression count matrix, respectively.
Clusters
Location: segmented_outputs/analysis/clustering/gene_expression_graphclust/clusters.csv
1 2 3 | |
Differentially Expressed Genes
Location: segmented_outputs/analysis/diffexp/gene_expression_graphclust/differential_expression.csv
1 2 3 | |
Define ID and Parameters¶
1 2 3 4 5 6 7 8 9 | |
How to define scaling for Visium HD?
10x Visium HD provides scalefactors_json.json (pixel‑to‑µm). CartLoader accepts it via --scale-json and computes the scaling automatically, so you don’t need to manually specify --units-per-um.
Alternatively, provide the scale directly with --units-per-um.
Example Runs¶
Choose one of the following options to run the run_visiumhd pipeline, either locally or with Docker.
Run Pipeline Locally¶
Set Up Environment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Example Command
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
Run Pipeline via Docker¶
Set Up Environment
Fixed paths in the Docker Image
Tools and dependencies have fixed paths in the Docker image (for example, /usr/local/bin/pmtiles).
DO NOT modify paths of tools and dependencies manually.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Example Command
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
Customize Parameters¶
Action Flags to Enable Modules
Actions
run_visiumhd runs multiple CartLoader modules together; enable and combine actions with flags.
CartLoader Modules |
Flags in run_visiumhd |
Actions | Prerequisites |
|---|---|---|---|
load_space_ranger |
--load-space-ranger |
Summarize Space Ranger outputs into JSON | Space Ranger Output files |
sge_convert |
--sge-convert |
Convert SGE to CartLoader format; optional density filter and visuals |
Space Ranger assets JSON (from load_space_ranger) or transcript CSV/Parquet |
run_ficture2 |
--run-ficture2 |
FICTURE analysis | SGE (from sge_convert); FICTURE parameters (--width, --n-factor) |
import_space_cell |
--import-cells |
Import cell points, boundaries, cluster, de; | Space Ranger assets JSON or manual CSVs; also --cell-id |
import_image |
--import-images |
Import background images (BTF-TIFF) → PNG/PMTiles; | Space Ranger assets JSON or --tifs; also --image-ids/--all-images |
run_cartload2 |
--run-cartload2 |
Package SGE, optional FICTURE/cells/images into PMTiles; write catalog.yaml |
SGE, optional FICTURE assets or any imported cell/image assets; --id |
upload_aws |
--upload-aws |
Upload catalog and PMTiles to S3 | catalog.yaml (from run_cartload2); --s3-bucket, --id |
upload_zenodo |
--upload-zenodo |
Upload catalog and PMTiles to Zenodo | catalog.yaml (from run_cartload2); --zenodo-token |
Parameter Requirements by Action Flag
Below are explanations of the parameters used in the example. For the full list, see the run_visiumhd reference page.
| Parameter | Required when flags | Description |
|---|---|---|
--space-ranger-dir |
--load-space-ranger |
Space Ranger output directory to scan. |
--space-ranger-assets |
optional --load-space-ranger |
Output JSON manifest path (defaults under --out-dir). |
--width |
--run-ficture2 |
Hexagon width(s) in µm for training/projection. |
--n-factor |
--run-ficture2 |
Factor count(s) for FICTURE training. |
--cell-id |
--import-cells |
Asset ID/prefix for cell outputs. |
--image-ids or --all-images |
--import-images |
Choose specific image IDs or import all detected. |
--id |
--run-cartload2 |
Catalog ID (used in catalog.yaml and outputs). |
--s3-dir |
--upload-aws |
Destination S3 path (e.g., s3://bucket/prefix). |
--out-dir |
any action | Output root directory for generated artifacts. |
--dry-run, --restart |
optional (any) | Control execution (preview or rerun ignoring existing outputs). |
--n-jobs, --threads |
optional (any) | Parallelism for Make/GDAL/tippecanoe steps. |
Outputs¶
-

View/Explore¶
The outputs are available in CartoScope.
See output details in the reference pages for run_ficture2 and run_cartload2.