cospar.pl.gene_expression_dynamics

cospar.pl.gene_expression_dynamics(adata, selected_fate, gene_name_list, traj_threshold=0.1, source='transition_map', invert_PseudoTime=False, mask=None, compute_new=True, gene_exp_percentile=99, n_neighbors=8, plot_raw_data=False, stat_smooth_method='loess', ggplot_font_size=11)

Plot gene trend along the inferred dynamic trajectory.

The results should be pre-computed from cospar.tl.progenitor() or cospar.tl.iterative_differentiation()

Using the states that belong to the trajectory, it computes the pseudo time for these states and shows expression dynamics of selected genes along this pseudo time.

Specifically, we first construct KNN graph, compute spectral embedding, and take the first component as the pseudo time. To create dynamics for a selected gene, we re-weight the expression of this gene at each cell by its probability belonging to the trajectory, and rescale the expression at selected percentile value. Finally, we fit a curve to the data points.

Parameters
adata : AnnData object

Assume to contain transition maps at adata.uns.

selected_fate : str, or list

targeted cluster of the trajectory, as consistent with adata.obs[‘state_info’] When it is a list, the listed clusters are combined into a single fate cluster.

gene_name_list : list

List of genes to plot on the dynamic trajectory.

traj_threshold : float, optional (default: 0.1), range: (0,1)

Relative threshold, used to thresholding the inferred dynamic trajecotry to select states.

invert_PseudoTime : bool, optional (default: False)

If true, invert the pseudotime: 1-pseuotime. This is useful when the direction of pseudo time does not agree with intuition.

mask : np.array, optional (default: None)

A boolean array for further selecting cell states.

compute_new : bool, optional (default: True)

If true, compute everyting from stratch (as we save computed pseudotime)

gene_exp_percentile : int, optional (default: 99)

Plot gene expression below this percentile.

n_neighbors : int, optional (default: 8)

Number of nearest neighbors for constructing KNN graph.

plot_raw_data : bool, optional (default: False)

Plot the raw gene expression values of each cell along the pseudotime.

stat_smooth_method : str, optional (default: ‘loess’)

Smooth method used in the ggplot. Current available choices are: ‘auto’ (Use loess if (n<1000), glm otherwise), ‘lm’ (Linear Model), ‘wls’ (Linear Model), ‘rlm’ (Robust Linear Model), ‘glm’ (Generalized linear Model), ‘gls’ (Generalized Least Squares), ‘lowess’ (Locally Weighted Regression (simple)), ‘loess’ (Locally Weighted Regression), ‘mavg’ (Moving Average), ‘gpr’ (Gaussian Process Regressor)}.