Plotting a toy datasets using dynplot

library(dplyr)
library(dynplot)
library(dynutils)
library(dynwrap)

set.seed(3)

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)

If the topology is a tree

plot_dendro(trajectory)

If the topology is more complex

plot_graph(trajectory)
plot_topology(trajectory, layout = "circle")
plot_dimred(trajectory)
plot_dimred(trajectory, color_trajectory = "nearest")

Plotting a grouping or clustering

grouping <- trajectory$prior_information$groups_id
plot_onedim(trajectory, grouping = grouping)
plot_dendro(trajectory, grouping = grouping)
plot_graph(trajectory, grouping = grouping)
plot_dimred(trajectory, grouping = grouping)

Plotting expression of one feature

feature_oi <- first(colnames(trajectory$counts))
plot_onedim(trajectory, feature_oi = feature_oi)
plot_dendro(trajectory, feature_oi = feature_oi)
plot_graph(trajectory, feature_oi = feature_oi)
plot_dimred(trajectory, feature_oi = feature_oi)

Plotting expression of a lot of features

plot_heatmap(trajectory)

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)


Try the dynplot package in your browser

Any scripts or data that you put into this service are public.

dynplot documentation built on Dec. 11, 2021, 9:33 a.m.