regvelo.tools.markov_density_simulation¶
- regvelo.tools.markov_density_simulation(adata, T, start_indices, terminal_indices, terminal_states, n_steps=100, n_simulations=1000, method='stepwise', seed=0)[source]¶
Simulate transitions on a velocity-derived Markov transition matrix.
- Parameters:
adata (
AnnData) – Annotated data object.T (
ndarray) – Transition matrix of shape(n_cells, n_cells).terminal_states (
list[str]) – Labels of terminal states corresponding to cells inadata.obs["term_states_fwd"].n_steps (
int) – Maximum number of steps per simulation.n_simulations (
int) – Number of simulations per starting cell.method (
Literal['stepwise','one-step']) –Simulation method:
'stepwise': simulate trajectories step by step.'one-step': sample directly fromT^n.
seed (
int) – Random seed for reproducibility.
- Return type:
- Returns:
: Total number of simulations performed. Also updates
adatawith the following fields:adata.obs["visits"]: Number of visits to each terminal cell.adata.obs["visits_dens"]: Density of visits to each terminal cell, calculated as the proportion of visits relative to the total number of simulations.