In [1]:

```
import wot
```

In Notebook 2 we saw how to compute transport matrices $\pi_{t_i,t_{i+1}}$ connecting adjacent time-points $(t_i,t_{i+1})$. Over short time-scales, this OT matrix is a good approximation to the true temporal coupling:

$$ \pi_{t_i,t_{i+1}} \approx \gamma_{t_i,t_{i+1}}. $$In this notebook we show how to infer transitions over a longer time interval $(t_i,t_j)$. To do this, we assume the developmental stochastic process ${\mathbb{P}}_t$ is Markov. This means that the couplings $\gamma_{s,t}$ satisfy the following algebraic relationship:

$$ \gamma_{t_1,t_3}(x,z) = \iint \gamma_{t_1,t_2}(x,y) \gamma_{t_2,t_3}(y,z) dy$$for any $t_1 < t_2 < t_3$. The integral on the right hand side becomes a finite sum when we have a finite sample of cells. In fact, it's a matrix multiplication!

Therefore we can infer long-range transitions by composing transport maps as follows:

$$\gamma_{t_i,t_j} = \gamma_{t_i,t_{i+1}} \circ \gamma_{t_{i+1},t_{i+2}} \circ \cdots \circ \gamma_{t_{j-1},t_{j}} \approx \pi_{t_i,t_{i+1}} \circ \pi_{t_{i+1},t_{i+2}} \circ \cdots \circ \pi_{t_{j-1},t_{j}}.$$Here $\circ$ denotes matrix multiplication. This is of course different than directly computing OT over longer time-intervals:

$$ \pi_{t_1,t_2} \circ \pi_{t_2,t_3} \ne \pi_{t_1,t_3}.$$In the following code block we construct a TransportMapModel from a directory of pre-computed transport matrices.

In [2]:

```
tmap_model = wot.tmap.TransportMapModel.from_directory('tmaps/serum')
```

We can now easily compute the coupling between any pair of time-points as follows:

In [3]:

```
gamma_8_10 = tmap_model.get_coupling(8, 10)
gamma_8_10
```

Out[3]:

AnnData object with n_obs × n_vars = 3815 × 2051 obs: 'g0', 'g1', 'g2', 'g3'