Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Gene-set activity scoring primer

Single-cell readouts on single genes can be sparse and heavily noisy. This is often driven by dropout, which can zero out a marker in cells that express it, and then one highly expressed gene can dominate expression. Gene-set scoring fixes this by collapsing a whole program; a pathway, a cell state, a lineage signature; into one number per cell that is more robust than any member gene alone.

CyteArc offers two ways to compute that number. WAGGR (Weighted Aggregate) takes a weighted mean of normalized gene expression, so strongly expressed genes can pull harder and can push in opposite directions. AUCell ignores expression values entirely after ranking each cell’s genes, then measures how early the signature’s targets appear among the top ranks, with its scores ranging from 0 to 1. WAGGR can be used to gain an idea of the magnitude of a program, whereas AUCell can tell you about rank recovery. Rank recovery can be conceptualized as how early the signature of interest appears among that cell’s top-ranked genes.

Load the prepared dataset

We first begin by loading in the prepared dataset. For context, when we do our activity scoring, the data is streamed directly from the raw counts: AUCell ranks those raw counts, while WAGGR applies library-size normalization for its own scoring function.

DataStore has 3948 (5025) cells with 1 assays: RNA Cell metadata: 'I', 'ids', 'names', 'RNA_G2M_score', 'RNA_S_score', 'RNA_UMAP1', 'RNA_UMAP2', 'RNA_cell_cycle_phase', 'RNA_clusters', 'RNA_doublet_score', 'RNA_leiden_cluster', 'RNA_nCounts', 'RNA_nFeatures', 'RNA_paris_cluster', 'RNA_percentMito', 'RNA_percentRibo' RNA assay has 33538 features and following metadata: 'I', 'ids', 'names', 'dropOuts', 'feature_type', 'genome', 'nCells'

Started: 2026-10-11T18:54:48.982669Z | Wall time: 11.992 s

Read and inspect gene sets

For your own analysis, replace these demonstration signatures with your own Gene Matrix Transposed (GMT) file. The file stores one gene program per line.

sourcetarget
0T_cellCD3D
1T_cellCD3E
2T_cellTRAC
3T_cellLTB
4T_cellIL7R
5B_cellMS4A1
6B_cellCD79A
7B_cellCD37
8B_cellCD74
9B_cellHLA-DRA
10MyeloidLST1
11MyeloidS100A8
12MyeloidS100A9
13MyeloidCTSS
14MyeloidFCER1G

Started: 2026-10-11T18:55:00.979846Z | Wall time: 0.027 s

Targets are matched to active RNA feature names without case sensitivity, meaning that any match regardless of capitalization will be selected. Missing targets do not need to be removed from the input table, as CyteArc automatically handles this. A target that matches several active features, such as a gene symbol shared by two feature IDs, is ambiguous and is ignored with a warning by default.

sumcount
source
B_cell55
Myeloid55
T_cell55

Started: 2026-10-11T18:55:01.009559Z | Wall time: 0.057 s

In our case, all five genes in each of the three signatures are present in the dataset.

Start with WAGGR

WAGGR calculates a weighted mean of library-size-normalized expression by default. When the input has no weight column, every target gene has weight one. tmin is the minimum number of matched genes a signature needs to be scored; anything below it is skipped. Our sample gene sets have only five genes each, so tmin=3 lets a signature survive one or two missing genes, where the default of five would drop it outright.

This comparison uses the complete assay feature universe for both methods:

{'cells': 3948, 'genes': 33538}

Started: 2026-10-11T18:55:01.069024Z | Wall time: 0.182 s

T_cellB_cellMyeloid
min0.0000000.0000000.000000
50%0.5629680.1724880.047424
max2.5512817.27835825.161978

Started: 2026-10-11T18:55:01.253949Z | Wall time: 1.029 s

The results from WAGGR are not confined from 0 to 1 like AUCell.

Score rank recovery with AUCell

Since AUCell scores each cell by recovery among its top-ranked genes, it first needs to know what universe to rank. The required features argument sets that universe: here all_features ranks the complete gene list, but AUCell only uses the top 5% of genes to calculate its recovery.

T_cellB_cellMyeloid
min0.0000000.0000000.000000
50%0.6784950.3089610.075030
max0.9336920.9755080.985544

Started: 2026-10-11T18:55:02.286492Z | Wall time: 15.174 s

An AUCell score of 0 means no signature genes are recovered before the top-rank cutoff; a gene exactly at the cutoff contributes no area. A score of 1 means the signature achieves the maximum possible recovery at the top of that cell’s ranking.

Visualize AUCell and WAGGR

To visualize the results from AUCell, we can simply plot the recovery score on a UMAP of the cells.

Three PBMC UMAP panels show AUCell scores from zero to one for T-cell, B-cell, and myeloid signatures, with the strongest scores in different regions.

Started: 2026-10-11T18:55:17.466387Z | Wall time: 0.706 s

AUCell scores highlight lineage-consistent regions: T cell, B cell, and Myeloid scores peak in separate parts of the UMAP when those populations are present.

To compare both methods, take the Myeloid signature for example: we can create a table comparing the results; remember, their numerical scales differ.

Myeloid_WAGGRMyeloid_AUCell
count3948.0000003948.000000
mean1.2460210.229799
std3.0269970.343544
min0.0000000.000000
25%0.0223980.000000
50%0.0474240.075030
75%0.1378050.187366
max25.1619780.985544

Started: 2026-10-11T18:55:18.176162Z | Wall time: 0.019 s

We can also compare WAGGR and AUCell scores for the Myeloid signature across all selected cells in a scatter plot.

Scatter plot of myeloid WAGGR and AUCell scores per cell. AUCell approaches one as WAGGR rises, while WAGGR continues across a wider numerical range.

Started: 2026-10-11T18:55:18.197077Z | Wall time: 0.121 s

Look for cells with high scores under both methods and cells where the methods disagree.

Optional: Use a signature with weights

Add weights when the WAGGR source gives some genes more say than others: amplifying strong genes, silencing weak ones, or setting genes against each other in opposite directions. To adjust for this, add a weight column to the input table, as without one, every gene counts equally at weight one. WAGGR’s default mode="wmean" divides the weighted sum by the sum of absolute weights, keeping scores comparable across signatures of different sizes, while mode="wsum" leaves the total unscaled, so comparability falls.

Common mistakes and limitations

  • Restricting AUCell’s ranking universe: recovery is measured within the top 5% of whatever list features provides, so scoring against a subset such as highly variable genes shifts background ranks and inflates or skews the score. Rank against the full feature universe.

  • Letting tmin prune a signature silently: unmatched or ambiguous targets drop out, and a signature left with fewer than tmin matched targets is skipped entirely rather than scored on its surviving subset; if no signatures remain, scoring raises an error.

  • Comparing WAGGR scores across transformations: WAGGR values are unbounded and sensitive to log_transform, wmean vs. wsum, and library normalization, so comparing runs with different settings, or WAGGR directly against AUCell’s bounded 0-to-1 scores, confounds scaling with biology.