infer_initial_trajectory: Infer an initial trajectory through space

Description Usage Arguments Value Examples

View source: R/trajectory_inference.R

Description

infer_initial_trajectory infers an initial trajectory for infer_trajectory by clustering the points and calculating the shortest path through cluster centers. The shortest path takes into account the euclidean distance between cluster centers, and the density between those two points.

Usage

1

Arguments

space

A numeric matrix or a data frame containing the coordinates of samples.

k

The number of clusters to cluster the data into.

Value

the initial trajectory obtained by this method

Examples

 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
init_traj <- infer_initial_trajectory(space, k = 4)

## Visualise the trajectory
draw_trajectory_plot(space, path = init_traj, progression_group = dataset$sample_info$group_name)

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