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 (numpy.ndarray or None (default: None)) – Initial cell states for the historical or future cell state prediction with numerical integration.
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.
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.
dims (scalar, list or None (default: `None’)) – The dimensions that will be selected for fate prediction.
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.
t_end (float (default None)) – 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 (string (default: both)) – The direction to predict the cell fate. One of the forward, backward or both string.
interpolation_num (int (default: 100)) – The number of uniformly interpolated time points.
average (str or bool (default: False) {‘origin’, ‘trajectory’}) – 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.
sampling (str (default: arc_length)) – 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 (function) – The true ODE function, useful when the data is generated through simulation. Replace VecFld arugment when this has been set.
inverse_transform (bool (default: False)) – Whether to inverse transform the low dimensional vector field prediction back to high dimensional space.
Qkey (str (default: 'PCs')) – The key of the PCA loading matrix in .uns.
scale (float (default: 1)) – The value that will be used to scale the predicted velocity value from the reconstructed vector field function.
cores (int (default: 1):) – 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
adata – AnnData object that is updated with the dictionary Fate (includes t and prediction keys) in uns attribute.
- Return type