Configure defaults¶
Every parameter you can adjust in Skopia's dialogs starts from a default. You can change those defaults for yourself, without editing the code, by writing a small YAML or JSON file. Use it to set the point size and color scale you always switch to, or the filter thresholds your lab uses.
Where to find it
A file at ~/.skopia/config.yaml, or any path named by the SKOPIA_CONFIG_PATH environment variable. Check what loaded at GET /api/config/defaults.
How it works¶
Skopia reads two layers when the backend starts and merges them:
- Shipped defaults.
backend/skopia/config.yamlin the repository gives every adjustable parameter a default. It is the reference for every key and its allowed values. - Your overrides. The first file found of:
- the file
SKOPIA_CONFIG_PATHpoints to (when the variable is set, the files below are not consulted), ~/.skopia/config.yaml,~/.skopia/config.yml,~/.skopia/config.json.
- the file
Your file is deep-merged over the shipped one, key by key: nested mappings merge, and any other value you give (a number, a string, a list, or null) replaces the shipped value at that spot. So your file only needs the keys you want to change; every other default still comes from the shipped file.
The browser fetches the merged result when the page loads and applies it:
- Display settings go to every loaded dataset at startup and again to each dataset you load later. You can still change them in the Display panel for the session.
- Dialog fields start from the config values instead of the built-in ones.
Set it up¶
- Create the folder and file:
- Add only the keys you want to change (see the example below). Use the shipped file to find the key names, or start from
docs/config.example.yaml, a commented sample of common overrides. - Restart the backend, then reload the page. The config is read once at backend startup.
- Confirm what loaded: open
http://127.0.0.1:8000/api/config/defaultsin a browser (the backend's address; adjust the port if you changed it).
To keep several configurations (one per project, say), point SKOPIA_CONFIG_PATH at the one you want when you start the backend:
Example¶
# ~/.skopia/config.yaml: only what differs from the shipped defaults
display:
point_size: 3
color_scale: magma
background_color: '#000000'
scanpy:
filter_cells:
min_genes: 200
neighbors:
n_neighbors: 20
leiden:
resolution: 1.0
diff_exp:
method: t-test
enrichment:
n_perm: 5000
Sections¶
Keys are snake_case. Dialog parameters sit under the dialog's section and, for the Analyze operations, under the operation's name: scanpy.<operation>.<parameter>.
| Section | Sets the defaults for |
|---|---|
display |
Display panel: point_size, point_opacity, background_color, color_scale, bivariate_colormap, expression_transform, clip_percentile, gene set scoring (gene_set_per_gene_norm, gene_set_per_gene_clip, gene_set_aggregation, gene_set_scoring_method), show_grid, show_scale_bar, label_font_size |
line_smoothing |
Smoothing of drawn shapes (window_size, iterations) |
line_association |
Gene association along a drawn line |
scanpy |
Every operation under Analyze: Preprocess (calculate_qc_metrics, exclude_genes, filter_cells, filter_genes, normalize_total, highly_variable_genes, smooth), Cells (pca, neighbors, umap, leiden, embedding_from_obs), Genes (gene_pca, gene_neighbors, build_gene_graph, find_similar_genes, cluster_genes, add_var_boolean), Spatial (spatial_neighbors, spatial_autocorr) and multi-genome (sum_counts_by_pattern, assign_species) |
marker_genes |
Marker genes: genes per group shown (top_n), rows kept per group in a stored run (store_top_n), filters |
diff_exp |
Differential expression: test, correction, filters |
enrichment |
Overlap (ORA) and GSEA: set size limits, permutations, cutoffs |
figures |
Display defaults for new figures, per kind (enrichment_heatmap, enrichment_network, composition_barplot, expression_heatmap, expression_dotplot, cnv_heatmap, embedding_panels) |
cluster_gene_sets |
Cluster gene sets |
heatmap |
Expression heatmap: cell and gene ordering, bins, marker rows |
contour |
Contour (grid resolution and smoothing are suggested per dataset instead) |
ligrec |
Ligand-receptor (radius, permutations and minimum cells are suggested per dataset instead) |
gene_mask |
Gene mask combine mode |
select_by_expression |
Select by expression |
define_sections |
Define Sections: the column name written |
gene_set_sources |
Gene set library: cache folder, how long a source's catalogue is cached, STRING score floor and partner limit |
cluster_cells_by_gene_set |
Cluster cells on a gene set |
gene_set_decomposition |
Decompose a gene set into programs |
gene_map |
Gene map |
Value conventions¶
- Values match the dialog control: numbers, booleans, or the exact option string a dropdown expects (
color_scale: magma,flavor: seurat_v3). - Some select fields offer
true/falseas text. In the shipped file these are quoted strings (scale: 'false'); copy that form. nullor''means unset: the dialog leaves the field blank or derives it from the data.- Keys Skopia does not know are ignored without a message, and so is a display value of the wrong type. A typo in a key name therefore looks like "my setting had no effect"; check the spelling against the shipped file.
Check what loaded¶
GET /api/config/defaults returns the merged configuration and where it came from:
{
"config": { "display": { "point_size": 3, "...": "..." }, "scanpy": { "...": "..." } },
"meta": { "path": "/Users/you/.skopia/config.yaml", "loaded": true, "error": null }
}
meta field |
Meaning |
|---|---|
path |
Your override file, or the shipped file when you have none |
loaded |
true when that file parsed |
error |
The parse error, if any |
If your file fails to parse, Skopia starts anyway with the shipped defaults, logs the error in the backend's output, and reports it in meta.error. A file whose top level is not a mapping is an error too.
Environment variables¶
| Variable | Read by | Effect |
|---|---|---|
SKOPIA_DATA_PATH |
Backend, at startup | File to load into the first dataset (any format File → Load… accepts). Unset: the bundled toy dataset toy_spatial.h5ad loads. |
SKOPIA_CONFIG_PATH |
Backend, at startup | Your configuration file; replaces the ~/.skopia/ lookup |
SKOPIA_BACKEND |
Frontend dev server (pixi run dev) |
Where /api requests are forwarded. Default http://127.0.0.1:8000. Set it to run the frontend against a backend on another port or host. |
XDG_CACHE_HOME |
Backend | Base of the gene set library cache ($XDG_CACHE_HOME/skopia/gene_set_sources, else ~/.cache/skopia/gene_set_sources) unless gene_set_sources.cache_dir is set |
SKOPIA_DATA_PATH=/data/limb_E11.5.h5ad SKOPIA_CONFIG_PATH=~/limb.yaml pixi run backend
SKOPIA_BACKEND=http://127.0.0.1:8001 pixi run dev
The XCELL_* names from before the rename to Skopia are no longer read.
Tips and pitfalls¶
Restart the backend after editing
The file is read once, when the backend starts. Editing it while Skopia runs changes nothing until the restart, and the browser picks up the new values on the next page load. A restart unloads your datasets: export first (Save and export).
Filter Genes takes a percentage
The Min cells field in Filter Genes is a percentage of cells, and its config key is scanpy.filter_genes.min_cells_pct (default 0.1). A min_cells key is not read for that field.
Defaults are a starting point
The config sets what a dialog shows when it opens. What actually ran is what the dialog sent, and that is what the analysis record stores, so a notebook export reproduces the run whatever your config said.