Skip to content

dataset.yaml schema ​

Validated by pydantic models in python/src/spatialscape/config.py. Unknown keys are errors. Paths are resolved relative to the YAML file. spatialscape init writes a yaml with every optional key present as a comment; spatialscape build <yaml> writes the bundle to bundles/<id> next to the yaml unless -o says otherwise.

Top level ​

KeyTypeDefaultNotes
idstringrequireddataset id
namestringrequired
descriptionstring
default_genestringmust exist in the gene union
default_color{gene} or {field}first categorical field
palettepath{vocabulary: {label: "#hex"}} JSON
layout{mode, order, gutter_fraction, columns}grid, build order, 0.1, fittedcolumns fixes the grid width, e.g. 3 for a 3 × 3 of species by cell class
thumbnail_samplesample idfirst spatial sample
shard_genesint512genes per shard (capped to ~128 MB)
shardedbooltruesharded Zarr (one range request per gene; needs HTTP Range support) or one file per gene (false, for GitHub Pages and other hosts without Range). build --no-shard sets it for one run; put it here so site build and later builds keep it
feature_groupslist of {id, name, pattern, strip, units}[]regex over var names
fieldslist of field specs[]declarations; undeclared fields are inferred
metalist of {id, name, levels}[]sample metadata keys: display name and level order; keys used only on samples need no entry. See Sample metadata
comparisonslist of {id, kind, name, description, results, pseudobulk, replicates, groups, units, population, split, link, facet, columns}[]differential expression results fit upstream: results (one row per gene), pseudobulk (genes × replicates), replicates (id, group, subject), groups in pane order, population {field, value}, split / link meta keys, columns {results: {role: column}, replicates: {role: column}}. See Comparisons kind: markers for a marker table (every level of the facet column against the rest); facet: {column, field} splits a table into one contrast per level, and {level} in results / pseudobulk names one file per level
defaultsmapping{}merged into every sample
platforms{platform: mapping}{}merged into samples of that platform
sampleslist of sample entriesrequiredmay contain glob: entries

Field spec ​

KeyTypeNotes
idstringfield id used by samples and the viewer
namestringdisplay name; default id
typecategorical or continuous
vocabularystringshare one vocabulary across fields; default id
categorieslistexplicit order; others append first-seen
aliases{source: canonical}merge labels at build time
palette_keystringkey(s) in the palette file, comma-separated fallbacks
colormap, rangecontinuous fields only

Sample entry ​

KeyTypeDefaultNotes
globpatternexpands to one sample per match; {name}, {stem}, {dir}, {i} templates
overrides{<sample>: {keys}}with glob or an R object: settings for single samples, keyed by {name} ({stem} in flat layouts, or the rendered id); dicts merge, lists and scalars replace; an unknown sample name is an error. { Br9902_1: { images: [] } }
path ending in .rds / .rdapathan R object: converted by build into bundles/.cache/<id>/ and expanded into one sample per sample_col value, or one embedding sample; {name} is the sample id. See R objects as samples
assay, sample_col, embedding, objectstringlogcounts, sample_id, UMAP,R objects only: the assay drawn (for a Seurat object a layer of its gene assay, data or counts; its other assays become peak: / activity: / motif: features), the column that splits samples, the reducedDims entry or Seurat reduction for objects without spatialCoords, the object to take from an .rda
idstringsanitized {name}unique
namestringid
platformvisium, visium_hd, xenium, merfish, codex, snrnaseq, otherrequiredcodex covers PhenoCycler, MICS and IMC: pixel coordinates, microns: required
kindspatial or embeddingspatial
groupstringdonor or batch label
pathpathrequiredh5ad, AnnData zarr, SpatialData zarr, or an R object (above)
tablestringSpatialData table key
coordsstringobsm/spatialor obs/x,obs/y
expression{layer, normalized, keep_f16}X, auto, falsenormalized: auto, lognorm, counts
micronsone of already_microns, microns_per_unit, spot_diameter_fullres, spot_spacing, scalefactors_jsoninferred
transform{flip: none | x | y, rotate: 0 | 90 | 180 | 270}noneapplied to points and images
fields{field_id: obs_column} or {field_id: {column, scale}} or auto{}scale multiplies a numeric column, e.g. 100 to show a ratio as a percent
meta{key: value | {column}}{}sample-level metadata (condition, subject, ...): a templated string, or an obs column that holds one value in the sample; the viewer splits the canvas by these keys
imageslist of image specs or autoauto
molecules{path, feature_column, x_column, y_column, qv_column, min_qv, cell_column, nucleus_column, affine}individual molecules from a long table, Parquet, CSV or TSV (10x transcripts.parquet names are the defaults; min_qv 20); vertices share the raw frame of polygons, whose affine is inherited
segmentationslist of {id, name, path, id_column, x_column, y_column, max_vertices, affine} or autoautoother boundary sets of the section, drawn over the cells for comparison; auto takes a Xenium nucleus_boundaries.parquet next to the polygons' cell_boundaries.parquet; affine defaults to the polygons'
polygons{path | obsm, id_column, x_column, y_column, max_vertices, affine}auto from obsmone of path (a long table: Parquet, CSV or TSV, one row per vertex) or obsm (n, v, 2); affine maps vertices into the coordinate frame
subset{column, values}all rowskeep only observations whose obs column takes one of the values; one file can then appear as several samples (one panel per cell class, per condition, ...)
tracks{fragments | bigwigs, by, genome, bin, normalize, tss_window, chrom_sizes, sample_column, barcode_column, units, genes, links}genome tracks for ATAC samples: fragments (a bgzipped fragment file, or {run: file} with sample_column naming each observation's run when the object pools several runs; a file may be ssh://host/path, streamed and never stored) or bigwigs ({by: {field: "dir/{label}.bw" | {label: path}}, all} exported by another tool), by (categorical field ids, one bigWig per category), genome (hg38, mm10 or mm39 carry built-in chromosome sizes), bin (25 bp for fragments; read from bigWigs), normalize (nfrags per million insertions, tss per million insertions within tss_window bp of a TSS, cells per nucleus), optional chrom_sizes, barcode_column, units (the panel's scale label), genes (a GTF, genePred or BED file, refseq to download UCSC's table once, none) and links BEDPE. See Genome tracks
extentnumber5000embeddings: world size of the longest side
point_radiusµmper platformVisium 27.5, Xenium 5, HD from spacing
seedint7row shuffle
gene_columnvar columnvar_namesfeature names; when var_names are Ensembl ids and a gene_name / symbol column exists, that column is used by default (missing symbols keep their id, duplicates get .1, .2)

Image spec ​

KeyTypeDefault
id, namestringimage, Image
pathpathrequired
kindrgb or multichannelrgb
pixel_sizeµm per level-0 pixel, or autoauto
pixels_per_unitimage pixels per coordinate unit1.0
translate[x, y] µm[0, 0]
transpose, flipbool, x/y/xyfalse, none
channelslist of {name, color, window}
default_opacity0..11
max_sizeint
cropbooltrue
mask, mask_marginbool, µmfalse, 150

MIT licensed.