Skip to content

Making changes ​

Everything the viewer shows comes from files you own: one dataset yaml per dataset and, for a gallery, site.yaml. This page is the map from "I want to change X" to the line to edit and the command to rerun. There is one command per dataset, spatialscape build <yaml>, and it only redoes the work an edit requires: a rename or a new palette takes seconds, a changed annotation column rebuilds the samples that carry it, a re-exported file rebuilds that sample.

I want toEditThen run
Rename the dataset, change its descriptionname: / description:build (seconds)
Choose the gene shown on opendefault_gene: SNAP25build (seconds)
Open on an annotation insteaddefault_color: { field: domain }build (seconds)
Name an annotation properly ("Spatial domain", not "BS k16 …")name: on its entry under fields:build (seconds)
Compare conditions side by side in the viewermeta: { condition: stress } on each sample (or { column: condition }), optionally meta: at the top for names and orderbuild (seconds for typed values; the sample once for a column)
Show fewer / other annotationsthe fields: mapping on the sample entry: delete or uncomment linesbuild (rebuilds those samples)
Use my paper's colorspalette: colors.json plus palette_key: on the fieldbuild (seconds)
Fix the order of categoriescategories: [L1, L2, …] on the fieldbuild (rebuilds the samples that carry it)
Merge spellings (AI and IA)aliases: { AI: IA } on the fieldbuild (rebuilds the samples that carry it)
Put QC metrics in one unit across platforms{ column: expr_chrM_ratio, scale: 100 } in the mappingbuild
Change which section is the thumbnailthumbnail_sample: vis_Br8325build (seconds)
Space the sections outlayout: { gutter_fraction: 0.3 }build (seconds)
Re-export one samplefix the file, keep the yamlbuild (rebuilds that sample)
Add a sampleadd it to samples:, or let the glob find itbuild (builds the new one)
Remove a sampledelete its entrybuild (deletes its folder)
Use another assay from an R objectassay: counts on the entrybuild (converts again, rebuilds)
Add a dataset to the gallerya config: line in site.yamlspatialscape site build site.yaml
Add a paper link, tags or a "coming soon" cardpaper:, tags:, or an id: + name: card in site.yamlsite build
Add a navigation bar above the viewernav: in site.yamlsite build

Not sure what a build will do? spatialscape build <yaml> --dry-run lists every sample with build / skip and the reason.

The same yaml, before and after ​

spatialscape init writes the menu. This is the amygdala Visium dataset as init left it, comments trimmed:

yaml
id: amygdala_visium
name: Human amygdala Visium
default_color: { field: domain }
layout: { mode: grid }
fields:
  - { id: domain, name: Spatial domain, type: categorical }
  - { id: total_counts, name: Total counts, type: continuous }
  - { id: detected_genes, name: Detected genes, type: continuous }
  - { id: mito_percent, name: Mito %, type: continuous }
samples:
  - path: ../Vitessce_app/spe_amy_shinyapp.rds   # SpatialExperiment, 7 samples: Br2743, Br3942, ... (one sample per sample_id)
    platform: visium
    assay: logcounts
    id: "vis_{name}"
    name: "{name} (Visium)"
    group: "{name}"
    fields:
      domain: BS_k16_Semisupervised_wAI          # 16 levels: CeA, MeA, BLA, ...
      total_counts: sum_umi
      detected_genes: sum_gene
      mito_percent: { column: expr_chrM_ratio, scale: 100 }
      # domain: BS_k8                            # alternative; 8 levels
      # subject: subject                         # 7 levels: Br2743, Br3942, ...

and after a description, the paper's colors and the opening view:

yaml
id: amygdala_visium
name: Human amygdala Visium
description: Seven donors, BayesSpace domains with manual relabeling, lowres H&E.
default_gene: PENK
default_color: { field: domain }
palette: ../Vitessce_app/build/handoff/palette.json     # { "visium_semisupervised": { "CeA": "#8b2e17", ... } }
thumbnail_sample: vis_Br8325
layout: { mode: grid }
fields:
  - { id: domain, name: Spatial domain, type: categorical, palette_key: visium_semisupervised, aliases: { AI: IA } }
  - { id: total_counts, name: Total counts, type: continuous }
  - { id: detected_genes, name: Detected genes, type: continuous }
  - { id: mito_percent, name: Mito %, type: continuous }
samples:
  - path: ../Vitessce_app/spe_amy_shinyapp.rds
    platform: visium
    assay: logcounts
    id: "vis_{name}"
    name: "{name} (Visium)"
    group: "{name}"
    fields:
      domain: BS_k16_Semisupervised_wAI
      total_counts: sum_umi
      detected_genes: sum_gene
      mito_percent: { column: expr_chrM_ratio, scale: 100 }

The aliases line changes codes, so this edit rebuilds the seven samples once; every later edit that the table above marks "seconds" is just that.

Colors ​

A palette file is JSON: top-level keys are palette names, each mapping a category label to a hex color. A field uses it through palette_key; several keys can be listed, first match wins. Labels missing from the palette get an automatic color. Categories are matched by label, so renaming a label in aliases also changes which color it gets.

json
{ "domain": { "L1": "#F0027F", "L2": "#377EB8", "WM": "#1A1A1A" } }

Two datasets, one vocabulary ​

When two datasets, or two platforms within one, label the same cell types, give them the same field id and the same palette_key. A Cell type field shared by a Xenium section and an snRNA-seq UMAP then uses one legend and one set of colors, and the viewer greys out samples that do not carry it.

Starting over ​

build --force rebuilds every sample from the yaml and the source files; deleting the bundle folder does the same. Neither is needed for ordinary edits.

MIT licensed.