velocyto.diffusion module¶
-
class
velocyto.diffusion.
Diffusion
[source]¶ Bases:
object
-
compute_transition_matrix2
(x0: numpy.ndarray, v: numpy.ndarray, sigma: float = 0.0, reverse: bool = False) → scipy.sparse.csr.csr_matrix[source]¶ Compute a right-stochastic matrix representing transition probabilities from each node
Parameters: - Embedding positions (x0) –
- Velocities on the embedding (n_cells, n_dims (v) –
- The kernel size (sigma) –
- Compute the reverse transition matrix (reverse) –
- Remarks:
- Computes a Markov transition matrix for the KNN graph. The probability of transition along an edge is proportional to the scalar projection of the velocity vector onto that edge, times the reciprocal of the edge length. Edges that get negative scalar projections are clipped to zero and the total non-zero outgoing edges are normalized to a sum of 1.0.
-
compute_transition_matrix
(knn: scipy.sparse.coo.coo_matrix, x: numpy.ndarray, v: numpy.ndarray, epsilon: float = 0.0, reverse: bool = False) → scipy.sparse.csr.csr_matrix[source]¶ Compute a right-stochastic matrix representing transition probabilities from each node
Parameters: - KNN graph (knn) –
- Embedding positions (x) –
- Velocities on the embedding (v) –
- Compute the reverse transition matrix (reverse) –
- Remarks:
- Computes a Markov transition matrix for the KNN graph. The probability of transition along an edge is proportional to the scalar projection of the velocity vector onto that edge, times the reciprocal of the edge length. Edges that get negative scalar projections are clipped to zero and the total non-zero outgoing edges are normalized to a sum of 1.0.
-