Skip to content

Copy-number inference

Infer chromosomal gains and losses from expression and group cells that share them into clones. Use it on tumor data to separate malignant from normal cells and to find sub-clones, when you have no DNA measurement of the same cells.

Where to find it

Analyze → Cells → CNV inference → Open CNV tool…

How it works

A gain or loss of a chromosome region raises or lowers the expression of most genes in that region a little. One gene is too noisy to show it, but the mean over a hundred neighboring genes along the genome is not. This is the idea behind inferCNV (Patel et al. 2014; Tirosh et al. 2016) and infercnvpy, and Skopia follows the same recipe:

  1. Log-normalize. Counts are normalized to 10,000 per cell and log1p-transformed; log-scale data is used as it is. Scaled (z-scored) data is refused.
  2. Place and filter genes. Each gene gets a chromosome and start position. Genes whose mean log expression over the analyzed cells is below the floor (default 0.02) are dropped, as are immunoglobulin, T-cell receptor and MHC genes by default.
  3. Compare with the reference. Each gene is compared with reference (normal) cells you choose. With one reference category, its per-gene mean is subtracted. With several, a value between the lowest and highest category mean counts as normal (0) and anything outside is the distance to the nearest bound, so differences between normal cell types are not painted onto every tumor cell (infercnvpy's rule).
  4. Clip at ±3.
  5. Smooth. Average in windows of 100 genes, stepping 10 genes, along each chromosome. A chromosome with fewer genes than one window gets a single window rather than a gap.
  6. Center each cell at its median window value.
  7. Call clones on this window matrix (Leiden or Ward; see Clones).
  8. Denoise for display. Window values below 1.5 × the matrix-wide standard deviation are set to 0 (inferCNV's dynamic threshold). This thresholded matrix is what is stored and what the per-cell CNV score is computed from; clones are called on the matrix before thresholding.
Why clones come from the un-thresholded matrix

On the benchmark below (a mix of four basal cell carcinoma patients' tumor cells plus their normal cells, scored against patient identity), clones called from the noise-thresholded matrix had an ARI of 0.54 to 0.76; clones called from the un-thresholded matrix, 0.97 to 0.98. The 1.5 SD threshold zeroes the weak, consistent shifts that distinguish clones and leaves per-cell noise. It stays for the stored matrix, the heatmap and the score, where it helps.

Run it

  1. Optionally restrict the cells with the cell mask or a named subset.
  2. Open Analyze → Cells → CNV inference and click Open CNV tool….
  3. Under Gene positions, choose Shipped GENCODE table and a species (guessed from the gene names), or Columns of .var and name the chromosome and start columns.
  4. Leave Include X and Y off unless you know the reference matches the tumor's sex.
  5. Under Reference (normal) cells, pick a categorical column and tick the categories you trust to be diploid (immune, stromal and endothelial cells are typical).
  6. Under Clones, choose the method and its setting.
  7. Set the output Key (default cnv).
  8. Click Run. The job runs in the background and can be cancelled. When it finishes, the panel reports genes, windows, chromosomes and cells used, lists warnings, and shows the clone table with buttons to color by the clone and score columns and to save a heatmap figure.

Gene positions

The shipped tables come from GENCODE (human GRCh38, mouse GRCm39) and match genes by Ensembl ID or by symbol, ignoring case. If your genes carry positions of their own (another assembly, another species), choose Columns of .var: a categorical chromosome column and a numeric start column. The run stops if too few genes get a position on the included chromosomes.

Choosing the reference

Pick reference categories that cover every normal cell type present. A normal lineage missing from the reference reads as aneuploid: on the MM199 myeloma sample in the benchmark, erythroid cells that were not in the reference scored as high as the tumor and clustered with it.

A reference category with fewer than 50 cells (A reference category needs ≥ 50 cells to set the bounds) still counts as reference cells, for the clone table, but does not set the multi-reference bounds: the mean of a small group is noisy and widens the bounds enough to hide real events. If no category qualifies, all reference cells are pooled into one mean. A single category is used whatever its size.

Without a reference, each gene is compared with the mean over all analyzed cells. Events every cell shares are then invisible, and the quietest clone is not necessarily normal. This works when most cells are normal, or when clones differ from each other.

Clones

Method What it does
Leiden on the CNV profile (default) PCA of the window matrix (30 PCs), an exact kNN graph with k = 15, then Leiden (Traag et al. 2019) at resolution 0.5.
Hierarchical (Ward), fixed number Ward linkage (Ward 1963) on the same PCA, cut into a fixed number of clones (default 4). This is inferCNV's own grouping. Refused above 20,000 cells, because Ward needs the full cell-by-cell distance matrix (gigabytes at that size); use Leiden there.
Do not call clones Writes the matrix and score only.

Clones are named by rising CNV burden: clone_1 has the lowest mean CNV score. With a reference, the clone table shows each clone's size, mean CNV score, share of reference cells, and the reference column's most common category in it (mostly). A tumor clone holds few or no reference cells and a normal one most of them.

Parameters

Parameter Default What it does
Include X and Y Off Adds the sex chromosomes. Off because a reference of the other sex reads as a whole-chromosome event.
resolution (Leiden) 0.5 Higher splits into more clones.
clones (Ward) 4 Number of clones to cut.
PCs 30 Components of the window matrix used for clustering.
Key cnv Names every output. A run under an existing key replaces it.

Under Advanced:

Parameter Default What it does
Window / every 100 genes / 10 genes Window size and step. A smaller step gives finer breakpoints and more windows. inferCNV smooths 101 genes at every gene; infercnvpy uses 100 every 10.
Keep genes with mean log expression ≥ 0.02 Expression floor over the analyzed cells.
Clip at ± 3 Clip on the reference-relative values before smoothing.
noise threshold 1.5 × SD Window values below this multiple of the matrix-wide standard deviation become 0. 0 disables.
Centre each cell at its median window value On Per-cell centering.
Exclude immunoglobulin, T-cell receptor and MHC genes On These loci are lineage-restricted and, in lymphoid cells, clonally rearranged, so they read as focal events in every plasma, B or T cell. Matches IG[HKL]…, TR[ABGD]… and HLA-… (human), Ig[hkl]…, Tr[abgd]… and H2-… (mouse).
A reference category needs ≥ … cells to set the bounds 50 See Choosing the reference.
Expression .X .X or a layer; its detected scale is shown.

What it writes

For key cnv:

Where What
obsm['X_cnv'] Cells × genome windows, after the noise threshold. NaN rows for cells outside the cell mask.
obsm['X_cnv_chrom'] Cells × chromosomes: the mean window value per chromosome. Registered as a score matrix, so you can color the embedding by one chromosome from the Color tab's score matrices.
obs['cnv_score'] Per-cell CNV burden: the mean absolute window value.
obs['cnv_clone'] clone_1, clone_2, … (unassigned outside the cell mask), with colors in uns['cnv_clone_colors'].
uns['skopia_cnv']['cnv'] The run record: windows, chromosomes, parameters and clone summary.

The run is recorded in the analysis record and replayed by the notebook export.

Heatmap figure

Heatmap figure… (after a run, or heatmap figure… beside a stored run) saves a cnv_heatmap figure and opens it in the Figures tab: rows of cells × genome windows, with chromosome separators and a diverging color scale, grouped by the clone column. Its settings in the Figures tab:

Setting Default What it does
Rows cells, binned within each group Or one mean row per group.
Max rows 400 Rows across all groups; each group gets rows in proportion to its size, at least one.
Group order by CNV score (quietest first) Or the column's category order.
Colour limit (±) blank Symmetric color limit; blank uses the 99th percentile of absolute values.
Colours rdbu Diverging color map.

How the defaults were chosen

The method and its defaults were checked against DNA-based copy-number truth from the Schmid et al. benchmark (Schmid et al. 2025) on six datasets: two gastric cancer lines with single-cell WGS, a myeloma and a basal cell carcinoma sample with WES, a four-patient carcinoma mix for clone recovery, and a healthy PBMC sample as a diploid control. With the current defaults, the mean max F1 of the inferred profiles over the four truth sets was 0.587, against 0.565 for the earlier defaults and 0.566 for infercnvpy 0.6.1 run with the same gene positions and references; on the PBMC control Skopia's false-positive level stayed higher than infercnvpy's (0.55 against 0.42, normalized units), the cost of the lower expression floor. The full write-up, with its limits, is docs/measurements/2026-10-13-cnv-benchmark.md.

Tips and pitfalls

The reference defines normal

Any normal cell type missing from the reference will look aneuploid. Tick every normal population you can identify, and check that the clone holding most reference cells is also the quietest.

The cell mask scopes the run

With a mask active, the reference means, the gene filter and the clones use the active cells only, and cells outside get no values. A reference category with no cells inside the mask is refused.

Look at one chromosome

Color the embedding by a column of X_cnv_chrom (for example chr7) to see which cells carry a whole-chromosome or arm-level event.

Expression-only inference has limits

Expression-based copy-number calls are noisy at the level of one cell and resolve large events better than focal ones. Treat clones as hypotheses to test, for example against known driver events or DNA data.