Plotting a toy datasets using dynplot

2021-06-27

Load in a toy dataset

data(example_bifurcating)
trajectory <- example_bifurcating

Plotting the topology and cellular positions

If the topology is very simple (or should be represented in one dimension)

plot_onedim(trajectory)
## Coloring by milestone
## Using milestone_percentages from trajectory
## Loading required namespace: RColorBrewer

If the topology is a tree

plot_dendro(trajectory)
## Coloring by milestone
## Using milestone_percentages from trajectory

If the topology is more complex

plot_graph(trajectory)
## Coloring by milestone
## Using milestone_percentages from trajectory

plot_topology(trajectory, layout = "circle")

plot_dimred(trajectory)
## Coloring by milestone
## Using milestone_percentages from trajectory

plot_dimred(trajectory, color_trajectory = "nearest")
## Coloring by milestone
## Using milestone_percentages from trajectory

Plotting a grouping or clustering

grouping <- trajectory$prior_information$groups_id
plot_onedim(trajectory, grouping = grouping)
## Coloring by grouping

plot_dendro(trajectory, grouping = grouping)
## Coloring by grouping

plot_graph(trajectory, grouping = grouping)
## Coloring by grouping

plot_dimred(trajectory, grouping = grouping)
## Coloring by grouping

Plotting expression of one feature

feature_oi <- first(colnames(trajectory$counts))
plot_onedim(trajectory, feature_oi = feature_oi)
## Coloring by expression

plot_dendro(trajectory, feature_oi = feature_oi)
## Coloring by expression

plot_graph(trajectory, feature_oi = feature_oi)
## Coloring by expression

plot_dimred(trajectory, feature_oi = feature_oi)
## Coloring by expression

Plotting expression of a lot of features

plot_heatmap(trajectory)
## No features of interest provided, selecting the top 20 features automatically
## Using dynfeature for selecting the top 20 features
## Coloring by milestone

Comparing trajectories

pseudotime <- trajectory$counts %>% prcomp() %>% {.$x[, 1]}
prediction <- 
  dynwrap::wrap_data(id = "dummy_prediction", cell_ids = trajectory$cell_ids) %>%
  dynwrap::add_linear_trajectory(pseudotime)

plot_linearised_comparison(trajectory, prediction)
## root cell or milestone not provided, trying first outgoing milestone_id
## Using 'milestone_begin' as root
## Coloring by milestone
## Using milestone_percentages from trajectory
## root cell or milestone not provided, trying first outgoing milestone_id
## Using 'milestone_begin' as root
## Coloring by milestone
## Using milestone_percentages from trajectory