reverse_trajectory: Reverse a trajectory

Description Usage Arguments Value See Also Examples

View source: R/trajectory_inference.R

Description

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

Usage

1
reverse_trajectory(trajectory)

Arguments

trajectory

A trajectory as returned by infer_trajectory.

Value

The same trajectory, but in the other direction.

See Also

infer_trajectory

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Generate an example dataset and infer a trajectory through it
dataset <- generate_dataset(num_genes = 500, num_samples = 1000, 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")

SCORPIUS documentation built on Aug. 7, 2019, 5:02 p.m.