dynamo.pl.kinetic_curves

dynamo.pl.kinetic_curves(adata, genes, mode='vector_field', basis=None, layer='X', project_back_to_high_dim=True, tkey='potential', dist_threshold=1e-10, ncol=4, color='ntr', c_palette='Set2', standard_scale=0, traj_ind=0, log=True, save_show_or_return='show', save_kwargs={})[source]

Plot the gene expression dynamics over time (pseudotime or inferred real time) as kinetic curves.

Note that by default potential estimated with the diffusion graph built from reconstructed vector field will be used as the measure of pseudotime.

Parameters:
  • adata (AnnData) – an Annodata object.

  • genes (List[str]) – the gene names whose gene expression will be faceted.

  • mode (str) – which data mode will be used, either vector_field, lap or pseudotime. if mode is vector_field, the trajectory predicted by vector field function will be used; if mode is lap, the trajectory predicted by least action path will be used otherwise pseudotime trajectory (defined by time argument) will be used. Defaults to “vector_field”.

  • basis (Optional[str]) – the embedding data used for drawing the kinetic gene expression curves, only used when mode is vector_field. Defaults to None.

  • layer (str) – the key to the layer of expression value will be used. Not used if mode is vector_field. Defaults to “X”.

  • project_back_to_high_dim (bool) – whether to map the coordinates in low dimension back to high dimension to visualize the gene expression curves, only used when mode is vector_field and basis is not X. Currently only works when basis is ‘pca’ and ‘umap’. Defaults to True.

  • tkey (str) – the .obs column that will be used for timing each cell, only used when mode is not vector_field. Defaults to “potential”.

  • dist_threshold (float) – the threshold for the distance between two points in the gene expression state, i.e, x(t), x(t+1). If below this threshold, we assume steady state is achieved and those data points will not be considered. This argument is ignored when mode is pseudotime. Defaults to 1e-10.

  • ncol (int) – the number of columns in each facet grid. Defaults to 4.

  • color (Optional[list]) – any column names or gene expression, etc. that will be used for coloring cells. Defaults to “ntr”.

  • c_palette (str) – the color map function to use. Defaults to “Set2”.

  • standard_scale (int) – either 0 (rows) or 1 (columns). Whether to standardize that dimension, meaning for each row or column, subtract the minimum and divide each by its maximum. Defaults to 0.

  • traj_ind (int) – if the element from the dictionary is a list (obtained from a list of trajectories), the index of trajectory that will be selected for visualization. Defaults to 0.

  • log (bool) – whether to log1p transform your data before data visualization. If expression data is from adata object, it is generally already log1p transformed. When the data is from predicted either from traj simulation or LAP, the data is generally in the original gene expression space and needs to be log1p transformed. Note: when predicted data is not inverse transformed back to original expression space, no transformation will be applied. Defaults to True.

  • save_show_or_return (str) – whether to save, show, or return the generated figure. Defaults to “show”.

  • save_kwargs (dict) – a dictionary that will be passed to the save_show_ret function. By default, it is an empty dictionary and the save_show_ret function will use the {“path”: None, “prefix”: ‘kinetic_curves’, “dpi”: None, “ext”: ‘pdf’, “transparent”: True, “close”: True, “verbose”: True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. Defaults to {}.

Raises:

ValueError – invalid genes.

Return type:

Optional[FacetGrid]

Returns:

None would be returned by default. If save_show_or_return is set to be ‘return’, the generated seaborn.FacetGrid would be returned.