Seq-Scope Starter Tutorial¶
This tutorial uses an example SGE from mouse hippocampus, extracted via spatial masking from a Seq-Scope coronal brain slice.
It first runs the whole analysis with a single run_together command, then walks through the same analysis step by step: input preparation, SGE format conversion, FICTURE analysis, asset packaging, and data upload.
Run with run_together¶
Download the example data, hosted on Zenodo (10.5281/zenodo.17953582), into a work directory:
1 2 3 4 | |
Then run the pipeline, either with a local installation or with the Docker image:
1 2 3 4 5 6 7 8 | |
1 2 3 4 5 6 7 8 9 | |
The Seq-Scope profile reads the MEX directory given by --in-dir and converts its nanometer coordinates to µm. The result to deploy is out/seqscope_hippo/cartl/seqscope_hippo/ (a catalog.yaml and the PMTiles it lists). Add --dry-run to print the commands without running them.
How run_together differs from the step-by-step path
- FICTURE runs through
run_ficture2_multi(a joint model over a single sample) with single-molecule pixel decoding, instead ofrun_ficture2. - Feature filters are the
run_togetherdefaults: control features (Unassigned,Neg,BLANK/Blank,Intergenic,Deprecated,System,NCS-,NCP-) are dropped at ingest; predicted (Gm<digit>), mitochondrial (mt-/MT-), and ribosomal (Rps/Rpl) genes stay in the data but are left out of the factor models. Change them with--ingest-exclude-feature-regexand--exclude-feature-regex. - Point layers are packaged with
pmpoint(--use-pmpoint, 500 gene bins) instead oftippecanoe. - Outputs go under
--out-dir:tsv/<id>/(converted SGE),fic/(FICTURE), andcartl/<id>/(PMTiles andcatalog.yaml; deploy this), instead ofsge/,ficture2/, andcartload2/. - Publishing is built in:
--s3-uploaduploadscartl/<id>/to S3 (see Publishing). For Zenodo, runupload_zenodooncartl/<id>/as in the step-by-step path.
In addition, the Seq-Scope profile counts the matrix's second count column ("GeneFull", --icols-mtx 2), whereas sge_convert below uses the first ("Gene", its default), so the counts differ slightly.
Step by Step (Individual Commands)¶
The same analysis, one command at a time. Use it to understand each stage or to customize it.
Set Up the Environment¶
1 2 3 4 5 6 7 8 9 10 | |
No tool paths needed
Once submodules/build.sh has run (see Installation), every CartLoader command finds spatula, punkst, tippecanoe, pmtiles, and pmpoint in the submodules/ directory of the repository, and the default color map at assets/default_color_map.tsv. Pass --spatula, --ficture2 (the punkst repository directory, which contains bin/punkst), --tippecanoe, --pmtiles, or --cmap-file only to use a different build or file. upload_aws runs the aws CLI from your PATH (--aws to override).
Input Data¶
Use the data downloaded above. Actual input formats are platform-dependent; see the other platform tutorials for theirs.
SeqScope provides SGE with three files:
barcodes.tsv.gz – spatial barcode metadata
1 2 3 | |
- Column 1: Sorted spatial barcodes
- Column 2: 1-based integer index of spatial barcodes, used in
matrix.mtx.gz - Column 3: 1-based integer index from the full barcode that is in the STARsolo output
- Column 4: Lane ID (fixed as
1) - Column 5: Tile ID (fixed as
1) - Column 6: X-coordinates
- Column 7: Y-coordinates
- Column 8: Five comma-separated numbers denote the count per spatial barcode for "Gene", "GeneFull", "Spliced", "Unspliced", and "Ambiguous".
features.tsv.gz – feature metadata
1 2 3 | |
- Column 1: Feature ID
- Column 2: Feature symbol
- Column 3: 1-based integer index of genes, used in
matrix.mtx.gz - Column 4: Five comma-separated numbers denote the count per gene "Gene", "GeneFull", "Spliced", "Unspliced", and "Ambiguous".
matrix.mtx.gz – expression count matrix
1 2 3 4 5 | |
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, subsequent lines enumerate non‑zero entries in seven columns: row index (feature index), column index (barcode index), and five values (expression levels) corresponding to "Gene", "GeneFull", "Spliced", "Unspliced", and "Ambiguous".- "Gene": represents unique, confidently mapped transcript count ("gene name"-based);
- "GeneFull": denotes total transcript count assigned to gene (includes ambiguities).
Define ID and Parameters¶
1 2 3 4 5 6 7 8 | |
How to define Scaling Factors for Seq-Scope?
The latest SeqScope with an Illumina NovaSeq 6000 uses NovaScope pipeline to process sequencing data. NovaScope defaults to generate SGE at nanometer (nm) resolution, meaning each pixel corresponds to 1 nm.
Thus, use 1000 as scaling factor from coordinate to micrometer since 1000 nm = 1 µm.
SGE Format Conversion¶
Convert the raw input to the unified SGE format. See more details in SGE Format Conversion.
1 2 3 4 5 6 7 8 9 | |
| Parameter | Required | Type | Description |
|---|---|---|---|
--platform |
required | string | Input platform (options: 10x_visium_hd, seqscope, illumina, 10x_xenium, bgi_stereoseq, cosmx_smi, vizgen_merscope, pixel_seq, nova_st, generic) |
--in-mex |
required | string | Input MEX directory holding barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz |
--out-dir |
required | string | Output directory for the converted SGE files |
--units-per-um |
float | Coordinate units per µm in the input (default: 1). Seq-Scope MEX coordinates are in nanometers, so pass 1000 |
|
--icols-mtx |
int | Which of the matrix's count columns to use, 1-based (default: 1, the "Gene" count of Seq-Scope data) |
|
--makefn |
string | File name for the generated Makefile (default: sge_convert.mk) |
|
--exclude-feature-regex |
regex | Pattern of feature names to drop (e.g. control probes) | |
--sge-visual |
flag | Draw the converted SGE as an image (xy.png) for a visual check |
|
--n-jobs |
int | Number of parallel jobs (default: 1) |
FICTURE Analysis¶
Compute spatial factors using punkst (FICTURE2). See more details on the Reference page.
1 2 3 4 5 6 7 8 9 10 11 12 | |
| Parameter | Required | Type | Description |
|---|---|---|---|
--main |
required 1 | flag | Run all five main steps |
--in-transcript |
required | string | Path to the transcript-indexed SGE file from sge_convert |
--out-dir |
required | string | Output directory |
--width |
required | int or comma-separated list | Hexagon width(s) in µm for LDA training |
--n-factor |
required | int or comma-separated list | Number(s) of LDA factors; one model per width × factor combination |
--makefn |
string | File name for the generated Makefile (default: run_ficture2.mk) |
|
--in-feature |
string | Path to the per-gene count file from sge_convert (default: the feature list made during tiling) |
|
--in-minmax |
string | Path to the coordinate min/max file from sge_convert (default: the range computed during tiling) |
|
--exclude-feature-regex |
regex | Feature names to leave out of the factor analysis. punkst matches the whole name, so end each alternative with .* or $ as needed (the example drops mitochondrial mt-* and predicted Gm<digits> genes) |
|
--cmap-file |
string | Color map TSV (default: assets/default_color_map.tsv in the CartLoader repository) |
|
--n-jobs |
int | Number of parallel jobs (default: 1) |
|
--threads |
int | Number of threads per job (default: 4) |
1: CartLoader requires at least one action: --tile (tiling), --segment (hexagon segmentation), --init-lda (LDA training), --decode (pixel-level decoding), --umap (UMAP of the factors), or --main for all five.
CartLoader Asset Packaging¶
Package the SGE and the FICTURE results into PMTiles and a catalog.yaml for CartoScope. See more details in its Reference page.
1 2 3 4 5 6 7 | |
Packaging without factor analysis
To host only the SGE (no factors), use cartloader run_together ... --no-ficture, which tiles the transcripts and packages them without training any model.
| Parameter | Required | Type | Description |
|---|---|---|---|
--fic-dir |
required | string | FICTURE output directory from run_ficture2; must contain ficture.params.json (the SGE paths are read from it) |
--out-dir |
required | string | Output directory for the PMTiles, assets, and catalog.yaml |
--id |
required | string | Dataset ID used in the catalog and output metadata (no whitespace) |
--makefn |
string | File name for the generated Makefile (default: run_cartload2.mk) |
|
--n-jobs |
int | Number of parallel jobs (default: 1) |
|
--threads |
int | Number of threads per job (default: 4) |
|
--spatula, --tippecanoe, --pmtiles |
string | Tool paths (default: the copies built under submodules/) |
Upload to Data Repository¶
Choose a data repository to host/share your output
CartLoader supports two upload options (AWS and Zenodo) for storing PMTiles of SGE and spatial factors in a data repository.
Choose the one that best suits your needs.
Upload the generated CartLoader outputs to your designated AWS S3 directory. The aws CLI must be configured with credentials that can write there (see AWS Upload Failures).
1 2 3 4 5 6 7 | |
| Parameter | Required | Type | Description |
|---|---|---|---|
--in-dir |
required | string | Directory with the CartLoader packaging output (containing catalog.yaml) |
--s3-dir |
required | string | Target S3 directory |
--profile |
string | AWS CLI profile to use | |
--aws |
string | Path to the AWS CLI (default: aws) |
|
--n-jobs |
int | Number of parallel jobs (default: 2) |
Upload the generated CartLoader outputs to a new Zenodo deposition or an existing one (see Zenodo Setup for the access token).
1 2 3 4 5 6 7 8 9 | |
| Parameter | Required | Type | Description |
|---|---|---|---|
--in-dir |
required | string | Directory with the CartLoader packaging output |
--zenodo-token |
required | string | Path to the file holding your Zenodo access token |
--upload-method |
string | Which files to upload: all (every file in --in-dir; default), catalog (the files listed in catalog.yaml), or files (the names given with --files) |
|
--catalog-yaml |
string | Catalog to read with --upload-method catalog (default: <in-dir>/catalog.yaml) |
|
--zenodo-deposition-id |
string | Existing deposition to upload into (default: create a new one) | |
--title |
required 1 | string | Title of the deposition |
--creators |
required 1 | list of str | Creators in "Lastname, Firstname" format, each quoted |
--description |
string | Description of the deposition |
1: Required when creating a new deposition, or when the existing one lacks it.
Output Data¶
-

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