Animating the Cell Cycle
Dec 28, 2020
Introduction
There are many ways to visualize the same data. In Xia*, Fan*,Emanuel* et al (2019), we used transcriptome-scale MERFISH along with RNA velocity in situ analysis to identify genes associated with the cell cycle. For more details on the analysis, please refer to the original manuscript or check out RNA Velocity Analysis (In Situ) - Tutorials and Tips.
Static visualizations
To visualize these identified cell cycle genes, we used a variety of different static visualizations, including those similar to the ones below. These tSNE plots visualize cells as points and are colored by scaled gene expression magnitude of select identified cell cycle genes.
m <- mat[genes.final,]
m <- t(scale(t(m)))
m[m > 2] <- 2
m[m < -2] <- -2
library(ggplot2)
ps <- lapply(seq_along(genes.final), function(i) {
gexp <- m[genes.final[i], rownames(emb.test)]
df <- data.frame(emb.test, gexp)
p <- ggplot(df, aes(x = X1, y = X2, col=gexp)) + geom_point()
p <- p + theme_void() +
theme(legend.position = "none") +
scale_color_distiller(palette = 'RdBu',
limits = c(-2,2)) +
labs(title = genes.final[i])
p
})
library(gridExtra)
grid.arrange(
grobs = ps,
nrow=4, ncol=4
)
In the original manuscript, we also used heatmaps to visualize the pseudotemporal ordering of cells versus the peak expression of identified cell cycle genes and scatterplots of the pseudotemporal ordering of cells versus gene expression magnitude to visualize the shifting peak expression of cell cycle genes along pseudotime. Each visualization seeks to communicate and highlight a different aspect of the results.
Animating with gganimate
Still, when we are able to operature outside of traditional printed media and static visualizations, we can now take advantage of the additional time dimension for visualization offered by animations! We can use the gganimate
package to visualize the same cell cycle genes as above.
library(gganimate)
df.all <- do.call(rbind, lapply(1:length(genes.final), function(i) {
gexp <- m[genes.final[i], rownames(emb.test)]
df <- data.frame(emb.test, gexp, gene=genes.final[i], order=i)
}))
p <- ggplot(df.all, aes(x = X1, y = X2, col=gexp)) + geom_point()
p <- p + theme_void() +
theme(legend.position = "none") +
scale_color_distiller(palette = 'RdBu',
limits = c(-2,2))
anim <- p +
transition_states(order,
transition_length = 5,
state_length = 1) +
labs(title = '{genes.final[as.integer(closest_state)]}') +
theme(plot.title = element_text(size = 28)) +
geom_point(size = 5) +
enter_fade()
anim
For more information about gganimate
, check out:
- Older
- Newer
RECENT POSTS
- Deconvolution vs Clustering Analysis for Multi-cellular Pixel-Resolution Spatially Resolved Transcriptomics Data on 03 May 2022
- Exploring UMAP parameters in visualizing single-cell spatially resolved transcriptomics data on 19 January 2022
- Animating RNA velocity with moving arrows on 15 October 2021
- A tale of two cell populations: integrating RNA velocity information in single cell transcriptomic data visualization with VeloViz on 06 October 2021
- Story-telling with Data Visualization on 12 August 2021
- Complementing single-cell clustering analysis with MERINGUE spatial analysis on 21 June 2021
- Randomly Generating Music with R on 19 April 2021
- Animating the Cell Cycle on 28 December 2020
- Using R To Find The Missing Faculty on 30 November 2020
- Using scVelo in R using Reticulate on 25 August 2020
TAGS
RELATED POSTS
- Deconvolution vs Clustering Analysis for Multi-cellular Pixel-Resolution Spatially Resolved Transcriptomics Data
- Exploring UMAP parameters in visualizing single-cell spatially resolved transcriptomics data
- Animating RNA velocity with moving arrows
- A tale of two cell populations: integrating RNA velocity information in single cell transcriptomic data visualization with VeloViz