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.

Compare biological conditions across donors

Do matched rheumatoid arthritis (RA) and control donors differ in gamma-delta T-cell expression of six selected genes? We will average expression within each donor and compare the 18 matched donor pairs with a Wilcoxon signed-rank test.

The donor is the biological replicate. Treating all 1,386 cells as independent replicates would give a misleading sample size, a problem called pseudoreplication. This example compares donor means of normalized expression. For a raw-count pseudobulk model, see Pseudobulk and differential expression (DE) primer.

Prepare the source data

The dataset comes from Binvignat et al. and its CELLxGENE collection. Unlike the prepared PBMC tutorials, this page starts from the full H5AD file. The first run needs network access, several GiB of memory, and space for both the download and a converted Zarr store. Later runs reuse those files.

The preparation below handles the large source once. The statistical workflow starts at Select the matched cells. For background on conversion, see Import and export.

Download and inspect

Started: 2026-10-11T18:54:43.385262Z | Wall time: 1.809 s

Download to a temporary filename so an interrupted download is not mistaken for a complete H5AD file.

('raw/X', 108717, 21648)

Started: 2026-10-11T18:54:45.196827Z | Wall time: 7.075 s

This file stores counts in raw/X. Inspection identifies that matrix before conversion, so we do not accidentally analyze the other expression matrix in X.

Convert and open a working store

Conversion uses a 6 GiB budget because the planned count layout needs about 5 GB. The finished store is moved into place only after conversion succeeds.

Started: 2026-10-11T18:54:52.274421Z | Wall time: 23.802 s

Keep the published cohort with min_features_per_cell=0, which drops only cells without detected features (none here). Mounting puts the new selection and test results in a temporary working store while leaving the count matrix in its reusable source store.

{'cells': 108717, 'genes': 21648}

Started: 2026-10-11T18:55:16.080057Z | Wall time: 3.369 s

Keep new selections and test results in a separate working store.

{'same cell count': True, 'same gene count': True}

Started: 2026-10-11T18:55:19.451409Z | Wall time: 2.011 s

Select the matched cells

The publication calls gamma-delta T cells yd T cells in fine_annot. pair_index_CW identifies matched RA-control pairs. Keep cells with that annotation and a recorded pair, then save the selection for both the test and plot.

{'selected cells': 1386, 'total cells': 108717}

Started: 2026-10-11T18:55:21.466187Z | Wall time: 0.104 s

Before testing, check that each donor belongs to one condition and one pair. Each pair must contain one donor from each condition.

donor_iddiseasepair_index_CW
83Control01_1_A_Mnormal1.0
15RA01_1_A_Mrheumatoid arthritis1.0
102Control03_1_C_Fnormal3.0
68RA03_1_C_Frheumatoid arthritis3.0
36Control04_1_C_Fnormal4.0
476RA04_1_C_Frheumatoid arthritis4.0
171Control05_1_C_Mnormal5.0
65RA05_1_C_Mrheumatoid arthritis5.0

Started: 2026-10-11T18:55:21.572507Z | Wall time: 0.066 s

disease normal 18 rheumatoid arthritis 18 Name: donors, dtype: int64

Started: 2026-10-11T18:55:21.640776Z | Wall time: 0.014 s

We have 1,386 cells from 36 donors in 18 matched pairs. Those 18 pairs, not the number of cells, determine the replication for the test.

Test a small gene panel

StudyDesign records which column identifies donors, conditions, and matched pairs. We use the same design again for the plot. CyteArc averages normalized expression within donors by default, then aligns the pairs for a two-sided signed-rank test.

Started: 2026-10-11T18:55:21.657212Z | Wall time: 0.005 s

Run the paired comparison on donor means.

Started: 2026-10-11T18:55:21.664552Z | Wall time: 2.227 s

The default Benjamini-Hochberg correction covers all six tests together. Read the adjusted p-values alongside the donor distributions, rather than looking only for a threshold crossing.

genen_pairsstatisticp_valuep_value_adjusted
0IFNG1839.01.0000001.0000
0IFIT21826.00.8784821.0000
0TNF1857.00.8647051.0000
0GZMA1863.00.3465500.6931
0ISG151813.00.1394140.6931
0S100A41835.00.2719480.6931

Started: 2026-10-11T18:55:23.894150Z | Wall time: 0.012 s

View the donor distributions

Each plotted point is a donor mean. The plot reads the saved test results for its brackets, so the displayed statistics come from the same comparison. Give the six rows enough space and enlarge the points so individual donors remain visible.

Six stacked violin plots compare matched donor mean expression in gamma-delta T cells between control and rheumatoid arthritis. Points represent donors; all six adjusted comparisons are nonsignificant at 0.05.

Started: 2026-10-11T18:55:23.908855Z | Wall time: 4.213 s

Compare RA and control within each gene’s row because the rows have separate value scales. The plot does not join matched donors with lines, although pairing is used in the test. None of these six comparisons passes an adjusted p-value threshold of 0.05 in this example.

Interpret the scope of the result

This donor-mean test does not reproduce the paper’s count-model pseudobulk analysis. The approaches summarize expression differently and make different statistical assumptions. A nonsignificant result here does not establish that the conditions are identical, nor does it tell us by itself why a difference was not detected.

  • Donors with few selected cells may have less precise means. This simple test does not model that uncertainty separately.

  • Matching does not remove all confounding. One selected pair spans batches 2 and 3, and this test has no batch term to separate that contribution.

  • This is a six-gene exploratory panel. Do not generalize its result to every gene or gamma-delta T-cell state.

For count-model analysis with a sample design, continue to Pseudobulk and differential expression (DE) primer.

References
  1. Binvignat, M., Miao, B. Y., Wibrand, C., Yang, M. M., Rychkov, D., Flynn, E., Nititham, J., Tamaki, W., Khan, U., Carvidi, A., Krueger, M., Niemi, E., Sun, Y., Fragiadakis, G. K., Sellam, J., Mariotti-Ferrandiz, E., Klatzmann, D., Gross, A. J., Ye, C. J., … Sirota, M. (2024). Single-cell RNA-Seq analysis reveals cell subsets and gene signatures associated with rheumatoid arthritis disease activity. JCI Insight, 9(16). 10.1172/jci.insight.178499