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.

Order cells by pseudotime and follow gene expression

A single-cell snapshot of a developing tissue holds cells at many stages of a process at once. Pseudotime orders those cells along the process, so that each gene can be followed from the start to the ends. This page orders 3,696 cells of the embryonic mouse pancreas Bastidas-Ponce et al., 2019 from Ductal cells to the four endocrine types Alpha, Beta, Delta and Epsilon, then finds the genes that change along that order in two ways: by correlating each gene with pseudotime, and by grouping genes with similar profiles into modules.

The order runs from the Ductal cells near 0 (median 0.017), through the endocrine progenitors with high Neurog3 expression in the middle (median 0.559), to the four endocrine types near 1 (medians 0.952 to 0.977). Genes high in all four endocrine types, such as Gnas (r = 0.73), correlate most strongly with pseudotime, while each hormone gene correlates weakly because only one type expresses it. Neurog3 itself does not correlate with pseudotime at all (r = 0.001) because it rises and then falls; grouping genes by profile places it in a module of 1,229 genes that peaks at pseudotime 0.51, where the progenitors sit.

Open the prepared analysis

DataStore has 3696 (3696) cells with 1 assays: RNA Cell metadata: 'I', 'ids', 'names', 'G2M_score', 'RNA_UMAP1', 'RNA_UMAP2', 'RNA_clusters', 'RNA_leiden_cluster', 'RNA_nCounts', 'RNA_nFeatures', 'RNA_percentMito', 'RNA_percentRibo', 'S_score', 'clusters', 'clusters_coarse' RNA assay has 27998 features and following metadata: 'I', 'ids', 'names', 'dropOuts', 'highly_variable_genes', 'nCells'

Started: 2026-11-24T13:04:32.910148Z | Wall time: 9.316 s

The store holds 3,696 cells and 27,998 genes. Its saved rna analysis supplies what the steps below reuse: the neighbor graph, the UMAP and a feature selection that holds every gene. ds.pipeline.open returns that run, and indexing the run by the name of one of its outputs, such as analysis_run["connectivity_map"], returns that output as an artifact reference, a handle to an immutable saved result that later calls take as input. The clusters column holds the cell types that the authors published, not clusters computed by the run. Besides Ductal cells and the Alpha, Beta, Delta and Epsilon endocrine cells, the published types include Pre-endocrine cells and two groups of endocrine progenitors (EP), Ngn3 low EP and Ngn3 high EP, named for their low or high expression of Neurog3, which is also called Ngn3.

Choose the source and the sinks

CyteArc’s pseudotime takes the start and the ends of the process as input rather than finding them. It uses population balance analysis Weinreb et al., 2018, which treats the source as where cells enter the process and the sinks as where they leave it, and solves on the neighbor graph for a potential: one value per cell that rises from the source to the sinks. The source and sinks enter as a source-sink vector, which gives each cell a weight: negative weights mark the source, positive weights the sinks, and the weights sum to zero. Here the Ductal cells are the source and the four published endocrine types are the sinks, the same source and sinks that the fate mapping and lineage dynamics tutorials use. The source cells share a total weight of -1 and the sink cells a total of +1, so the two ends weigh the same although they differ in size.

cellstotal weight
source: Ductal916-1.0
sinks: Alpha, Beta, Delta, Epsilon12841.0

Started: 2026-11-24T13:04:42.226969Z | Wall time: 0.011 s

The source holds 916 Ductal cells and the sinks 1,284 endocrine cells; every other cell has weight 0.

Score pseudotime

trajectory.pseudotime solves for the potential on the saved graph and rescales it so that the cell with the lowest potential scores 0 and the cell with the highest scores 1. It scores one connected component of the graph, by default the largest or, with component_policy="sources", the one that holds the most source cells, and marks the cells outside that component as invalid in the valid array of the loaded result. The plot shows pseudotime beside the published cell types; color_by takes the pseudotime artifact reference directly, so the scores need no column in the cell table.

Component sizes: (3696,); scored cells: 3696
Two UMAP panels of the 3,696 pancreas cells. Left, colored by published cell type: Ductal cells with scattered Ngn3 low EP cells on the right, an arc of Ngn3 high EP cells across the top, Pre-endocrine cells at the upper left, and Beta, Alpha, Delta and Epsilon cells at the lower left and center. Right, colored by pseudotime from 0 (dark purple) to 1 (yellow): scores stay near 0 over the Ductal region, rise along the arc, and are close to 1 over the endocrine cells.

Started: 2026-11-24T13:04:42.238765Z | Wall time: 0.704 s

All 3,696 cells form one connected component, so every cell is scored. On the UMAP, pseudotime rises from the Ductal and Ngn3 low EP cells on the right, along the arc of Ngn3 high EP cells across the top, to the Pre-endocrine cells and the four endocrine types on the left.

count25%50%75%
cell type
Ductal9160.0090.0170.022
Ngn3 low EP2620.0210.0360.073
Ngn3 high EP6420.3860.5590.636
Pre-endocrine5920.8280.8900.929
Epsilon1420.9330.9520.967
Delta700.9530.9570.957
Alpha4810.9680.9750.979
Beta5910.9650.9770.990

Started: 2026-11-24T13:04:42.944088Z | Wall time: 0.012 s

The medians follow the published stages in order: Ductal 0.017, Ngn3 low EP 0.036, Ngn3 high EP 0.559 and Pre-endocrine 0.890, then Epsilon 0.952, Delta 0.957, Alpha 0.975 and Beta 0.977. Ngn3 low EP cells score almost as low as Ductal cells, so the graph barely separates the two. Ngn3 high EP cells spread across the middle of the range, with quartiles at 0.386 and 0.636, so the ordering places most of the transition from progenitor to endocrine cell within this population. Pseudotime measures position on the graph, not elapsed time: the gap between two populations need not match how long the transition takes.

Find genes that change along pseudotime

trajectory.markers computes Pearson’s correlation r between pseudotime and each gene’s expression, normalized for library size without a log transform, over the scored cells, and adjusts the p-values for the false discovery rate over the tested genes Benjamini & Hochberg, 1995. Genes expressed in fewer than 10 cells (min_cells) are not tested and have no p-value.

13,821 of 27,998 genes tested; 9,388 with an adjusted p-value below 0.05
increasingdecreasing
feature_namer_valuefeature_namer_value
0Gnas0.73Spp1-0.83
1Aplp10.73Rpl13-0.82
2Cpe0.73Rps19-0.81
3Fam183b0.67Rps8-0.81
4Hmgn30.64Dbi-0.80
5Bex20.62Rpl32-0.78
6Pcsk1n0.62Rps4x-0.78
7Ubb0.60Rpl12-0.77
8Rap1b0.60Rps2-0.75
9Scgn0.59Mgst1-0.75

Started: 2026-11-24T13:04:42.956591Z | Wall time: 1.327 s

Of the 27,998 genes, 13,821 reach the 10-cell minimum and are tested, and 9,388 of those have an adjusted p-value below 0.05. Gnas, Aplp1 and Cpe correlate most strongly, each with r = 0.73, and three of the top ten, Cpe, Pcsk1n and Scgn, take part in processing and secreting hormones. The strongest negative correlations are those of Spp1 (r = -0.83), which the ductal epithelium expresses, seven ribosomal protein genes (r = -0.82 to -0.75), Dbi and Mgst1.

The hormone genes of the four endocrine types, Gcg (Alpha), Ins1 (Beta), Sst (Delta) and Ghrl (Epsilon), are missing from the top of the list. The table looks them up, with Neurog3:

r_valuep_value_adjustedrank
feature_name
Neurog30.0010.977821
Gcg0.2242.4e-42587
Ins10.1811.3e-27902
Sst0.0891.7e-072565
Ghrl0.1413.7e-171400

Started: 2026-11-24T13:04:44.284672Z | Wall time: 0.004 s

The hormone genes correlate weakly with pseudotime, from r = 0.089 for Sst at rank 2,565 of 13,821 to r = 0.224 for Gcg at rank 587, and Neurog3 does not correlate at all (r = 0.001, adjusted p-value 0.97). Sst’s weak correlation still has an adjusted p-value of 1.7×10−71.7 \times 10^{-7}: across 3,696 cells, weak trends reach significance, so r, not the p-value, says how closely a gene follows pseudotime. Mapping each gene beside pseudotime shows why the hormone genes and Neurog3 correlate weakly, with Gnas for comparison:

Seven UMAP panels of the 3,696 pancreas cells in two rows of four, with the last slot empty. The first panel is colored by pseudotime from 0 (dark purple) to 1 (yellow): near 0 over the Ductal cells on the right, rising along the arc across the top, and near 1 over the endocrine cells on the left. The other six are colored by the log1p normalized expression of Neurog3, Gcg, Ins1, Sst, Ghrl and Gnas. Neurog3 is high along the arc, where pseudotime is in the middle of its range, and low on both sides. Gcg, Ins1, Sst and Ghrl are each confined to one endocrine population where pseudotime is near 1: Gcg to the Alpha cells at the lower center, Ins1 to the tip of the Beta cells at the lower left, Sst to the small Delta cluster and Ghrl to the strip of Epsilon cells. Gnas is high across all the endocrine and Pre-endocrine cells on the left and low over the Ductal cells on the right.

Started: 2026-11-24T13:04:44.289556Z | Wall time: 0.609 s

Each hormone gene is confined to its own endocrine type. A pooled pseudotime puts all four types at the end of one axis, so each hormone gene is off in most late cells, which keeps its correlation low, while Gnas, high in all four types, correlates strongly. The hormones of the two smallest types correlate least: Sst of the 70 Delta cells (r = 0.089) and Ghrl of the 142 Epsilon cells (r = 0.141). Neurog3 is high along the arc of Ngn3 high EP cells, where pseudotime is in the middle of its range, and low on both sides, so it has no overall trend for a correlation to find. The modules below find transient genes such as Neurog3.

Group genes into expression modules

Correlation finds steady trends and misses genes that peak partway. trajectory.aggregation instead builds a profile of each gene along pseudotime and groups genes with similar profiles into modules:

  1. It sorts the scored cells by pseudotime, smooths each gene’s normalized expression with a centered rolling mean over 200 cells (window_size), and standardizes it.

  2. It splits the sorted cells into 50 bins (chunk_size) that each hold the same number of cells, and averages each gene within each bin.

  3. It drops the genes whose mean normalized expression does not exceed min_exp or whose smoothed profile is flat, which leaves 12,455 genes, fewer than the 13,821 that the correlation tested.

  4. It clusters a nearest-neighbor graph of the profiles into 10 modules (n_clusters), numbered in order of the median of their genes’ peak bins.

In the heatmap, each row is a gene, each column a bin, and the bar below gives each bin’s mean pseudotime.

Heatmap of the standardized expression profiles of 12,455 genes (rows) across 50 pseudotime bins of equal cell count (columns), colored from blue (2 standard deviations below a gene's mean) to red (2 above). A side bar groups the rows into modules 1 to 10 from top to bottom, and a bar below shows each bin's mean pseudotime: dark purple over about the first third of the bins, blue, teal and green over the next fifth, and yellow-green to yellow over the last half. High expression descends in a staircase: modules 1 to 4 in the first third of the bins, module 5, which holds Neurog3, in a narrow band where the pseudotime bar changes from dark purple to teal, modules 6 and 7 at the center and just after it, and modules 8, 9 and 10 over the last third. Module 2 is below its mean across the middle bins and above it on both sides.

Started: 2026-11-24T13:04:44.900974Z | Wall time: 5.981 s

The modules form a staircase: the modules of the Ductal start, 1 to 4, are high in the first third of the columns, the Neurog3 module, 5, in a narrow band where pseudotime climbs through the middle of its range, modules 6 and 7 at the center of the heatmap and just after it, and modules 8 to 10, among them the modules of Sst, Ins1 and Gcg, in its last third. Module 2 is the exception: its genes dip across the middle columns and sit above their mean on both sides. Because every bin holds the same number of cells, the columns follow cell counts rather than pseudotime: the Ductal and Ngn3 low EP cells, a third of all cells, fill the first third of the columns, the Ngn3 high EP and Pre-endocrine cells fill the middle third, across which pseudotime climbs through most of its range, and the four endocrine types fill the last third.

To read a module, rank its genes by membership: the correlation of a gene’s profile with its module’s average profile. The next cells compute membership for every gene and summarize each module by its size, the pseudotime at which its average profile peaks, its five most typical genes, those of highest membership, and the genes named above that it holds.

12,455 genes in 10 modules

Started: 2026-11-24T13:04:50.883375Z | Wall time: 0.494 s

genespeak pseudotimemost typical genesgenes discussed above
module
19560.00Lsm2, Cdca7l, Ptn, Dctpp1, Shmt1
210550.00Polr2f, Hprt, Elovl6, Mvb12a, Pgm2
313050.02Epn3, Ggt1, Bst2, Spp1, Decr1Spp1
410660.03Grb7, Clic1, Pld1, Rdx, Palld
512290.51Tead2, Cdk4, Mex3a, Mospd1, MagohNeurog3
615950.79Gtf2b, Nipbl, Bckdha, Cyth2, Serping1Ghrl
76040.90Gm43861, Vdr, Pgf, Med25, Ddc
815220.98Gabarapl2, Srp14, Rundc3a, Pnmal2, Tmed8
913410.951700007K13Rik, Cbarp, Sirt3, Nmt2, Rap1bSst, Gnas
1017821.00Gns, Slc16a12, 2410015M20Rik, Ush1c, Abcc8Ins1, Gcg

Started: 2026-11-24T13:04:51.378287Z | Wall time: 0.009 s

Modules 1 and 2 peak first, at the start of the order, and module 1 counts Shmt1 and Dctpp1, two genes of nucleotide metabolism, among its most typical genes. The Spp1 module, module 3, peaks at 0.02 among the Ductal cells. The Neurog3 module, module 5 with 1,229 genes, peaks at 0.51, where the Ngn3 high EP cells sit: the transient progenitor program that correlation missed forms a module of its own. The hormone genes fall into the late modules, in the order of their cell types’ medians: Sst, with Gnas, into module 9, which peaks at 0.95 (Delta median 0.957), and Gcg and Ins1 into module 10, which peaks at 1.00 (Alpha median 0.975, Beta 0.977). Ghrl, the hormone of the Epsilon cells (median 0.952), joins module 6, whose average peaks earlier, at 0.79, before most Pre-endocrine cells. The numbering follows the median of the genes’ own peaks, so the peaks of the module averages can fall out of order: module 8, whose genes stay above their mean from the middle of the order on, comes before the Sst module although its average peaks later, at 0.98 against 0.95. The five most typical genes of the other modules point to no single process.

The modules depend on three settings: a narrower window_size keeps brief peaks and more noise, more bins (chunk_size) resolve the order more finely, and a larger n_clusters splits the profiles into more modules. Before interpreting a module, change one setting at a time and check that the module persists.

Follow each lineage separately

The fate mapping tutorial computes each cell’s probability of reaching each endocrine type from the same source and sinks, and the lineage dynamics tutorial weighs cells by those probabilities to follow genes that change in one lineage only, such as the hormone genes. The lineage curves tutorial fits a curve to each lineage, and its validation checks rescore one lineage on its own subgraph, test the direction without a source and find the cells that follow no lineage.

References
  1. Bastidas-Ponce, A., Tritschler, S., Dony, L., Scheibner, K., Tarquis-Medina, M., Salinno, C., Schirge, S., Burtscher, I., Böttcher, A., Theis, F. J., Lickert, H., & Bakhti, M. (2019). Comprehensive single cell mRNA profiling reveals a detailed roadmap for pancreatic endocrinogenesis. Development, 146(12), dev173849. 10.1242/dev.173849
  2. Weinreb, C., Wolock, S., Tusi, B. K., Socolovsky, M., & Klein, A. M. (2018). Fundamental limits on dynamic inference from single-cell snapshots. Proceedings of the National Academy of Sciences, 115(10). 10.1073/pnas.1714723115
  3. Benjamini, Y., & Hochberg, Y. (1995). Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing. Journal of the Royal Statistical Society Series B: Statistical Methodology, 57(1), 289–300. 10.1111/j.2517-6161.1995.tb02031.x