Least action path¶
- spaTrack.VectorField(adata: AnnData, basis: Union[None, str] = None, normalize: bool = False, result_key: Union[None, str] = None, **kwargs)[source]¶
Learn the function of vector filed.
- Parameters:
adata – An
AnnDataobject.basis – The label of cell coordinates, for example, umap or spatial. (Default: None)
normalize – Logic flag to determine whether to normalize the data to have zero means and unit covariance. (Default: False)
- Returns:
A vector field class object.
- Return type:
BaseVectorfield
- spaTrack.least_action(adata: AnnData, init_cells: Union[str, list], target_cells: Union[str, list], basis: str = 'umap', vf_key: str = 'VecFld', vecfld: Union[None, Callable] = None, adj_key: str = 'pearson_transition_matrix', n_points: int = 25, n_neighbors: int = 100, **kwargs)[source]¶
Calculate the optimal paths between any two cell states.
- Parameters:
adata – An
AnnDataobject.init_cells – Cell name or indices of the initial cell states.
target_cells – Cell name or indices of the terminal cell states.
basis – The embedding data used to predict the least action path. (Default: “umap”)
vf_key – A key to the vector field functions in adata.uns. (Default: “VecFld”)
vecfld – The vector field function. (Default: None)
adj_key – The key to the adjacency matrix in adata.obsp. (Default: “pearson_transition_matrix”)
n_points – The number of points on the least action path. (Default: 25)
n_neighbors – The number of neighbors. (Default: 100)
- Returns:
A trajectory class containing the least action paths information.
- Return type:
LeastActionPath
- spaTrack.map_cell_to_LAP(adata, basis='spatial', cell_neighbors=150)[source]¶
Assign a new pseudotime value to each of these cells based on their position along the LAP.
- spaTrack.plot_least_action_path(adata, basis='spatial', ax=None, linewidth=3, point_size=6, linestyle='solid')[source]¶
Plot the LAP and selected subset of cells.
- Parameters:
adata – An
AnnDataobject.basis – The embedding data used to predict the least action path. (Default: ‘spatial’)
ax – Figure axes. (Default: None)
linewidth – Linewidth of the LAP. (Default: 3)
point_size – Point size of the LAP. (Default: 6)
linestyle – Linestyple of the LAP. (Default: ‘solid’)
- Returns:
The plot of the LAP and cells.
- Return type:
ax