Introduction
Caveolae are submicroscopic flask-shaped invaginations of the plasma membrane that are abundant in many mammalian cell types including the smooth muscle cells.
Calveolae
Smooth muscle calveolae
The CAV dataset was created in 1994 by B.D. Ripley. The dataset gives the positions of the individual caveolae in a square region with sides of length 500 units. This grid was originally on a 2.65mum square of muscle fibre. There are 138 observations in this dataset.
Source: Appleyard, S.T., Witkowski, J.A., Ripley, B.D., Shotton, D.M. and Dubowicz, V. (1985) A novel procedure for pattern analysis of features present on freeze fractured plasma membranes. Journal of Cell Science, 74, 105–117.
This is a good example for exploring the spatial data visualisation. In this short tutorial, we will perform a 2-D Kernel density plot on those data, using ggplot2 and spatstat packages
library(spatstat) # spatial data analysis
library(viridis) # color palette
First, we load the data :
library(tidyverse)
df=read.csv("http://vincentarelbundock.github.io/Rdatasets/csv/boot/cav.csv")%>%as_tibble()
df$x=as.numeric(df$x)
df$y=as.numeric(df$y)
head(df)%>%knitr::kable()
| X | x | y |
|---|---|---|
| 1 | 498 | 475 |
| 2 | 474 | 498 |
| 3 | 473 | 449 |
| 4 | 450 | 459 |
| 5 | 420 | 447 |
| 6 | 401 | 430 |
2D density plot using ggplot2
df%>%ggplot(aes(x,y))+stat_density2d(geom="polygon",aes(alpha = ..level..),fill="orangered",color="red4",linetype=2)+ theme_bw()+scale_x_continuous("X-coordinate")+scale_y_continuous("Y-coordinate")
Densityplot using spatstat package
regtangle coordinate
window=owin(c(0,500), c(0,500)) # First, generate a window (this could be a square, circle, polygonal sharp or even a map)
pppo=ppp(x=df$x,y=df$y,window) # Generate a ppp object
# Calculating kernel density
den=density(pppo,kernel="gaussian",edge=T,diggle=T,adjust=0.6)
#plot the density graph
plot(den,main='Muscle Caveolae position',col=viridis)
#apply contours
contour(den,add=T,col=viridis(15))
Circle window
Now we will try to do something fun, by simulating a microscopic view:
window=disc(radius=300,centre=c(300,300),mask=FALSE, npoly=256, delta=NULL)
pppo=ppp(x=df$x,y=df$y,window)
den=density(pppo,kernel="gaussian",edge=T,diggle=T,adjust=0.6)
plot(den,main='Muscle Caveolae position',col=plasma)
contour(den,add=T,col=plasma(15))
Conclusion:
spatstat package is useful for plotting a two-dimensional kernel density graph.
Thank for joining us !