cellrank.tl.kernels.CytoTRACEKernel.compute_transition_matrix

CytoTRACEKernel.compute_transition_matrix(threshold_scheme='hard', frac_to_keep=0.3, b=10.0, nu=0.5, check_irreducibility=False, n_jobs=None, backend='loky', show_progress_bar=True, **kwargs)

Compute transition matrix based on KNN graph and pseudotemporal ordering.

Depending on the choice of the thresholding_scheme, this is based on ideas by either Palantir [Setty et al., 2019] or VIA [Stassen et al., 2021].

Parameters
  • threshold_scheme (Union[Literal[‘soft’, ‘hard’], Callable]) –

    Which method to use when biasing the graph. Valid options are:

    • ’hard’ - based on Palantir [Setty et al., 2019] which removes some edges that point against the direction of increasing pseudotime. To avoid disconnecting the graph, it does not remove all edges that point against the direction of increasing pseudotime, but keeps the ones that point to cells inside a close radius. This radius is chosen according to the local cell density.

    • ’soft’ - based on VIA [Stassen et al., 2021] which downweights edges that points against the direction of increasing pseudotime. Essentially, the further “behind” a query cell is in pseudotime with respect to the current reference cell, the more penalized will be its graph-connectivity.

    • callable - any function conforming to the signature of cellrank.tl.kernels.ThresholdSchemeABC.__call__().

  • frac_to_keep (float) – The frac_to_keep * number of the closest neighbors (according to graph connectivities) are kept, no matter whether they lie in the pseudotemporal past or future. This is done to ensure that the graph remains connected. Only used when threshold_scheme = 'hard'. Needs to fall within the interval [0, 1].

  • b (float) – The growth rate of generalized logistic function. Only used when threshold_scheme = 'soft'.

  • nu (float) – Affects near which asymptote maximum growth occurs. Only used when threshold_scheme = 'soft'.

  • check_irreducibility (bool) – Optional check for irreducibility of the final transition matrix.

  • show_progress_bar (bool) – Whether to show a progress bar. Disabling it may slightly improve performance.

  • n_jobs (Optional[int]) – Number of parallel jobs. If -1, use all available cores. If None or 1, the execution is sequential.

  • backend (Literal[‘loky’, ‘multiprocessing’, ‘threading’]) – Which backend to use for parallelization. See joblib.Parallel for valid options.

  • kwargs (Any) – Keyword arguments for threshold_scheme.

Return type

PseudotimeKernel

Returns

Self and updated transition_matrix.