Description Usage Arguments Value See Also Examples
View source: R/trajectory_inference.R
infer_trajectory
infers a trajectory through samples in a given space in a fourstep process:
Perform kmeans clustering
Calculate distance matrix between cluster centers using a custom distance function
Find the shortest path connecting all cluster centers using the custom distance matrix
Iteratively fit a curve to the given data using principal curves
1 2  infer_trajectory(space, k = 4, thresh = 0.001, maxit = 10,
stretch = 0, smoother = "smooth_spline", approx_points = 100)

space 
A numeric matrix or a data frame containing the coordinates of samples. 
k 
The number of clusters to cluster the data into. 
thresh 
convergence threshold on shortest distances to the curve. 
maxit 
maximum number of iterations. 
stretch 
A stretch factor for the endpoints of the curve, allowing the curve to grow to avoid bunching at the end. Must be a numeric value between 0 and 2. 
smoother 
choice of smoother. The default is

approx_points 
Approximate curve after smoothing to reduce computational time.
If 
A list containing several objects:
path
: the trajectory obtained by principal curves.
time
: the time point of each sample along the inferred trajectory.
reduce_dimensionality
, draw_trajectory_plot
1 2 3 4 5 6 7 8 9 10  ## Generate an example dataset and visualise it
dataset < generate_dataset(num_genes = 500, num_samples = 1000, num_groups = 4)
space < reduce_dimensionality(dataset$expression, ndim = 2)
draw_trajectory_plot(space, progression_group = dataset$sample_info$group_name)
## Infer a trajectory through this space
traj < infer_trajectory(space)
## Visualise the trajectory
draw_trajectory_plot(space, path=traj$path, progression_group = dataset$sample_info$group_name)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.