dynamo.pd.fate
- dynamo.pd.fate(adata, init_cells, init_states=None, basis=None, layer='X', dims=None, genes=None, t_end=None, direction='both', interpolation_num=250, average=False, sampling='arc_length', VecFld_true=None, inverse_transform=False, Qkey='PCs', scale=1, cores=1, **kwargs)[source]
Predict the historical and future cell transcriptomic states over arbitrary time scales.
This is achieved by integrating the reconstructed vector field function from one or a set of initial cell state(s). Note that this function is designed so that there is only one trajectory (based on averaged cell states if multiple initial states are provided) will be returned. dyn.tl._fate can be used to calculate multiple cell states.
- Parameters:
adata (
AnnData
) – AnnData object that contains the reconstructed vector field function in the uns attribute.init_cells (
list
) – Cell name or indices of the initial cell states for the historical or future cell state prediction with numerical integration. If the names in init_cells not found in the adata.obs_name, it will be treated as cell indices and must be integers.init_states (
Optional
[ndarray
]) – Initial cell states for the historical or future cell state prediction with numerical integration.basis (
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.layer (
str
) – 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.dims (
Union
[int
,List
[int
],Tuple
[int
],ndarray
,None
]) – The dimensions that will be selected for fate prediction.genes (
Optional
[List
]) – 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.t_end (
Optional
[float
]) – The length of the time period from which to predict cell state forward or backward over time. This is used by the odeint function.direction (
str
) – The direction to predict the cell fate. One of the forward, backward or both string.interpolation_num (
int
) – The number of uniformly interpolated time points.average (
bool
) – The method to calculate the average cell state at each time step, can be one of origin or trajectory. If origin used, the average expression state from the init_cells will be calculated and the fate prediction is based on this state. If trajectory used, the average expression states of all cells predicted from the vector field function at each time point will be used. If average is False, no averaging will be applied. If average is True, origin will be used.sampling (
str
) – Methods to sample points along the integration path, one of {‘arc_length’, ‘logspace’, ‘uniform_indices’}. If logspace, we will sample time points linearly on log space. If uniform_indices, the sorted unique set of all time points from all cell states’ fate prediction will be used and then evenly sampled up to interpolation_num time points. If arc_length, we will sample the integration path with uniform arc length.VecFld_true (
Optional
[Callable
]) – The true ODE function, useful when the data is generated through simulation. Replace VecFld argument when this has been set.inverse_transform (
bool
) – Whether to inverse transform the low dimensional vector field prediction back to high dimensional space.Qkey (
str
) – The key of the PCA loading matrix in .uns.scale (
float
) – The value that will be used to scale the predicted velocity value from the reconstructed vector field function.cores (
int
) – Number of cores to calculate path integral for predicting cell fate. If cores is set to be > 1, multiprocessing will be used to parallel the fate prediction.kwargs (
dict
) – Additional parameters that will be passed into the fate function.
- Returns:
- AnnData object that is updated with the dictionary Fate (includes t and prediction keys) in uns
attribute.
- Return type:
adata