dynamo.tl.cell_wise_confidence(adata, X_data=None, V_data=None, ekey='M_s', vkey='velocity_S', neighbors_from_basis=False, method='jaccard')[source]

Calculate the cell-wise velocity confidence metric.

  • adata (AnnData) – an AnnData object.

  • X_data (Union[ndarray, csr_matrix, None]) – the expression states of single cells (or expression states in reduced dimension, like pca, of single cells). Defaults to None.

  • V_data (Union[ndarray, csr_matrix, None]) – the RNA velocity of single cells (or velocity estimates projected to reduced dimension, like pca, of single cells). Note that X, V_mat need to have the exact dimensionalities. Defaults to None.

  • ekey (str) – the dictionary key that corresponds to the gene expression in the layer attribute. By default, it is the smoothed expression M_s. Defaults to “M_s”.

  • vkey (str) – the dictionary key that corresponds to the estimated velocity values in layers attribute. Defaults to “velocity_S”.

  • neighbors_from_basis (bool) – whether to construct nearest neighbors from low dimensional space as defined by the basis, instead of using that calculated during UMAP process. Defaults to False.

  • method (Literal['cosine', 'consensus', 'correlation', 'jaccard', 'hybrid', 'divergence']) – which method will be used for calculating the cell wise velocity confidence metric. Defaults to “jaccard”, which measures how well each velocity vector meets the geometric constraints defined by the local neighborhood structure. Jaccard index is calculated as the fraction of the number of the intersected set of nearest neighbors from each cell at current expression state (X) and that from the future expression state (X + V) over the number of the union of these two sets. The cosine or correlation method is similar to that used by scVelo (https://github.com/theislab/scvelo).


NotImplementedErrormethod is invalid.

Return type:



An updated AnnData object with .obs.confidence as the cell-wise velocity confidence.