scvelo.inference.get_n_neighbors

scvelo.inference.get_n_neighbors(adata, labeling_time_mask, obs_dist_argsort, n_nontrivial_counts, use_rep='X', sparse_op=False, n_jobs=None)

Get number of neighbors required to include n_nontrivial_counts counts per labeling time.

See [Weiler et al., 2024].

Parameters:
  • adata – AnnData object.

  • labeling_time_mask (Dict[float, ndarray]) – Dictionary with labeling times as keys and masks to subset to relevant observations as values.

  • obs_dist_argsort (Dict[float, ndarray]) – Dictionary with argsorted pairwise distances per labeling_time_point.

  • n_nontrivial_counts (int) – Number of non-trivial counts to consider for each labeling time point.

  • use_rep – Representation to use for identifying number of neighbors.

  • sparse_op (bool) – Boolean flag to run operations on sparse or dense matrix.

Return type:

Dict[str, DataFrame]

Returns:

  • Number of neighbors to use for each gene and cell. Returned as a dictionary with variable names as keys

  • and Pandas DataFrame of size (n_obs x n_labeling_times) as values.