spateo.tdr.morphometrics.morphofield.trajectory¶
Functions¶
|
Prediction of cell developmental trajectory based on reconstructed vector field. |
Module Contents¶
- spateo.tdr.morphometrics.morphofield.trajectory.morphopath(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'fate_morpho', layer: str = 'X', direction: str = 'forward', interpolation_num: int = 250, t_end: int | float | None = None, average: bool = False, cores: int = 1, nonrigid_only: bool = False, inplace: bool = True, **kwargs) anndata.AnnData | None [source]¶
Prediction of cell developmental trajectory based on reconstructed vector field.
- Parameters:
- adata
AnnData object that contains the reconstructed vector field function in the
.uns
attribute.- vf_key
The key in
.uns
that corresponds to the reconstructed vector field.- key_added
The key under which to add the dictionary Fate (includes
t
andprediction
keys).- layer
Which layer of the data will be used for predicting cell fate with the reconstructed vector field function.
- direction
The direction to predict the cell fate. One of the
forward
,backward
orboth
string.- interpolation_num
The number of uniformly interpolated time points.
- t_end
The length of the time period from which to predict cell state forward or backward over time.
- average
The method to calculate the average cell state at each time step, can be one of
origin
ortrajectory
. Iforigin
used, the average expression state from the init_cells will be calculated and the fate prediction is based on this state. Iftrajectory
used, the average expression states of all cells predicted from the vector field function at each time point will be used. Ifaverage
isFalse
, no averaging will be applied.- cores
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.
- nonrigid_only
If True, only the nonrigid part of the vector field will be calculated.
- inplace
Whether to copy adata or modify it inplace.
- **kwargs
Additional parameters that will be passed into the
fate
function.
- Returns:
An
AnnData
object is updated/copied with thekey_added
dictionary in the.uns
attribute.The
key_added
dictionary which contains:t: The time at which the cell state are predicted. prediction: Predicted cells states at different time points. Row order corresponds to the element order in
t. If init_states corresponds to multiple cells, the expression dynamics over time for each cell is concatenated by rows. That is, the final dimension of prediction is (len(t) * n_cells, n_features). n_cells: number of cells; n_features: number of genes or number of low dimensional embeddings. Of note, if the average is set to be True, the average cell state at each time point is calculated for all cells.