cellrank.pl.log_odds(adata, lineage_1, lineage_2=None, time_key='exp_time', backward=False, keys=None, threshold=None, threshold_color='red', layer=None, use_raw=False, size=2.0, cmap='viridis', alpha=0.8, ncols=None, fontsize=None, xticks_step_size=1, legend_loc='best', jitter=True, seed=None, figsize=None, dpi=None, save=None, show=True, **kwargs)[source]

Plot log-odds ratio between trajectories.

This plotting function is geared towards time-series datasets that have been analyzed using the RealTimeKernel. It visualizes log-odd ratios between different trajectories per cell, with the option to color in certain molecular features, like genes. This can be useful to detect and visualize fate-decisive genes.

  • adata (AnnData) – Annotated data object.

  • lineage_1 (str) – The first lineage for which to compute the log-odds.

  • lineage_2 (Optional[str]) – The second lineage for which to compute the log-odds. If None, use the rest of the lineages.

  • time_key (str) – Key in obs containing the experimental time.

  • backward (bool) – Direction of the process.

  • keys (Union[str, Sequence[str], None]) – Key in obs or var_names.

  • threshold (Union[float, Sequence, None]) – Visualize whether total expression per cell is greater than threshold. If a Sequence, it should be the same length as keys.

  • threshold_color (str) – Color to use when plotting thresholded expression values.

  • layer (Optional[str]) – Which layer to use to get expression values. If None or 'X', use X.

  • use_raw (bool) – Whether to access raw. If True, layer is ignored.

  • size (float) – Size of the dots.

  • cmap (str) – Colormap to use for continuous variables in keys.

  • alpha (Optional[float]) – Alpha values for the dots.

  • ncols (Optional[int]) – Number of columns.

  • fontsize (Union[float, str, None]) – Size of the font for the title, x- and y-label.

  • xticks_step_size (Optional[int]) – Show only every other n-th tick on the x-axis. If None, don’t show any ticks.

  • legend_loc (Optional[str]) – Position of the legend. If None, do not show the legend.

  • jitter (Union[bool, float]) – Amount of jitter to apply along x-axis.

  • seed (Optional[int]) – Seed for jitter to ensure reproducibility.

  • figsize (Optional[Tuple[float, float]]) – Size of the figure.

  • dpi (Optional[int]) – Dots per inch.

  • save (Union[Path, str, None]) – Filename where to save the plot.

  • show (bool) – If False, return Axes or a sequence of them.

  • kwargs (Any) – Keyword arguments for stripplot().

Return type:

Union[Axes, Sequence[Axes], None]


: Nothing, just plots the figure. Optionally saves it based on save. If show = False, returns the axes object.