regvelo.plotting.simulated_visit_diff

regvelo.plotting.simulated_visit_diff(adata, adata_perturb, terminal_states, total_simulations, basis=None, **kwargs)[source]

Assign and visualize smoothed absolute differences in visit counts between control and perturbation simulations.

Parameters:
  • adata (AnnData) – Annotated data object of the control condition.

  • adata_perturb (AnnData) – Annotated data object of the perturbed condition.

  • terminal_states (list[str]) – List of terminal state labels.

  • total_simulations (int) – Total number of simulations performed.

  • basis (Optional[str]) – Optional embedding basis. If given, temporarily overrides UMAP coordinates.

  • **kwargs (Any) –

    Optional keyword arguments:

    • key : Name of the observation key in obs containing visit counts (default: "visits").

    • embedding : Key in obsm for the embedding (default: "X_pca").

    • title : Title for the plot (default: "Density difference").

    • figsize : Size of the output plot (default: (4, 3.5)).

    • n_neighbors : Number of neighbors for smoothing (default: 10).

    • color_map : Colormap used for plotting (default: "vlag").

Return type:

None

Returns:

: Nothing, just plots the figure. Also updates adata with the following fields:

  • adata.obs[f"{key}_diff"]: Absolute difference in visit counts, scaled, and passed through sigmoid function.

  • adata.obs[f"{key}_diff_smooth"]: Smoothed version of the above for plotting.