Data Utilities#
The Data Utilities module provides the foundational data structures and mathematical solvers required to construct continuous training trajectories. It handles the complex task of linking discrete cells across adjacent 2D slices using Unbalanced Optimal Transport (UOT).
PyTorch Dataset#
The core dataset class. It automatically computes cross-slice pairings and formats spatial coordinates, sparse gene expression matrices, and cell-type annotations into optimized PyTorch tensors for Flow Matching.
DeepSpatial Global Trajectory Dataset. |
Optimal Transport Solvers#
The mathematical engine for aligning disjointed spatial slices. It calculates a hybrid cost matrix that heavily penalizes class mismatches while balancing spatial Euclidean distances and gene expression cosine similarities, ultimately solving the entropy-regularized Unbalanced Sinkhorn distance.
Computes the Unbalanced Optimal Transport (UOT) coupling matrix between two slices. |
|
Computes a hybrid cost matrix balancing spatial distance, gene expression, and cell types. |