dynamo.tl.score_cells(adata, genes=None, layer=None, basis=None, n_neighbors=30, beta=0.1, iteration=5, metric='euclidean', metric_kwds=None, cores=1, seed=19491001, return_score=True, **kwargs)[source]

Score cells based on a set of genes.

  • adata (AnnData) – AnnData object that contains the reconstructed vector field function in the uns attribute.

  • genes (list or None (default: None)) – The gene names whose gene expression will be used for predicting cell fate. By default (when genes is set to None), the genes used for velocity embedding (var.use_for_transition) will be used for vector field reconstruction. Note that the genes to be used need to have velocity calculated and corresponds to those used in the dyn.tl.VectorField function.

  • layer (str or None (default: ‘X’)) – Which layer of the data will be used for predicting cell fate with the reconstructed vector field function. The layer once provided, will override the basis argument and then predicting cell fate in high dimensional space.

  • basis (str or None (default: None)) – The embedding data to use for predicting cell fate. If basis is either umap or pca, the reconstructed trajectory will be projected back to high dimensional space via the inverse_transform function.

  • n_neighbors (int (default: 30)) – Number of nearest neighbors.

  • beta (float (default: 0.1)) – The weight that will apply to the current query cell.

  • iteration (int (default: 0.5)) – Number of smooth iterations.

  • metric (str or callable, default=’euclidean’) – The distance metric to use for the tree. The default metric is , and with p=2 is equivalent to the standard Euclidean metric. See the documentation of DistanceMetric for a list of available metrics. If metric is “precomputed”, X is assumed to be a distance matrix and must be square during fit. X may be a sparse graph, in which case only “nonzero” elements may be considered neighbors.

  • metric_kwds (dict, default=None) – Additional keyword arguments for the metric function.

  • cores (int (default: 1)) – The number of parallel jobs to run for neighbors search. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.

  • seed (int (default 19491001)) – Random seed to ensure the reproducibility of each run.

  • return_score (bool (default: False)) – Whether to return the score. If False, save the smoothed score to cell_scores column in the .obs attribute and also to the dictionary corresponding to the score_cells key in the .uns attribute.

  • kwargs – Additional arguments that will be passed to each nearest neighbor search algorithm.


Depending on return_score, it either return the cell scores or an updated adata object that contains the cell score information.