For the complete documentation index, see llms.txt. This page is also available as Markdown.

Copy-number inference (inferCNV)

Infer copy-number variation from single-cell or spatial transcriptomics relative to a normal reference population, with optional identification and scoring of putative tumor clones.

Infer copy-number variation from single-cell or spatial transcriptomics relative to a normal reference population, with optional identification and scoring of putative tumor clones.

Copy-number variation inference

Description

Analysis summary

Infers large-scale copy-number gains and losses from single-cell or spatial transcriptomics by smoothing expression along the genome relative to a normal reference population. Optionally clusters the CNV profiles into putative tumour clones (Leiden) and scores each clone by its CNV magnitude.

Computation

Expression is pivoted into a cell/spot x gene matrix and smoothed along the genome in sliding windows of genes (infercnvpy's implementation of the inferCNV method; window size and step configurable; wider windows suit noisier spatial spots), relative to the y_group categories named as the normal reference. The result is a per-cell/spot CNV profile over genomic bins, signed: positive = inferred gain, negative = inferred loss. Per-gene genomic positions come from the consumer-configured GTF, matched by gene symbol; the analysis hard-fails when fewer than half the genes map, which almost always means the query's gene nomenclature does not match the GTF. A per-category summary is always returned — one row per y_group category with its size and overall CNV magnitude plus the signed mean CNV per chromosome, giving an at-a-glance view of which categories look CNV-altered and on which chromosomes. When clustering is enabled, the CNV profiles are additionally clustered into putative clones (PCA, neighbours, Leiden at a configurable resolution — higher gives more, smaller clones) and each clone is scored by its mean |CNV|, constant within a clone: every cell/spot is annotated with its clone and clone score, a per-clone summary is returned (size, score, the fraction of the clone coming from the reference categories, and the clone's composition per category), and the high-score clones are the putative tumour clones.

When to use

Use for copy-number questions on transcriptomics: whether tumor cells/spots carry CNV gains or losses and on which chromosomes, and — with clustering — to call putative tumour clones and rank them by CNV score. For measured DNA-level copy number or mutations, use the genomic-alterations analyses (oncoprint, mutation frequency) or WES-based features instead.

Caveats

The CNV is an inference from expression smoothed over gene windows — not a DNA measurement; bands suggest gains and losses but do not replace sequencing-based copy-number calling. The reference choice drives everything: whatever the reference categories are defines 'normal', so a contaminated reference flattens the contrasts. The scatter's UMAP positions are a 2-D rendering of the CNV profiles: clusters and scores are computed on the full dataset, only the displayed positions are subsampled on very large data.

inferCNV — the original method inferring copy-number variation from transcriptomics (Broad Institute): code https://github.com/broadinstitute/inferCNV/ and wiki https://github.com/broadinstitute/inferCNV/wiki. infercnvpy — its Python implementation, used by this analysis: https://infercnvpy.readthedocs.io/en/latest/infercnv.html.

Example questions

example questions
  • Infer copy-number variation in the single-cell data and show the genomic map.

  • Show inferCNV gains and losses for the spatial tumor spots versus normal spots.

  • Cluster the inferred CNV profiles into clones and show a CNV UMAP coloured by clone.

  • Identify putative tumour clones from the single-cell CNV profiles and rank them by CNV score.

Input columns

input columns
column
type
required
description

index

any

required

Cell or spot identifier (e.g. cell_id / spot_id). One row per (cell, gene); becomes the AnnData obs index.

value

numeric

required

Log-normalized expression (e.g. count_lognorm) used directly as the AnnData X matrix and the inferCNV layer. Do NOT pass raw counts.

x_group

categorical

required

Gene SYMBOL (e.g. gene_name). Pivoted into the columns of the cell x gene matrix and matched against the GTF gene_name field. Provide the full gene space (no m…

y_group

categorical

required

Category label per cell/spot, attached to obs['category']. Build it in SQL: for single-cell use the cell-type annotation; for spatial use a tumor/normal split …

patient_id

any

required

Patient identifier required by population-summary contract conventions. Carried for compliance only.

Visualizations

  • genomic_map How to read: Rows are cells/spots grouped by reference and split into per-group facet panels; columns are genomic bins placed along a genome axis. Red = inferred gain, blue = inferred loss. The rows' grouping, subdivision, order and annotation strip are display params (facet_row / split_within / order_rows_by / color_rows_by); reference levels are always left whole when subdividing. The view opens as a one-row-per-cell heatmap or a butterfly view (cells stacked by CNV level, one bar per bin), switchable in the plot. Very large results are display-subsampled, stratified per category with a per-group floor — the result table keeps every row. The native engine is ECharts; under Plotly the same map is drawn as a chromosome-faceted heatmap, honouring only the category facet.

  • scatter How to read: A 2-D UMAP of the CNV profiles, computed on demand at render time rather than stored in the result, coloured by the clone label or by the y_group category (cell type for single-cell, tumor/normal for spatial) — switch the colouring by re-rendering with a different color_by. Points of the same clone share a colour; clusters of high-score clone points are the putative tumour clones. Requires the analysis to have run with clustering enabled; on very large data the displayed points are subsampled, stratified per clone so every clone keeps points — clone labels and scores are always computed on the full dataset.

Example analysis 1

Name — Inferred Copy-Number Variation in Spatial Spots (Mesothelioma, tumor vs normal by deconvolution, 2 oldest patients)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — genomic_map

Inferred Copy-Number Variation in Spatial Spots (Mesothelioma, tumor vs normal by deconvolution, 2 oldest patients)

Output table

descriptive_stats (2 rows)
category
n
pct
mean_abs_cnv
chr1
chr2
chr3
chr4
chr5
chr6
chr7
chr8
chr9
chr10
chr11
chr12
chr13
chr14
chr15
chr16
chr17
chr18
chr19
chr20
chr21
chr22

normal

1312

20.7

0.004901

9.197e-05

0.002224

0.001135

-0.003737

-0.002029

0.0002936

0.01348

0.000851

0.001622

-0.0003282

0.0004747

0.0008172

0.001656

-0.0001021

0.007974

0.01528

0.0005537

-0.00109

-0.004097

-0.0001968

0.0009856

-0.001106

tumor

5026

79.3

0.05516

-0.02726

0.06329

0.007537

-0.1493

-0.1227

0.0183

0.1223

0.02538

0.06511

-0.001324

-0.07156

0.004083

0.06441

-0.01419

0.1306

0.1685

0.008174

0.01832

-0.06829

0.003699

-0.001992

-0.0887

Example analysis 2

Name — InferCNV clones (Leiden) UMAP coloured by clone in Single Cells (Bladder, 2 oldest patients)

Analysis parameters

analysis_name, analysis_params, viz_params

Visualization — scatter

InferCNV clones (Leiden) UMAP coloured by clone in Single Cells (Bladder, 2 oldest patients)

Output table

descriptive_stats (first 10 of 13 rows)
category
n
pct
mean_abs_cnv
chr1
chr2
chr3
chr4
chr5
chr6
chr7
chr8
chr9
chr10
chr11
chr12
chr13
chr14
chr15
chr16
chr17
chr18
chr19
chr20
chr21
chr22
cluster_0
cluster_1
cluster_2
cluster_3
cluster_4
cluster_5
cluster_6
cluster_7
cluster_8
cluster_9
cluster_10
cluster_11
cluster_12
cluster_13
cluster_14
cluster_15
cluster_16
cluster_17
cluster_18
cluster_19
cluster_20
cluster_21
cluster_22
cluster_23
cluster_24
cluster_25
cluster_26
cluster_27
cluster_28
cluster_29
cluster_30

B_cell

216

1.569

0.002836

0.0004578

0.002869

0.0008756

0.002006

0.003237

0.00405

0.001372

0.003315

0.002152

0.001062

0.002223

0.001472

0.004153

0.001568

0.001357

0.001273

0.0008075

0.003281

1.066e-05

-5.504e-05

-0.001793

0.00275

0.05556

0.6667

0.00463

0.0

0.0

0.04167

0.0

0.00463

0.01852

0.01389

0.0

0.0

0.06944

0.0

0.01389

0.0

0.0

0.00463

0.009259

0.00463

0.00463

0.00463

0.009259

0.01389

0.00463

0.02315

0.0

0.01389

0.009259

0.00463

0.00463

DC

142

1.031

0.007702

0.001086

0.007208

0.001999

0.0002485

-0.002993

0.00685

0.003165

0.00404

0.002959

0.004391

0.005261

0.003672

0.006344

0.00138

0.00877

0.005347

0.002168

0.0004659

-0.001135

0.00522

0.004966

0.007953

0.1268

0.669

0.0

0.0

0.0

0.05634

0.0

0.007042

0.0

0.007042

0.0

0.007042

0.04225

0.007042

0.007042

0.01408

0.0

0.0

0.0

0.0

0.0

0.007042

0.0

0.01408

0.007042

0.0

0.007042

0.007042

0.0

0.0

0.01408

Endothelial

512

3.719

0.008993

0.003332

0.003828

0.00695

0.001883

0.007742

-0.000588

0.004341

0.009516

0.008274

0.005611

-6.589e-05

0.001767

0.007709

0.00647

0.002063

-0.00143

0.0009299

-0.00214

-0.002192

0.00522

0.007785

0.008975

0.2012

0.5703

0.003906

0.001953

0.0

0.1133

0.001953

0.003906

0.0

0.003906

0.0

0.001953

0.03711

0.0

0.0

0.005859

0.001953

0.007812

0.007812

0.001953

0.001953

0.001953

0.003906

0.001953

0.0

0.007812

0.005859

0.003906

0.003906

0.003906

0.0

Epithelial_other

7

0.05085

0.0282

0.008125

-0.001592

-0.0138

-0.007134

-0.04514

0.0125

0.01392

0.06961

-0.0635

-0.06352

0.006228

0.01576

-0.02668

-0.0035

0.03024

-0.00728

0.02796

0.01918

-0.001223

0.05512

0.0

-0.0004849

0.0

0.0

0.0

0.0

0.0

0.8571

0.0

0.0

0.0

0.0

0.0

0.0

0.1429

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

Fibroblast

1607

11.67

0.008042

0.001779

0.003052

0.004889

0.002835

0.008966

0.002879

0.004553

0.008096

0.008972

0.004613

0.002861

0.005275

0.005843

0.006438

0.006772

-0.003626

-0.002701

0.001551

-0.008099

0.002367

0.001082

0.003584

0.09832

0.6621

0.001867

0.004356

0.004978

0.1021

0.004356

0.006223

0.0056

0.00809

0.0006223

0.003734

0.0336

0.003734

0.004356

0.002489

0.006223

0.003111

0.003111

0.001867

0.004356

0.001245

0.003734

0.0006223

0.004356

0.0112

0.001867

0.003111

0.002489

0.003734

0.002489

Granulocyte

47

0.3414

0.0008291

0.002256

0.0006198

0.0001962

0.0

0.0002326

0.0009689

0.0009719

0.000637

0.001163

0.001955

0.0

0.0004409

0.0

0.0001124

0.0

0.0002632

0.0002478

0.0

0.0009767

0.0005751

0.003481

0.002053

0.1915

0.3617

0.02128

0.0

0.04255

0.06383

0.0

0.0

0.0

0.0

0.0

0.0

0.06383

0.02128

0.0

0.02128

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.02128

0.0

0.08511

0.02128

0.02128

0.0

0.06383

0.0

Malignant

6794

49.35

0.04176

0.03619

0.01937

0.06158

-0.01976

-0.07705

-0.005595

0.03615

0.01913

-0.02514

-0.02978

0.02326

-0.01335

-0.01973

0.0104

0.00656

0.0001791

0.00361

0.05441

-0.002563

0.04692

0.02858

-0.009163

0.6225

0.08522

0.0002944

0.001472

0.00103

0.2557

0.001178

0.001913

0.0007359

0.001913

0.00103

0.0007359

0.008095

0.001472

0.0002944

0.0008831

0.001178

0.0008831

0.0004416

0.0004416

0.0007359

0.001178

0.001913

0.0008831

0.0002944

0.003238

0.001178

0.0002944

0.001178

0.0008831

0.0008831

Mast

52

0.3777

0.001917

0.0005996

0.002385

0.0007356

0.001192

0.001088

0.001443

0.001241

0.003057

0.002058

0.00101

0.0005748

0.003544

0.007841

0.005046

0.002644

0.0005366

0.0004901

0.0

0.0005729

0.001272

0.005171

0.004113

0.09615

0.5192

0.0

0.0

0.01923

0.1346

0.0

0.0

0.03846

0.0

0.0

0.01923

0.09615

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.01923

0.0

0.0

0.0

0.03846

0.0

0.0

0.01923

0.0

0.0

MoMac

960

6.973

0.00606

0.002246

0.002829

0.002252

-0.001722

0.002113

0.002308

0.0016

0.0007011

0.005384

0.005137

0.003108

0.004382

0.003116

0.004337

0.004791

-0.0001089

0.002444

0.0007857

-0.0002977

0.004024

0.004097

0.001766

0.1646

0.5667

0.0

0.007292

0.004167

0.06771

0.002083

0.002083

0.004167

0.003125

0.00625

0.003125

0.07604

0.004167

0.0

0.003125

0.003125

0.004167

0.007292

0.00625

0.004167

0.001042

0.005208

0.004167

0.002083

0.01771

0.008333

0.005208

0.00625

0.004167

0.00625

Muscle

415

3.014

0.006244

0.0009886

0.003471

0.002298

0.003156

0.004345

0.0008842

0.002892

0.01088

0.006368

0.008804

0.001593

0.005869

0.003092

0.005932

0.002132

-0.0028

-0.0007993

0.0013

-0.002298

0.004924

0.002325

0.002488

0.08434

0.6024

0.0

0.00241

0.00241

0.1735

0.00241

0.00241

0.00241

0.004819

0.0

0.009639

0.03855

0.00241

0.00241

0.00241

0.004819

0.00241

0.0

0.00241

0.00241

0.00241

0.007229

0.00241

0.007229

0.01446

0.007229

0.00241

0.009639

0.0

0.00241

statistical_tests (first 10 of 31 rows)
cnv_leiden_cluster
n
cnv_score
reference_fraction
pct_B_cell
pct_DC
pct_Endothelial
pct_Epithelial_other
pct_Fibroblast
pct_Granulocyte
pct_Malignant
pct_Mast
pct_MoMac
pct_Muscle
pct_Plasma
pct_Stromal_other
pct_T_NK

0

5061

0.04367

0.1642

0.2371

0.3557

2.035

0.0

3.122

0.1778

83.56

0.09879

3.122

0.6916

4.288

0.01976

2.292

1

4732

0.006275

0.876

3.043

2.008

6.171

0.0

22.49

0.3593

12.24

0.5706

11.5

5.283

15.13

0.1691

21.05

2

25

0.0

0.92

4.0

0.0

8.0

0.0

12.0

4.0

8.0

0.0

0.0

0.0

28.0

0.0

36.0

3

58

6.02e-06

0.8276

0.0

0.0

1.724

0.0

12.07

0.0

17.24

0.0

12.07

1.724

32.76

0.0

22.41

4

36

0.0

0.8056

0.0

0.0

0.0

0.0

22.22

5.556

19.44

2.778

11.11

2.778

25.0

0.0

11.11

5

2366

0.03001

0.2608

0.3804

0.3381

2.451

0.2536

6.932

0.1268

73.42

0.2959

2.747

3.043

5.917

0.2536

3.846

6

41

0.0

0.8049

0.0

0.0

2.439

0.0

17.07

0.0

19.51

0.0

4.878

2.439

34.15

0.0

19.51

7

49

0.0

0.7347

2.041

2.041

4.082

0.0

20.41

0.0

26.53

0.0

4.082

2.041

30.61

0.0

8.163

8

45

1.051e-05

0.8889

8.889

0.0

0.0

0.0

20.0

0.0

11.11

4.444

8.889

2.222

20.0

0.0

24.44

9

58

7.072e-06

0.7586

5.172

1.724

3.448

0.0

22.41

0.0

22.41

0.0

5.172

3.448

18.97

1.724

15.52

Last updated

Was this helpful?