Learn R Programming

SCORPIUS (version 1.0.9)

reverse_trajectory: Reverse a trajectory

Description

Since the direction of the trajectory is not specified, the ordering of a trajectory may be inverted using reverse_trajectory.

Usage

reverse_trajectory(trajectory)

Value

The same trajectory, but in the other direction.

Arguments

trajectory

A trajectory as returned by infer_trajectory.

See Also

infer_trajectory

Examples

Run this code
## Generate an example dataset and infer a trajectory through it
dataset <- generate_dataset(num_genes = 200, num_samples = 400, num_groups = 4)
group_name <- dataset$sample_info$group_name
space <- reduce_dimensionality(dataset$expression, ndim = 2)
traj <- infer_trajectory(space)

## Visualise the trajectory
draw_trajectory_plot(space, group_name, path = traj$path)

## Reverse the trajectory
reverse_traj <- reverse_trajectory(traj)
draw_trajectory_plot(space, group_name, path = reverse_traj$path)

plot(traj$time, reverse_traj$time, type = "l")

Run the code above in your browser using DataLab