TrajLens: Cross-Sample Trajectories
- TrajLens is a visual analytics system that integrates a graph neural network with interactive tools to infer cross-sample cell trajectories.
- It combines gene expression profiles, spatial distribution, and temporal ordering to reveal developmental paths across samples.
- The system supports human-in-the-loop analysis, enabling biologists to refine and validate trajectory predictions using multi-view visualization.
Searching arXiv for the TrajLens paper and a small set of related trajectory-inference references mentioned in the source material. TrajLens is a visual analytics system, coupled with a graph neural network (GNN) model, designed specifically to help biologists construct, inspect, and refine cross-sample cell developmental trajectories from multi-sample single-cell RNA sequencing (scRNA-seq) data with spatial information (Wang et al., 21 Jul 2025). It addresses a setting in which multiple samples correspond to different developmental stages, tissue sections, conditions, donors, or batches, and where the central analytical problem is not merely within-sample pseudotime ordering but the reconstruction of developmental relationships across samples while preserving spatial context. In the formulation presented by its authors, TrajLens combines automated cross-sample link prediction, path aggregation, and a multi-view interface for spatial and functional inspection, thereby supporting a human-in-the-loop workflow rather than a purely automatic trajectory inference pipeline.
1. Problem setting and analytical scope
TrajLens is motivated by a specific limitation of existing trajectory-analysis workflows in scRNA-seq: many established methods, including Monocle, PAGA, DTFLOW, and VeloViz, establish cell developmental trajectories within individual samples, but do not explicitly connect cell populations across samples (Wang et al., 21 Jul 2025). In practical biological studies, however, many questions are intrinsically cross-sample. Samples may represent distinct embryonic days, different tissue regions, or separate biological conditions, and investigators often want to determine how a progenitor or intermediate population evolves across these sampled states.
The authors describe the manual alternative as labor-intensive and error-prone. Biologists typically infer trajectories within each sample, then manually decide which cell populations in one sample correspond developmentally to populations in later samples, while simultaneously considering gene expression, cell annotations, and spatial organization. Because spatial distributions vary and cells can move or reorganize, this becomes a many-to-many correspondence problem across numerous populations and stages. TrajLens is therefore framed as a system for cross-sample trajectory construction that integrates gene-expression-derived identity, spatial context, and stage ordering into a joint analytical environment (Wang et al., 21 Jul 2025).
A central conceptual point is that TrajLens is not presented as a single-cell lineage tracer. The abstraction operates over cell populations, identified in the paper as cell types or clusters, rather than over individual cells. This distinction matters because it places the method closer to graph-based population trajectory analysis than to explicit cell-level fate mapping. A plausible implication is that TrajLens is best understood as a mesoscale framework: it reconstructs developmental structure among sample-specific populations and then exposes those structures for interactive biological validation.
2. Formalization of cross-sample developmental trajectories
The paper formalizes the data as a global graph over cell populations across samples (Wang et al., 21 Jul 2025). For each sample , there is a set of vertices , where each vertex denotes a cell population in that sample, and the global vertex set is
Edges represent developmental trajectories between populations in different samples:
A developmental trajectory is then defined as a temporally ordered sequence of transitions,
while a cross-sample cell developmental path is a collection of trajectories sharing the same cell-type sequence but differing in their sample combinations:
This distinction between a single trajectory and a path is one of the paper’s key formal contributions. A trajectory corresponds to one specific sample sequence; a path aggregates repeated evidence for the same cell-type progression across multiple sample combinations. The authors use this construct to reason about high-frequency paths, which become visually prominent and analytically important in the interface (Wang et al., 21 Jul 2025).
The design of TrajLens is organized around five analytical tasks derived from interviews with six biologists. These tasks are: selecting a core cell type based on temporal occurrence and abundance changes across stages; identifying high-frequency predicted paths involving the core cell; assessing spatial continuity and directionality along paths; examining individual trajectories within a path; and identifying differentially expressed genes and gene functions associated with specific trajectories. These tasks structure both the model post-processing and the interface design.
3. Predictive model and post-processing pipeline
The predictive component of TrajLens is a GNN-based edge-prediction model for cross-sample developmental links (Wang et al., 21 Jul 2025). Training data are constructed from a Mouse-Embryo dataset using PAGA on clustered scRNA-seq data, where nodes correspond to cell populations and PAGA-inferred edges are treated as ground truth for training. Positive edges are existing links, and negative edges are sampled non-edges that are regenerated per epoch.
Node features combine gene expression and spatial distribution. For each cell population, the top 20 differentially expressed genes are identified via the Wilcoxon rank-sum test. Each gene is embedded using BioLinkBERT into a 1024-dimensional semantic vector, and the resulting representation is combined into a 1024-dimensional gene feature for the node. Spatial distribution is represented by taking the member cells’ coordinate matrix and applying PCA to obtain a 1024-dimensional summary. Concatenation yields a 2048-dimensional node feature vector (Wang et al., 21 Jul 2025).
The model architecture combines a two-layer Graph Attention Network with multi-head attention and a two-layer Graph Convolutional Network, fused with residual connections. In the authors’ description, this is intended to capture both local, feature-aware relationships and broader graph topology. Training is performed in PyTorch on a 48GB NVIDIA RTX 4090 for 100 epochs with batch size 8, approximately parameters, and the AdamW optimizer with learning rate (Wang et al., 21 Jul 2025).
After inference on edge-less graphs for new datasets, the model outputs edge probabilities. The authors report exploring edge-probability thresholds and selecting $0.75$ as a cutoff giving the best precision; edges with probability 0 are retained as predicted developmental trajectories (Wang et al., 21 Jul 2025). The predicted graph is then refined by explicit biological constraints. Edges must connect different cell types,
1
and must point from earlier to later stages,
2
Multiple edges with the same source and target are aggregated, with weight defined as the number of occurrences. Because the initial predicted graph is described as dense, with density approximately 3, the system keeps only the top 4 most frequent paths, consistent with the authors’ stated focus on top 5–15% high-confidence features (Wang et al., 21 Jul 2025).
Path construction is performed by breadth-first search from a user-selected core cell type on the predicted graph, producing a hierarchical tree of ancestor and descendant populations. This yields the path space over which the interface operates. The resulting analytical object is thus neither a raw GNN edge list nor a conventional pseudotime graph; it is a filtered, aggregated, frequency-ranked tree of cross-sample developmental paths.
4. Spatial representation and visual analytics workflow
A distinctive element of TrajLens is its treatment of spatial developmental direction. For each cell population, PCA is applied to the 2D cell coordinates 5, and the first principal component defines a directional vector in 6 (Wang et al., 21 Jul 2025). Directional stability is quantified as
7
where 8 and 9 are the eigenvalues of the first and second principal components. Values of 0 indicate stable, well-defined directionality. In the interface, this is encoded by fan-shaped arcs around centroid markers, where the central angle denotes the main direction and the angular span denotes directional variance.
The interface is structured as a five-step workflow, with each view corresponding directly to one of the analytical tasks.
| View | Purpose | Task |
|---|---|---|
| Core Cell Selection View | Select important core cell types based on temporal occurrence and abundance changes | T1 |
| Path Selection View | Identify predicted high-frequency paths involving the core cell | T2 |
| Path Inspection View | Compare spatial continuity, directionality, and path frequency across paths | T3 |
| Trajectory Inspection View | Inspect sample-specific trajectories within a selected path | T4 |
| Gene Function View | Examine GO-enriched functions for selected trajectories | T5 |
In the Core Cell Selection View, each row corresponds to a cell type and includes a line chart whose 1-axis is developmental stage and whose 2-axis is cell count. This view supports identification of persistent, emerging, disappearing, or sharply changing populations. The Path Selection View then presents a hierarchical tree centered on the core cell, with predecessors and successors arranged in columns according to topological distance and vertically ordered by the number of paths passing through them. Hover interactions reveal temporal line charts, and filtering allows low-frequency paths to be removed (Wang et al., 21 Jul 2025).
The Path Inspection View is the principal comparative workspace. Each row corresponds to one cross-sample path. For each node in a row, TrajLens displays layered contour maps summarizing spatial distributions, with an outer contour for 98% cell density coverage and an inner contour for 94% density coverage. Rows are aligned to the selected core cell, and edges encode similarity of spatial distributions between consecutive cell types. Additional summary encodings include centroid markers whose size reflects average cell count, fan-shaped direction arcs, multi-projection summaries along the 3- and 4-axes, and a frequency bar whose width and color intensity represent the path frequency (Wang et al., 21 Jul 2025). When a row is selected, bar charts above node columns show contour-map similarity across paths at corresponding positions.
The Trajectory Inspection View moves from the aggregated path level to individual trajectories, each row representing a sequence of cell populations across specific samples. Nodes show sample-level spatial contours and density projections, allowing consistency and heterogeneity across trajectories in the same path to be examined. Finally, the Gene Function View performs Gene Set Enrichment Analysis against the Gene Ontology database using GOATOOLS and a mouse Gene Association File. The table lists GO term ID, description, and 5-value, with rows where 6 highlighted in green, and expandable rows reveal the genes associated with a GO term (Wang et al., 21 Jul 2025).
5. Human-in-the-loop analysis and empirical evaluation
TrajLens is explicitly presented as an integration of automated prediction and interactive expert analysis (Wang et al., 21 Jul 2025). The GNN predicts candidate cross-sample links; the interface aggregates them into paths, visualizes their frequency and spatial similarity, and allows experts to accept, reject, or prioritize paths during exploration. The paper does not describe full feedback retraining, but the analysis workflow is human-in-the-loop in the sense that users refine the effective result set through interactive filtering and biological judgment.
Quantitative evaluation is performed on Mouse-Embryo, Zebrafish-Embryo, Schiebinger2019, CiteSeer, and CoraFull, with edge-prediction accuracy averaged over five runs (Wang et al., 21 Jul 2025). On Mouse-Embryo, the reported accuracy is 7% for the full model, compared with 8% for GraphSAGE and 9% for standard GAT. On Zebrafish-Embryo, the reported value is 0% for the full model. On Schiebinger2019, CiteSeer, and CoraFull, the paper states that the model performs best or tied with best and is consistently better than standard GAT, GraphSAGE, and the ablation variants.
Two case studies illustrate how the system is used. In the Mouse embryonic development study, an expert selected brain cells as the core cell type because they persist across all developmental stages (Wang et al., 21 Jul 2025). After filtering out paths with frequency below 40, the expert identified a candidate path, denoted Path1, with the highest frequency, strong spatial overlap in contour projections, high edge similarity, and consistent developmental directions. Within that path, trajectory Path2 was chosen for functional analysis, and the Gene Function View showed enriched terms including neuronal apoptosis, given as GO:0000122, and cell proliferation control, given as GO:0042127. Other trajectories in the same path had few or no enriched GO terms, which the authors interpret as possibly representing earlier or less specialized phases.
In the mouse midbrain study, an expert investigated whether the progenitor cell type RGC branches into GABA NeuB and GlioB (Wang et al., 21 Jul 2025). RGC counts decrease from Day 14, while GABA NeuB and GlioB counts increase from Day 14 to Day 16. The Path Selection View showed predicted links from RGC to both targets, suggesting a branching pattern. In the Path Inspection View, the contour maps and fan arcs for GABA NeuB and GlioB were similar. Functional analysis of representative trajectories, Path3 and Path4, revealed enriched GO terms including cytoplasmic translation (GO:0002181) and ribosomal small subunit biogenesis (GO:0042274), which the authors associate with rapid neural proliferation.
The expert interview component involved eight experts from bioinformatics, microbiology, cell biology, and medical research (Wang et al., 21 Jul 2025). Reported feedback emphasized the alignment of the workflow with existing biological practice, the utility of combining gene expression, cell-cell links, and spatial dynamics, and the readability of the hierarchical tree and contour-based multi-row comparisons. Suggestions included integrating pseudotime-based direction estimation such as DTFLOW, allowing multiple core cell types, and providing direct displays of differential gene expression per path.
6. Position within prior work
The authors position TrajLens against two distinct lines of prior work (Wang et al., 21 Jul 2025). The first comprises trajectory inference tools such as Monocle, PAGA, DTFLOW, VIA, and VeloViz, which are characterized in the paper as focusing on within-sample pseudotime ordering in high-dimensional expression space. The second comprises visualization and multimodal analysis systems such as Seurat, Vitessce, Cellenium, Visinity, Polyphony, LineageD, and CellChat, which support clustering, marker analysis, multimodal integration, or interaction analysis, with some incorporating spatial context.
Within this comparison, TrajLens is presented as distinct in three main respects. First, it explicitly defines the problem of cross-sample developmental trajectories and paths in a global multi-sample graph. Second, it combines differential gene features embedded by BioLinkBERT with spatial-distribution features in a GAT+GCN fusion architecture for cross-sample edge prediction. Third, it integrates these predictions into a visual workflow centered on spatial continuity, developmental direction, path frequency, and GO-based functional interpretation (Wang et al., 21 Jul 2025).
A useful corrective to a common misunderstanding is that TrajLens is not simply a visualization layer on top of an existing trajectory tool. The paper’s central claim is the combination of a predictive model and a visual analytics system, with the latter designed to expose and refine the former’s outputs. Conversely, it is also not purely an automated predictor: the system depends on expert-driven selection of core cells, filtering of paths, inspection of sample-level trajectories, and functional validation. This suggests that its methodological identity lies in visual analytics rather than in standalone graph learning.
7. Limitations and future directions
The authors note several limitations (Wang et al., 21 Jul 2025). One is data availability: there are relatively few publicly available multi-sample scRNA-seq datasets with sufficient spatial and temporal coverage. Another concerns contour estimation. Because contours are derived with Gaussian KDE, they can extend beyond real sample boundaries in sparse regions, which may distort judgments of visual overlap. The authors therefore propose future overlay of raw scatter plots or better constrained KDE methods.
Scalability is another stated concern. The datasets used have relatively few developmental stages, so paths are usually four steps or shorter. Although model generalization was evaluated on larger datasets, the visual scalability of many longer paths remains dependent on scrolling and frequency sorting. The model also remains a black box: the paper reports good predictive performance, but does not provide explicit interpretability mechanisms for individual link decisions, and user edits do not currently feed back into retraining (Wang et al., 21 Jul 2025).
Additional proposed directions include integrating pseudotime ordering within node populations, supporting multiple core cell types simultaneously, and adding automatic differential expression analysis per path. More broadly, TrajLens suggests a research direction in which cross-sample trajectory analysis is treated as an overview of graph prediction, spatial summarization, and interactive biological reasoning rather than as a conventional within-sample pseudotime problem. A plausible implication is that future systems in this area will be judged not only by predictive accuracy on links, but also by how effectively they expose uncertainty, support cross-sample correspondence reasoning, and connect structural predictions to functional interpretation.