Read a prepared CITE-seq analysis of 7,299 peripheral blood mononuclear cells (PBMCs) from a healthy human donor (10x Genomics dataset tenx_8K_pbmc_citeseq). CITE-seq measures RNA and surface proteins in the same cells: each antibody carries a DNA barcode, its antibody-derived tag (ADT), which is sequenced with the cell’s RNA. The dataset has 17 antibodies, 14 against surface proteins and 3 isotype controls. Weighted nearest neighbors (WNN) Hao et al., 2021 builds one neighbor graph from both assays, weighting RNA and protein separately for each cell.
Leiden clustering of the WNN graph gives 21 clusters, and protein carries more than half of the weight in 58% of cells. The CD4 and CD8a antibodies separate the CD4 and CD8 T-cell clusters sharply, while the CD4 transcript is detected in only 18 to 25% of the cells in the CD4 T-cell clusters, less often than in monocytes.
Open the prepared store and its runs¶
# Import pandas for the summary tables, and show their values with two decimals.
import pandas as pd
pd.set_option("display.precision", 2)
# Import CyteArc with its selectors for cell fields and features.
import cytearc
from cytearc.plotting import CellField, FeatureRef
# Keep routine progress messages out of the results.
cytearc.configure_output(level="WARNING", progress=False)
# Download the prepared example store, which holds the saved runs that this page reads.
dataset = cytearc.datasets.connect("cytearc_docs").download_dataset(
"tenx_8K_pbmc_citeseq", destination="cytearc_datasets", zarr=True
)Started: 2026-11-14T15:42:39.420724Z | Wall time: 7.083 s
The download is a CyteArc store, a Zarr directory that holds the counts of both assays and the saved runs:
# Open the store with RNA as the default assay, which calls use when they name none, and list its cells, assays and metadata columns.
ds = cytearc.DataStore(f"{dataset}/data.zarr", default_assay="RNA", nthreads=4)
dsDataStore has 7299 (7865) cells with 2 assays: ADT RNA
Cell metadata:
'I', 'ids', 'names', 'ADT_UMAP1', 'ADT_UMAP2',
'ADT_leiden_cluster', 'ADT_nCounts', 'ADT_nFeatures', 'RNA+ADT_UMAP1', 'RNA+ADT_UMAP2',
'RNA+ADT_leiden_cluster', 'RNA+ADT_wnn_UMAP1', 'RNA+ADT_wnn_UMAP2', 'RNA+ADT_wnn_leiden_cluster', 'RNA_UMAP1',
'RNA_UMAP2', 'RNA_clusters', 'RNA_leiden_cluster', 'RNA_nCounts', 'RNA_nFeatures',
'RNA_percentMito', 'RNA_percentRibo'
ADT assay has 17 features and following metadata:
'I', 'ids', 'names', 'dropOuts', 'feature_type',
'genome', 'nCells', 'pattern', 'read', 'sequence'
RNA assay has 33538 features and following metadata:
'I', 'ids', 'names', 'dropOuts', 'feature_type',
'genome', 'nCells', 'pattern', 'read', 'sequence'Started: 2026-11-14T15:42:46.507263Z | Wall time: 3.232 s
The store holds 7,865 cells, of which 7,299 are active, marked True in the I column: the cells that passed the RNA run’s quality filter. The RNA assay holds 33,538 genes and the ADT assay 17 antibodies. Cell columns such as RNA+ADT_wnn_leiden_cluster copy results of the saved runs into the cell table; this page reads the runs themselves.
A pipeline run is one recorded call of a CyteArc recipe, such as ds.pipeline.rna. The run saves each result as an immutable artifact together with the settings that made it, so the results can be reopened instead of recomputed. List the runs in this store:
# List the runs saved in the store, newest first.
ds.pipeline.list_runs()(PipelineRun(run_id='847dbf937203...', recipe='multimodal', status='completed', assay='RNA', label='wnn'),
PipelineRun(run_id='fcda06bec85a...', recipe='multimodal', status='completed', assay='RNA', label='snn'),
PipelineRun(run_id='9f91737eca2a...', recipe='adt', status='completed', assay='ADT', label='adt'),
PipelineRun(run_id='8804eec1fd5e...', recipe='rna', status='completed', assay='RNA', label='rna'))Started: 2026-11-14T15:42:49.743989Z | Wall time: 0.356 s
The rna and adt runs analyze each assay over the same 7,299 cells. The wnn and snn runs combine the two runs’ neighbor graphs into one joint graph, with WNN or with shared nearest neighbors (SNN), and then embed and cluster that graph. A multimodal run reports the assay of its first source run, so both show RNA. This page reads the WNN run.
Read each cell’s modality weights¶
For each cell and assay, WNN measures how well the cell’s neighbors in that assay predict the cell’s profile there, relative to how well its neighbors in the other assay predict it, and gives the larger weight to the assay that predicts the cell better. These modality weights sum to 1, and the cell’s joint neighbors are the cells most similar to it in both assays combined, each assay counted by its weight. Open the WNN run. Its cell view, wnn.cells, holds the values that the run saved for each of its cells: the WNN UMAP coordinates, the clustering that the run kept (clusters, its only Leiden partition, at resolution 1.75) and the two weights. ds.artifacts.find also finds it by the run’s graph and its resolution:
# Open the saved WNN run, which integrates the RNA and ADT runs.
wnn = ds.pipeline.open(label="wnn")
# Find the run's Leiden clustering of the joint graph at resolution 1.75.
joint_clusters = ds.artifacts.find(
"clusters", graph=wnn["integrated_graph"], method="leiden", resolution=1.75
)
print("The resolution 1.75 clustering is the run's clusters:", joint_clusters == wnn["clusters"])
# Show the first cells of the run's cell view, rounded to two decimals.
wnn.cells.head().round(2)The resolution 1.75 clustering is the run's clusters: True
| I | ids | names | umap_1 | umap_2 | clusters | weight_RNA | weight_ADT | |
|---|---|---|---|---|---|---|---|---|
| 0 | True | AAACCCAAGATTGTGA-1 | AAACCCAAGATTGTGA-1 | 9.32 | -4.11 | 3 | 0.00 | 1.00 |
| 1 | True | AAACCCACATCGGTTA-1 | AAACCCACATCGGTTA-1 | 9.45 | -7.54 | 3 | 1.00 | 0.00 |
| 2 | True | AAACCCAGTACCGCGT-1 | AAACCCAGTACCGCGT-1 | 12.02 | -0.85 | 2 | 0.00 | 1.00 |
| 3 | True | AAACCCAGTATCGAAA-1 | AAACCCAGTATCGAAA-1 | -14.64 | 21.93 | 5 | 0.47 | 0.53 |
| 4 | True | AAACCCAGTCGTCATA-1 | AAACCCAGTCGTCATA-1 | -15.56 | 21.78 | 5 | 0.00 | 1.00 |
Started: 2026-11-14T15:42:50.104474Z | Wall time: 0.236 s
Four of these five cells give one assay nearly all of the weight, 1.00 against 0.00 at two decimals, and only the fourth splits it, 0.47 for RNA and 0.53 for ADT. WNN turns the two assays’ prediction scores into weights through an exponential, which pushes the weights toward 0 and 1 whenever one score is well above the other; the cell’s joint neighbors then follow that one assay almost entirely. Measure how often each assay leads, and how often one takes nearly all of the weight:
# Average the two weights, and measure how often ADT carries most of the weight or one assay carries nearly all of it.
weights = wnn.cells.to_pandas_dataframe(["weight_RNA", "weight_ADT"])
print(f"Mean weights: RNA {weights['weight_RNA'].mean():.2f}, ADT {weights['weight_ADT'].mean():.2f}")
pd.Series(
{
"ADT weight above 0.5": (weights["weight_ADT"] > 0.5).mean(),
"ADT weight 0.9 or more": (weights["weight_ADT"] >= 0.9).mean(),
"RNA weight 0.9 or more": (weights["weight_RNA"] >= 0.9).mean(),
},
name="share of cells",
).round(2)Mean weights: RNA 0.44, ADT 0.56
ADT weight above 0.5 0.58
ADT weight 0.9 or more 0.35
RNA weight 0.9 or more 0.25
Name: share of cells, dtype: float64Started: 2026-11-14T15:42:50.343849Z | Wall time: 0.036 s
The ADT weight exceeds 0.5 in 58% of cells, and the mean weights are 0.56 for ADT and 0.44 for RNA. Most cells lean almost entirely on one assay: the ADT weight is 0.9 or more in 35% of cells and the RNA weight in 25%.
Map the WNN clusters and weights¶
Color the WNN UMAP by the WNN clusters and by each cell’s ADT weight. With run=wnn, the plot reads the run’s saved fields, and a CellField names one field with its panel title and, for the clusters, a categorical color scale:
# Read both colors from the run's saved fields, and give the clusters a categorical scale.
ds.plots.embedding(
run=wnn,
color_by=[
CellField("clusters", kind="categorical", label="WNN clusters"),
CellField("weight_ADT", label="ADT weight"),
],
legend_loc="on_data",
)
Started: 2026-11-14T15:42:50.382852Z | Wall time: 1.653 s
The WNN graph has 21 clusters, numbered by size from cluster 1, the largest. Most large clusters mix cells with ADT weights near 0 and near 1, so one cell’s weight says little about which assay its cell type relies on. The balance still differs between regions: yellow prevails in the central island and in cluster 5 at the top, purple is more common on the right-hand island, and cluster 14, beside cluster 5, is mostly purple.
Check the antibody panel¶
The ADT run’s feature view, adt.features, lists all 17 antibodies of the assay, and its panel column marks the ones that the run analyzed. nCells counts the store’s 7,865 cells with at least one count of each antibody:
# Open the saved ADT run, and list each antibody's ID and name, the number of cells with at least one count, and whether the run's panel kept it.
adt = ds.pipeline.open(label="adt")
detected_cells = ds.ADT.feats.to_pandas_dataframe(["ids", "nCells"]).set_index("ids")
adt.features.to_pandas_dataframe(["ids", "names", "panel"]).set_index("ids").join(detected_cells)| names | panel | nCells | |
|---|---|---|---|
| ids | |||
| CD3 | CD3_TotalSeqB | True | 7864 |
| CD4 | CD4_TotalSeqB | True | 7864 |
| CD8a | CD8a_TotalSeqB | True | 7863 |
| CD14 | CD14_TotalSeqB | True | 7864 |
| CD15 | CD15_TotalSeqB | True | 7864 |
| CD16 | CD16_TotalSeqB | True | 7864 |
| CD56 | CD56_TotalSeqB | True | 7864 |
| CD19 | CD19_TotalSeqB | True | 7702 |
| CD25 | CD25_TotalSeqB | True | 7861 |
| CD45RA | CD45RA_TotalSeqB | True | 7864 |
| CD45RO | CD45RO_TotalSeqB | True | 7864 |
| PD-1 | PD-1_TotalSeqB | True | 7863 |
| TIGIT | TIGIT_TotalSeqB | True | 7849 |
| CD127 | CD127_TotalSeqB | True | 7862 |
| IgG2a | IgG2a_control_TotalSeqB | False | 7839 |
| IgG1 | IgG1_control_TotalSeqB | False | 7856 |
| IgG2b | IgG2b_control_TotalSeqB | False | 7639 |
Started: 2026-11-14T15:42:52.038828Z | Wall time: 0.165 s
The ADT run kept 14 antibodies and left out the 3 isotype controls, IgG2a, IgG1 and IgG2b: antibodies without a target on these cells, which measure nonspecific binding. Every antibody, the isotype controls included, has counts in at least 7,639 of the 7,865 cells. Background binding gives each antibody a signal in nearly every cell, so a protein is read from its level, not from whether it was detected. The plots and the cluster table below show that level as the centered log-ratio (CLR), which divides each antibody’s counts by their geometric mean across cells and takes the logarithm.
Compare protein and mRNA markers¶
The antibody IDs are the short names, and the names add the TotalSeq-B suffix, so FeatureRef("CD4", assay="ADT", by="id") selects the CD4 antibody by its ID, and label= gives it a panel title. A plot made with run=wnn reads features only from the run’s own assay, RNA. To color the WNN UMAP by markers of both assays, pass its layout instead: indexing a run by an output name, as in wnn["umap"], returns an ArtifactRef, a reference to that saved result:
# Select the protein markers by their stored antibody IDs, and the RNA markers by gene name.
protein_panel = [
FeatureRef(marker, assay="ADT", by="id", label=f"{marker} protein")
for marker in ("CD3", "CD4", "CD8a", "CD14", "CD19", "CD56")
]
rna_panel = [
FeatureRef(gene, assay="RNA", label=f"{gene} mRNA")
for gene in ("CD3D", "CD4", "CD8A", "CD14", "CD19", "NCAM1")
]
# Interleave each surface protein with a gene that encodes it (CD3/CD3D, CD4, CD8a/CD8A, CD14, CD19, CD56/NCAM1).
paired_panel = []
for protein, gene in zip(protein_panel, rna_panel, strict=True):
paired_panel.extend([protein, gene])
# Color the WNN UMAP by each protein beside its gene, drawing the highest values on top.
ds.plots.embedding(
layout=wnn["umap"], color_by=paired_panel, n_columns=2, sort_values=True
)
Started: 2026-11-14T15:42:52.206418Z | Wall time: 3.556 s
Each row pairs a protein with a gene that encodes it; CD3D encodes one chain of the CD3 complex. Protein colors show CLR values and mRNA colors library-size-normalized counts, each on its own scale, so compare where a marker is high rather than its colorbar numbers. CD3 protein and CD3D mRNA mark the T cells, the large central island. CD4 and CD8a protein divide that island sharply, CD4 into the center and bottom (clusters 1, 4, 10 and 11) and CD8a into the upper left (clusters 7, 8, 9 and 13). CD8A mRNA marks the same upper-left clusters more patchily, while CD4 mRNA is faint everywhere and no brighter on the CD4 T cells than on the monocytes. CD14 protein and mRNA mark the monocytes on the right (clusters 2 and 3), CD19 the B cells at the bottom (cluster 6), and CD56 protein the NK cells at the top (clusters 5 and 14), where NCAM1 mRNA is sparse.
Measure how protein and mRNA separate CD4 and CD8 T cells¶
For each WNN cluster, average the CD4 and CD8a protein, and compute the share of cells with at least one CD4 or CD8A mRNA count. ds.get_cell_vals reads one feature’s normalized values for the active cells (cell_key="I") by the feature’s name, which for an antibody is its TotalSeq-B name:
# Read each cell's CD4 and CD8a protein (CLR), and mark the cells with at least one CD4 or CD8A mRNA count.
markers = pd.DataFrame(
{
"CD4 protein": ds.get_cell_vals(from_assay="ADT", cell_key="I", k="CD4_TotalSeqB"),
"CD4 mRNA detected": ds.get_cell_vals(from_assay="RNA", cell_key="I", k="CD4") > 0,
"CD8a protein": ds.get_cell_vals(from_assay="ADT", cell_key="I", k="CD8a_TotalSeqB"),
"CD8A mRNA detected": ds.get_cell_vals(from_assay="RNA", cell_key="I", k="CD8A") > 0,
},
index=ds.cells.fetch("ids"),
)
# Add each cell's WNN cluster, matched by cell ID.
cells = wnn.cells.to_pandas_dataframe(["ids", "clusters"]).set_index("ids").join(markers)
# Average within each cluster, so that a detection column becomes the share of the cluster's cells with a count.
summary = cells.groupby("clusters").mean().round(2)
summary.insert(0, "cells", cells.groupby("clusters").size())
summary| cells | CD4 protein | CD4 mRNA detected | CD8a protein | CD8A mRNA detected | |
|---|---|---|---|---|---|
| clusters | |||||
| 1 | 1084 | 2.39 | 0.18 | 0.37 | 0.00 |
| 2 | 871 | 1.05 | 0.69 | 0.39 | 0.00 |
| 3 | 792 | 0.74 | 0.43 | 0.35 | 0.00 |
| 4 | 763 | 2.60 | 0.25 | 0.56 | 0.02 |
| 5 | 723 | 0.07 | 0.00 | 0.33 | 0.01 |
| 6 | 530 | 0.13 | 0.01 | 0.27 | 0.01 |
| 7 | 429 | 0.17 | 0.01 | 3.17 | 0.51 |
| 8 | 396 | 0.17 | 0.01 | 4.52 | 0.67 |
| 9 | 319 | 0.34 | 0.02 | 4.14 | 0.76 |
| 10 | 312 | 2.48 | 0.25 | 0.46 | 0.01 |
| 11 | 215 | 2.37 | 0.19 | 0.39 | 0.00 |
| 12 | 204 | 1.85 | 0.50 | 1.57 | 0.14 |
| 13 | 185 | 0.14 | 0.01 | 2.94 | 0.43 |
| 14 | 153 | 0.10 | 0.00 | 1.03 | 0.07 |
| 15 | 87 | 0.83 | 0.51 | 0.32 | 0.01 |
| 16 | 82 | 1.05 | 0.57 | 0.48 | 0.01 |
| 17 | 49 | 1.74 | 0.20 | 1.53 | 0.16 |
| 18 | 40 | 0.18 | 0.00 | 1.00 | 0.12 |
| 19 | 32 | 1.02 | 0.41 | 0.57 | 0.00 |
| 20 | 25 | 1.17 | 0.64 | 0.20 | 0.00 |
| 21 | 8 | 0.91 | 0.38 | 0.40 | 0.00 |
Started: 2026-11-14T15:42:55.766842Z | Wall time: 0.367 s
CD4 protein averages 2.37 to 2.60 in clusters 1, 4, 10 and 11 against 0.14 to 0.34 in clusters 7, 8, 9 and 13, and CD8a protein the reverse, 0.37 to 0.56 against 2.94 to 4.52, so the two antibodies split these eight T-cell clusters into the CD4 and CD8 lineages. Only clusters 12 and 17 carry both antibodies at intermediate levels (CD4 1.85 and 1.74, CD8a 1.57 and 1.53). The transcripts mark only part of each lineage. CD8A mRNA is specific, detected in at most 2% of the cells of the CD4 T-cell clusters, but in only 43 to 76% of the cells of the CD8 T-cell clusters. CD4 mRNA is detected in only 18 to 25% of the cells of the CD4 T-cell clusters, less often than in the CD14 monocytes of clusters 2 and 3 (69% and 43%), so the CD4 transcript is a poor marker of CD4 T cells in this dataset.
RNA clustering, which reads 1,000 variable genes rather than one marker, still keeps the CD4 and CD8 T cells apart: the WNN and SNN integration tutorial shows that the RNA and ADT clusterings disagree within lineages rather than between them, for example on memory and regulatory T-cell states that the panel’s CD45RA, CD45RO, CD127, CD25, PD-1 and TIGIT antibodies resolve.
Build a WNN result for your own data¶
In your own store, ds, analyze RNA first and then the antibody panel with cells=rna, since WNN combines runs of the same cells. These calls build runs like the prepared ones:
# Filter cells and analyze RNA: variable genes, PCA, graph, UMAP and clusters.
rna = ds.pipeline.rna(
label="rna",
hvg={"top_n": 1000},
pca={"dims": 15},
neighbors={"k": 21},
leiden={"partitions": [1.0]},
)
# Analyze the antibody panel over the cells that the RNA run kept.
adt = ds.pipeline.adt(
label="adt", cells=rna, neighbors={"k": 21}, leiden={"partitions": [1.0]}
)
# Combine the two runs with WNN, then embed and cluster the joint graph.
wnn = ds.pipeline.multimodal([rna, adt], label="wnn", leiden={"partitions": [1.75]})The prepared runs also skipped marker ranking (markers=False), and the RNA run skipped cell-cycle and doublet scoring (cell_cycle=False, doublets=False); the recipes run these stages by default. The ADT recipe leaves out antibodies whose names contain “isotype”, “control” or “ctrl”, normalizes the rest with CLR and reduces them with PCA; panel={"exclude": ...} takes another regular expression of names to leave out, and panel=None keeps every antibody. WNN is the default integration method, and method="snn" builds the SNN comparison from the same runs. Continue to Compare multimodal integration methods to name the WNN clusters from their protein profiles, see which assay each cluster leans on and compare WNN with SNN and with each assay’s own clusters, or to Integrate RNA, chromatin, and protein with TEA-seq to add chromatin accessibility as a third modality.
- Hao, Y., Hao, S., Andersen-Nissen, E., Mauck, W. M., Zheng, S., Butler, A., Lee, M. J., Wilk, A. J., Darby, C., Zager, M., Hoffman, P., Stoeckius, M., Papalexi, E., Mimitou, E. P., Jain, J., Srivastava, A., Stuart, T., Fleming, L. M., Yeung, B., … Satija, R. (2021). Integrated analysis of multimodal single-cell data. Cell, 184(13), 3573-3587.e29. 10.1016/j.cell.2021.04.048