Tutorials › Statistical Methods for Single-Cell RNA Sequencing › A Worked Reconstruction of a Curved Cell-State Path

Pseudotime and Trajectory Inference · Tutorial 381 of 700

A Worked Reconstruction of a Curved Cell-State Path

Learn how a principal curve, a cell MST, and diffusion pseudotime reconstruct and order the same synthetic curved path—and why their orderings can disagree.

Advanced 12 min read

What You'll Learn

  • Project cells onto a fitted principal curve and convert projections to arc-length pseudotime.
  • Build a Euclidean cell MST and calculate root-to-cell path lengths.
  • Calculate one-step diffusion distances from a root on a reversible cell graph.
  • Compare the orderings and identify how a geometric shortcut changes an MST path.
  • Diagnose when a reconstruction depends on the embedding, graph, root, or smoothing choices.

Reconstructing One Path in Three Ways

A curved path of cell states can look simple in a two-dimensional embedding and still yield different inferred orders from different methods. A principal curve summarizes a smooth geometric trend, a minimum spanning tree (MST) connects cells with short edges, and diffusion pseudotime (DPT) compares cells through transitions on a neighborhood graph. Each result depends on a different representation of the cells. This worked reconstruction uses the same five hypothetical cells to make those distinctions explicit.

The example is deliberately small enough to calculate by hand. It is not evidence that any particular method is generally preferable. In a real analysis, the fitted curve, the coordinates used to build an MST, and the affinity graph used for DPT may differ, and each choice should be checked for its scientific and computational consequences.

Definition: A principal curve is a smooth curve that summarizes the central trend of a multivariate point cloud. In the self-consistency formulation, each point on the curve equals the conditional mean of observations that project to that point. A cell's principal-curve pseudotime can be defined as its projected position's arc length from a chosen root. A minimum spanning tree is a connected, cycle-free graph on the cells whose total edge length is minimal; rooting it gives a unique path from the root to every cell. Diffusion pseudotime orders cells by their diffusion distance from a root, where diffusion distance compares transition probabilities after a chosen number of steps on a cell graph.

These definitions describe different objects: a curve in a coordinate space, a tree of cell-to-cell edges, and a distance derived from transitions. The earlier material on principal curves, MSTs, and diffusion maps provides the background for these constructions; here the emphasis is on calculating and comparing their outputs. A comparison is meaningful only after stating which coordinates or graph are used, how the root is chosen, and which diffusion time is evaluated.

A Synthetic Curved Path and Its Principal-Curve Order

Consider five hypothetical cells, A through E, represented by two-dimensional coordinates. Suppose a smoothing procedure returns the following idealized fitted principal curve, a unit-circle arc running from angle \(0\) to \(3\pi/2\):

$$ \gamma(\theta)=(\cos\theta,\sin\theta), \qquad 0\leq\theta\leq\frac{3\pi}{2}. $$

The plotted coordinates are A \(=(1,0)\), B \(=(\sqrt{2}/2,\sqrt{2}/2)\), C \(=(0,1)\), D \(=(-\sqrt{2}/2,\sqrt{2}/2)\), and E \(=(0,-1)\). For this worked example, assume each cell projects to the corresponding point on the stated arc. This is an idealized fitted result: with real data, smoothing, projection, and boundary choices would determine the estimated curve and projections.

Worked Example: Projecting Cells and Measuring Arc Length

Take A as the root. For a unit circle, the arc length from angle \(0\) to angle \(\theta\) is \(s(\theta)=\theta\), since the radius is one. The projections have angles \(0,\pi/4,\pi/2,3\pi/4,3\pi/2\), respectively. Thus the principal-curve pseudotimes are:

$$ s_A=0,\quad s_B=\frac{\pi}{4}\approx0.7854,\quad s_C=\frac{\pi}{2}\approx1.571,\quad s_D=\frac{3\pi}{4}\approx2.356,\quad s_E=\frac{3\pi}{2}\approx4.712. $$

The resulting order is A, B, C, D, E. The units are coordinate units of arc length; they are not elapsed time. If the curve had radius \(r\) instead, its arc length would be \(r\theta\), so the scale would change while the ordering would not. In an actual fit, cells may not lie exactly on the curve, and projection can be ambiguous near loops or close branches.

A principal curve's self-consistency condition helps explain what the fitted curve is intended to represent: local averages of observations associated with a curve position should lie on the curve. That condition does not by itself guarantee a unique curve, a biologically correct root, or a reliable ordering. The example uses an explicitly stated fitted arc so that the projection and arc-length calculations are reproducible, rather than implying that five points uniquely determine a principal curve.

Building the Cell MST

Now build an MST using straight-line Euclidean distances between the same displayed coordinates. A Euclidean edge length is the square root of the sum of squared coordinate differences. The three consecutive edges A–B, B–C, and C–D each have length \(\sqrt{2-\sqrt{2}}\). The distance A–E is \(\sqrt{2}\), while D–E is longer:

$$ d(D,E)=\sqrt{\left(\frac{\sqrt{2}}{2}\right)^2+ \left(1+\frac{\sqrt{2}}{2}\right)^2} =\sqrt{2+\sqrt{2}}\approx1.848. $$

Worked Example: Root-to-Cell Lengths on the MST

Kruskal's algorithm adds edges in increasing order of length, skipping any edge that would create a cycle. The three consecutive edges of length \(\sqrt{2-\sqrt{2}}\approx0.7654\) connect A through D. The shortest edge attaching E to this component is A–E, with length \(\sqrt{2}\approx1.414\); every other edge from E to the component is longer. The resulting MST therefore has edges A–B, B–C, C–D, and A–E.

Root the tree at A and define each cell's tree pseudotime as the sum of edge lengths along its unique root path. Then:

$$ t_A=0,\quad t_B=\sqrt{2-\sqrt{2}}\approx0.7654,\quad t_C=2\sqrt{2-\sqrt{2}}\approx1.531, $$
$$ t_D=3\sqrt{2-\sqrt{2}}\approx2.296,\qquad t_E=\sqrt{2}\approx1.414. $$

The MST order is A, B, E, C, D. E precedes C and D by this measure because the displayed coordinates make A–E a shorter connection than the long curved route through B, C, and D. This is a geometric shortcut relative to the assumed arc, not a calculation error. The edge lengths and root-to-cell sums are in coordinate units.

The MST has minimized total edge length, not recovered the assumed arc's direction or length. In particular, an MST does not intrinsically define biological time: its order depends on the root, its branch structure, and the metric used to calculate edges. If coordinates are an embedding that distorts distances, an MST built there can inherit that distortion.

Calculating Diffusion Pseudotime on a Cell Graph

For contrast, suppose a separately specified local-affinity graph connects the cells in a chain A–B–C–D–E, with equal edge weights. This graph might be built from features other than the two displayed coordinates. Define a lazy random walk: at each step the chain stays at its current cell with probability \(1/2\) and uses the remaining probability to move to a neighboring cell, divided equally between neighbors. At an endpoint, the only neighbor receives the remaining probability. This makes the transition matrix \(P\) reversible, with stationary probabilities proportional to node degree: \(\pi=(1/8,1/4,1/4,1/4,1/8)\).

At diffusion time \(1\), define the diffusion distance from root A to cell \(i\) as the stationary-weighted distance between their one-step transition distributions:

$$ D_1(A,i)= \left[ \sum_{k\in\{A,B,C,D,E\}} \frac{\left(P_{Ak}-P_{ik}\right)^2}{\pi_k} \right]^{1/2}. $$

The stationary weights matter: differences in transition probability at a cell with small stationary probability receive more weight. This is a standard reversible-graph diffusion-distance convention. Other diffusion times or normalizations can produce different numeric distances, so the convention must accompany reported values.

Worked Example: One-Step Diffusion Distances from A

The one-step transition distributions for A, B, C, D, and E, in that order, are \((1/2,1/2,0,0,0)\), \((1/4,1/2,1/4,0,0)\), \((0,1/4,1/2,1/4,0)\), \((0,0,1/4,1/2,1/4)\), and \((0,0,0,1/2,1/2)\). For B, subtract its row from A's. The only nonzero differences are \(1/4\) at A and \(-1/4\) at C, giving:

$$ D_1(A,B)= \sqrt{\frac{(1/4)^2}{1/8}+\frac{(-1/4)^2}{1/4}} =\sqrt{0.75}\approx0.8660. $$

For C, the difference vector is \((1/2,1/4,-1/2,-1/4,0)\), so \(D_1(A,C)=\sqrt{2+0.25+1+0.25}=\sqrt{3.5}\approx1.871\). For D, the vector is \((1/2,1/2,-1/4,-1/2,-1/4)\), giving \(D_1(A,D)=\sqrt{2+1+0.25+1+0.5}=\sqrt{4.75}\approx2.179\). For E, the vector is \((1/2,1/2,0,-1/2,-1/2)\), giving \(D_1(A,E)=\sqrt{2+1+0+1+2}=\sqrt{6}\approx2.449\). The root's distance from itself is zero.

Thus this graph gives the order A, B, C, D, E. These are diffusion-distance values, not sums of graph-edge lengths. In this particular chain and at this diffusion time, they increase in the chain order; that monotonicity is not guaranteed for every graph or time.

Why the Orderings Differ

The three reconstructions can be compared directly. The principal curve follows the stated smooth arc and orders cells by projected arc length. The MST uses displayed Euclidean geometry and shortcuts from A to E. DPT uses transition behavior on the separately specified chain graph and places E last. Each method answers a different operational question, as summarized below.

MethodQuantity used for orderingOrder in this example
Principal curveArc length from the root projectionA, B, C, D, E
MSTSum of edge lengths along the rooted treeA, B, E, C, D
Diffusion pseudotimeDiffusion distance from the root at time 1A, B, C, D, E

The example's diffusion graph and displayed coordinates intentionally encode different relationships: the graph preserves a local chain, while straight-line distances make E close to A. That contrast isolates the effect of representation. In practice, if all methods are built from the same embedding or affinity matrix, their outputs are not independent checks; shared preprocessing choices can create shared errors.

Justification: The MST shortcut follows directly from the edge comparison. Once A–B, B–C, and C–D connect A through D, the smallest edge that attaches E is A–E, of length \(\sqrt{2}\). Since \(\sqrt{2}<\sqrt{2+\sqrt{2}}\), D–E cannot replace it; the remaining E-to-component distances are also larger than A–E. Therefore the MST attaches E to A, and its rooted path places E at \(\sqrt{2}\), before C at \(2\sqrt{2-\sqrt{2}}\), because \(\sqrt{2}<2\sqrt{2-\sqrt{2}}\).

Diagnostics, Failure Modes, and Limitations

A useful reconstruction includes checks on both the input representation and the resulting order. For a principal curve, inspect cell-to-curve projection distances, the fitted curve's smoothness, and whether projections are stable when the smoothing choices change. Large residuals can indicate that a single curve is a poor summary, while close or looping segments can make projection ambiguous. A curve can also be sensitive to endpoints, which are especially consequential when arc length is measured from a root.

For an MST, inspect unusually long edges, short-circuit edges across nearby branches, and whether small perturbations to coordinates change the tree. An MST is always a spanning tree when the input distances connect all cells, but that mathematical property does not establish that its edges represent plausible developmental transitions. For DPT, check graph connectivity, the root, neighborhood and kernel choices, and whether the ordering is stable across diffusion times. A disconnected graph has no finite diffusion path between components, and weak or spurious edges can dominate apparent connectivity.

The main alternatives are not interchangeable estimators of a single guaranteed true ordering. A curve gives a continuous geometric path but may oversmooth branching structure. An MST makes branches explicit and offers paths through a tree, but it can be sensitive to distance geometry and can impose a tree even when the state structure is not tree-like. Diffusion methods use multistep connectivity and can be less dependent on individual edges, but their output depends on graph construction, transition normalization, root, and diffusion time. None of these methods alone establishes elapsed time, causal direction, or a unique biological lineage.

Worked Example: Diagnosing a Shortcut Before Interpreting It

Suppose the MST result places E before C, although the fitted principal curve places E last. First compare the actual quantities: \(t_E=\sqrt{2}\approx1.414\), while \(t_C=2\sqrt{2-\sqrt{2}}\approx1.531\). The MST order is therefore consistent with its edge lengths. Next inspect the edges: the tree attaches E directly to A, even though the assumed curved path reaches E only after D. This suggests the tree's coordinate metric permits a shortcut.

The discrepancy is a diagnostic signal, not proof that either method is wrong. Check whether the embedding's distances are suitable for MST construction and whether the graph used for diffusion represents local relationships in the intended feature space. If the scientific interpretation requires the curved route, report that the MST's Euclidean shortcut conflicts with that assumption rather than silently changing the tree or treating the MST order as biological time.

Common Mistake

A common mistake is to say, “The MST is the shortest path through the cells, so it must give the true cell order.” The MST minimizes the total length of a spanning tree; it does not minimize every root-to-cell path subject to following a presumed curved biological trajectory. In this example it makes a valid minimum spanning tree by connecting E directly to A. The correction is to state the graph, metric, and root, calculate the resulting paths, and interpret them as an ordering under those choices—not as observed time or proven lineage.

Key takeaway: A principal curve, an MST, and DPT can order the same cells differently because they summarize different geometries and connectivities. Reconstruct the quantities explicitly, inspect the representation and root, and treat agreement as useful evidence to investigate—not proof that an ordering is biological time.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. On a unit-circle arc rooted at angle \(0\), what is the principal-curve pseudotime for a cell projected to angle \(\pi\)?
  2. In the example, why does the MST place E before C even though E is last on the fitted arc?
  3. For the stated lazy chain, what is the diffusion distance \(D_1(A,B)\), and what stationary probabilities are used in its calculation?
  4. Name two checks that would help diagnose an unstable principal-curve or DPT ordering.

Solutions. (1) The arc length is \(s(\pi)=\pi\) coordinate units because the circle has radius one. (2) The MST attaches E directly to A at length \(\sqrt{2}\approx1.414\), making \(t_E=1.414\), less than \(t_C=2\sqrt{2-\sqrt{2}}\approx1.531\); the tree follows Euclidean edge lengths, not the stipulated arc. (3) \(D_1(A,B)=\sqrt{(1/4)^2/(1/8)+(-1/4)^2/(1/4)}=\sqrt{0.75}\approx0.8660\), using \(\pi_A=1/8\) and \(\pi_C=1/4\) for the two nonzero differences. (4) Examples include checking projection distances and sensitivity to smoothing choices for the curve, and checking graph connectivity and ordering stability across graph scales or diffusion times for DPT.

Clinical Biostats