Skip to content

Gene sets

A gene set is a named list of genes: markers you typed, a pathway you imported, a cluster of co-expressed genes an analysis found. Sets drive most of what Skopia does with groups of genes: coloring cells by a set's score, heatmap rows, enrichment, contours, highlights and cell selection.

Where to find it

Genes panel → Sets tab. Manage sets… at the top of the tab opens the Gene Set Manager.

How sets are organized

Sets live in categories. Manual is yours; the others are filled by analyses and appear only once they hold something.

Category Filled by
Manual Sets you create, import from files or bundles, import from the Gene set library, make with Combine sets… or save from the gene map's lasso; also the top genes of each Spatial Autocorrelation run
Gene Clusters Cluster genes…, Decompose into programs…, gene map modules, Cluster Genes, NMF Programs and NMF Meta-Programs
Similar Genes Find Similar Genes
Differential Expression Add to gene sets in Diff Exp (Differential expression and markers)
Marker Genes Add to gene sets in Find Marker Genes
Line Association Gene association along a drawn line (Lines and trajectories)
Enrichment Add to gene sets in the Enrichment tool

Most analyses add a new folder per run, so you can compare runs side by side.

Each set row shows its gene count, (24), or for a directional set its up and down counts, (24↑ 6↓). Click a row to expand it and see its genes. The row's buttons:

Control What it does
🎨 Colors the embedding by the set's score, using the scoring method set in Display (see Scoring a set).
🖍 Adds the set's score as a highlight layer over the current coloring (intensity 0.85, above threshold, as Color → Highlight → + Gene set does). Click it again to tune the threshold and opacity or remove the layer. A directional set is scored on its up genes here. Sets with no genes in the dataset, or whose score is the same in every cell, are refused. See Display settings and highlights.
✕ Deletes the set.
⋯ Secondary actions, listed below.

Create a set

  • Type or paste genes. Click + on the Manual category header or on a folder, or Manage sets…. The New set tab takes symbols separated by spaces, commas, semicolons, tabs or new lines, and strips quotes, bullets and list numbers. It checks them against the dataset as you type: a match that differs only by case is stored in the dataset's spelling (sox9 becomes Sox9), and unknown symbols are listed and dropped unless you keep them. Pick the destination under Put it in.
  • Drag genes in. Tick genes in the search results and drag them onto a set. An empty set shows a Drag genes here target.
  • From a .var column. Under the sets, every boolean .var column is listed; its button adds the column's True genes as a set in Manual.
  • Combine two sets. ⨂ Combine sets… (below the sets) takes two operands, each a gene set from any category or a boolean .var column, and an operator: Union (A ∪ B), Intersection (A ∩ B), Difference (A − B) or Symmetric difference (A △ B). It suggests a name from the operands and writes the result to Manual. To merge more than two sets, use the Gene Set Manager's Merge tab.

Directional sets

A set can carry down genes next to its usual (up) genes: genes expected to be low where the program is active. Enter them in the Manager's Down genes field, or import them (see Import from a file). Expanded, a directional set lists its down genes after the others, marked ↓.

Down genes are used where direction has a meaning:

Where How down genes are used
UCell scoring Subtracted, weighted by w_neg (below)
GSEA Tested as a separate set, <name> (down)
Overlap enrichment (ORA) Pooled with the up genes, since overlap ignores sign
Mean-pipeline coloring and the 🖍 highlight Ignored: only up genes are scored
Save as .var column… Ignored unless you tick them in
Merge in the Manager Merged by the same rule as the up genes

OmniPath CollecTRI regulons and PCA programs from Decompose into programs arrive as directional sets.

Import from a file

  1. Click Import in the Genes panel header.
  2. Drop files onto the dialog or click to browse. Accepted: .gmt, .csv, .tsv, .txt, .json.
  3. Under Convert gene symbols to match your data, choose Leave as-is, Human (UPPERCASE, COL1A1) or Mouse (title case, Col1a1). Most human and mouse orthologs share a symbol up to case, so converting lets a set from the other species match by name.
  4. Check the preview and click Import.
Format How it is read
.gmt One set per line: name, description (ignored), then genes, tab-separated.
.csv, .tsv, .txt Comma- or tab-delimited. A single column is one set named after the file (or after the header, if the first row looks like one). Several columns are one set per column.
.json A list of {name, genes} objects, or {sets: [...]}. Down genes can be given as down (also negative or genesDown), up genes as up, positive, genesUp or genes. A folder field puts the set in that folder. This is the format Skopia exports.

In every format a trailing - on a symbol (CCR7-) makes it a down gene and a trailing + is stripped; this is UCell's signature convention.

A file holding one set adds that set to Manual. A file holding several adds a folder named after the file, plus one folder per folder value in a JSON file.

The same dialog offers the curated bundles that ship with Skopia (developmental signaling pathways, developmental GO slim, transcription factors, limb basics); see Gene set library and bundles.

Organize

  • Folders. In Manual, the + 📁 button on the category header makes a folder. Drag a top-level set onto a folder to move it in; drag it onto the strip above the first folder to move it back out. Deleting a folder that holds sets asks first.
  • Rename. Double-click a set or folder name.
  • Reorder. Drag sets within Manual, or folders within any category. A teal line shows where the item will land.
  • Pin. ⋯ → Pin to top (or Pin folder to top) floats a set or folder to the top of its container. Pinning works in every category and survives moving a set between folders. Pins are not exported.
  • Hide a category. The 👁 button on a category header hides it. A N hidden ▸ footer at the bottom of the panel lists hidden categories with Unhide buttons. Useful once a category such as Gene Clusters fills with runs you are done with.

The Gene Set Manager

Manage sets… (also ⋯ → Manage gene sets… in the panel header) opens one window for larger clean-ups. Every category, folder and set has a checkbox; a filter box narrows the tree by set name, folder name or a gene a set contains.

Tab or control What it does
New set Type or paste genes into a new set, with optional down genes, as described above.
Edit Click a set's name (or a set's ⋯ → Edit genes… in the panel) to rename it and edit its genes as text. Genes the current dataset lacks are kept, since a set is not tied to one dataset. Duplicate, Save, Revert, and Save as .var column… are here too.
Merge Combines every ticked set, keeping genes that are in any of them (union, the default), in all of them, or in at least k of them. It previews the count, suggests a name, files the result in any folder, and can delete the sources.
Delete ticked Deletes everything ticked after one confirmation. With the filter in use, ticks and Tick all matches take only what is shown, so a filtered delete never removes a set you could not see.
+ New folder and drag Drag a set onto a folder to move it (across categories too), or onto another set to merge into it: the target keeps its name and place and becomes the union, and the dragged set is deleted. The row under the pointer says which will happen. Undo is offered until the next change.

Clear all gene sets

⋯ → Clear all gene sets… (also in the File menu and the Manager) deletes every set and folder after a confirmation that states what goes. It offers Download a backup (JSON) first.

Save and export

Gene sets are kept by the running backend, so they survive a browser reload, but they are not written into the .h5ad and are lost when the backend stops. To keep them:

  • File → Export → Gene sets (.json) writes every set, with folders and down genes, in the format Import reads back.
  • A Manual folder's ⋯ → Export ▸ writes only that folder as JSON, GMT or CSV, named after the folder. GMT and CSV carry no down genes.
  • Save as .var column… puts one set into the dataset itself (below).

Save a set as a .var column

A set's ⋯ → Save as .var column… (or Edit → Save as .var column… in the Manager) writes a boolean .var column, True for the set's genes. The file then carries the set, and every .var gene-column picker can use it: the PCA Gene Subset, Marker Genes, QC variables, Show only, and the gene mask.

  • The Column name defaults to the set's name made into an identifier.
  • Genes the dataset lacks are listed, not an error, unless none are present.
  • An existing boolean column is replaced only if you ask; a non-boolean column never is.
  • A directional set writes its up genes unless you tick the down genes in too.

The step is recorded, and the notebook export reproduces it as adata.var[name] = adata.var_names.isin([...]).

Scoring a set

Coloring by a set (🎨, or choosing a set in the Color tab) turns its genes into one value per cell. Display offers two methods, chosen under Display → Gene Set Aggregation → Scoring method. The same choice drives the Expression heatmap's aggregate rows and Panels, so a set scores the same way everywhere. See Display settings and highlights.

Mean pipeline

The default. Each gene is normalized across cells, then the genes are combined per cell, then the color ramp is clipped:

Setting Default Options
Per-gene normalization Z-score (MAD, robust) None (no per-gene scaling): high-magnitude genes dominate. Z-score (MAD, robust): center on the median, scale by the median absolute deviation (falls back to SD when the MAD is 0). Z-score (SD). Min-max [0, 1]: clip each gene at a percentile (Per-gene clip percentile, default 1.0%), then rescale so every gene votes equally. Rank → [0, 1]: each cell's average rank within the gene, divided by the number of cells.
Aggregation across genes Mean Median (less affected by one or two outlier genes), Sum (emphasizes broad expression), Max (any gene of the set).
Color-ramp clip percentile 0 (off) Clips the color ramp's anchors symmetrically.

Per-gene normalization is why one highly expressed gene does not decide a set's score. The source matrix is the one Display reads (.X, its log1p, or a chosen layer). Genes hidden by the gene mask are left out.

A folder's ⋯ → Score sets… scores every set in the folder with this pipeline at once and writes the scores as one cells × sets matrix to .obsm[<name>] (named after the folder by default, editable). It respects the gene mask, lists sets skipped for having no usable genes, and can then build a 2-D embedding from two of the scores. The matrix is registered so each column is available as a color pill and axis.

UCell

UCell (Andreatta and Carmona 2021) scores a set from each cell's own ranking of its genes, so it does not depend on how other cells look and is not dominated by highly expressed genes. For each cell, genes are ranked by expression (rank 1 = highest), ranks are capped at maxRank, and the score is a Mann-Whitney U statistic normalized to 0 to 1: high when the set's genes rank near the top of that cell. For a directional set the down genes are scored the same way and subtracted: max(0, U_up − w_neg × U_down).

Choose UCell (rank AUC, directional) in Display to color by it on the fly. To keep a score, use a set's ⋯ → Score with UCell…, which writes an .obs column:

Parameter Default What it does
Source layer counts (falls back to .X when there is no counts layer) The matrix to rank.
maxRank 1500 Ranks beyond this count as maxRank, so genes that are not expressed do not affect the score. Capped at the number of genes.
w_neg (down-set weight) (Advanced) 1.0 Weight of the down genes' score.
Where What
obs['UCell_<name>'] The score, 0 to 1. The name is made safe and made unique if a column of that name exists.

Warning

UCell ranks genes within each cell, so a scaled or z-scored layer gives scores outside the usual 0 to 1 meaning. The dialog warns when the chosen layer looks scaled; pick a counts or log-normalized layer. See Expression scale detection.

The set menu

A set's ⋯ menu:

Item Where it is documented
Edit genes… The Gene Set Manager
Pin to top / Unpin Organize
Sort genes A→Z The Genes panel
Cluster genes… (4+ genes) Analyze a gene set
Cluster cells on this set… Analyze a gene set
Decompose into programs… (3+ genes) Analyze a gene set
Enrichment (overlap)… Enrichment
Map genes… (3+ genes) Analyze a gene set
Select cells… Select, mask and delete
Score with UCell… UCell
Save as .var column… Save a set as a .var column