pseudodynamics.functions.eval_funs.project_params_to_pseudotime¶
- pseudodynamics.functions.eval_funs.project_params_to_pseudotime(adata, params, param_names='g v2', timepoints=None, pseudotime_key='pseudotime_scaled', nbins=100, return_y=True)[source]¶
Project the parameters to the pseudotime and aggregate them by bins
- Parameters:
adata (AnnData object, the adata with pseudotime and obs)
params (list of np.ndarray, each array is the parameters for one timepoint)
param_names (str, the names of the parameters, e.g. 'g v2')
timepoints (list of int, the timepoints for the parameters, if None, use the timepoints in adata.uns['pop']['t'])
pseudotime_key (str, the key of the pseudotime in adata.obs, default 'pseudotime_scaled')
nbins (int, the number of bins to aggregate the pseudotime, default 100)
return_y (bool, if True, return the smoothed y values, otherwise return the figure and axes)
Return:¶
- :
fig, axs : matplotlib figure and axes, the figure with the aggregated parameters
if return_y : y_smooths
Example
>>> nbins =30 >>> y = pdp.tl.project_params_to_pseudotime(adata, params = adata.obs["vnorm_v1"].values.reshape(1,-1), param_names = 'v_v1', timepoints = adata.uns['pop']['t'][[0]], pseudotime_key = 'pseudotime_scaled', nbins = nbins+1, return_y = True)