Friday 15 May 2015

Plotting a 96 well plate data set...

UPDATE: 24th October 2020
I've changed the data source so this plots works now. 
The data is available through Github. 

====

One of the great things about R is the vast array of packages that are available. There are extra packages for statistical analysis, for graphical analysis and for lots of other things.

Two of the most widely used packages for graphical analysis are lattice and ggplot.

Today, I have written a script using both these packages to analyse data from a 96 well plate experiment. Graphing data allows data exploration. The data was supplied by Jim Caunt at the University of Bath. I worked with Jim when he was the Chair of the Signalling Theme Panel of the Biochemical Society. Sadly he is no longer with us. Thanks for the data Jim.

The experiment is performed with high content fluorescence microscopy and allows the measurement of different fluorochromes in the same wells (and cells). The fluorochromes used in this experiment correspond to expression of a viral transgene with a HA tag, a measurement of phospho-Erk and a measurement of cell entry into S-phase.

Here is three of the plots the script generates. The script is below.

I like this first plot which shows all the numbers against each other. It's nice to see the data together and look at patterns. This is drawn with the base graphics in R.




This plot is drawn with lattice. It shows the effect of FBS. Each dot represents an individual well. FCS causes an observable increase in cell proliferation in all cases as measured by the number of cells in S-phase (making DNA). The script below draws two other similar graphs coloured by PPase status of the host cell and the presence of the viruses.




This plot was drawn with ggplot. It shows the effect of the two viruses used in the experiment. Both viruses increase Erk phosphorylation to different extents. However, they don't seem to increase the number of cells in S-phase very much. ggplot allows linear modelling and confidence intervals as part of the plots which is nice.


Here is the script (on Github too): 

# Import the data
data <- read.csv("https://raw.githubusercontent.com/brennanpincardiff/RforBiochemists/master/data/wellsDataSimp.csv")

# Have a quick look at it
View(data)

# Simple plot
plot(data[5:7])

# Install and enable two graphics packages
install.packages("lattice")
install.packages("ggplot2")
library("lattice")
library("ggplot2")


# Plot the data in the lattice package first. 

#plot ppErk against Number of S-phase cells. 
# Colour the plots by presence of FBS (0 or 10%)
xyplot(data$S.phase.cnt ~ data$P.Erk,
       group=data$FBS,
       main="Number of S-phase cells Vs pErk staining",
       xlab ="Phospho-Erk",
       ylab = "S-phase cell count",
       auto.key=list(space="top", columns=2, 
                     title="FBS", cex.title=1))

# Colour the plots by presence of PPase in host cell
xyplot(data$S.phase.cnt ~ data$P.Erk,
       group=data$Host.cell,
       main="Number of S-phase cells Vs pErk staining",
       xlab ="Phospho-Erk",
       ylab = "S-phase cell count",
       auto.key=list(space="top", columns=2, 
                     title="Host Cell", cex.title=1))

# Colour the plots by presence of the virus (no virus = Ctl, Q61 = ras mutant, V600F = raf mutant)
xyplot(data$S.phase.cnt ~ data$P.Erk,
       group=data$Virus,
       main="Number of S-phase cells Vs pErk staining",
       xlab ="Phospho-Erk",
       ylab = "S-phase cell count",
       auto.key=list(space="top", columns=3, 
                     title="Virus", cex.title=1))


# plot wells data with ggplot
qplot(P.Erk, S.phase.cnt, data=data, geom=c("point", "smooth"), 
      method="lm", formula=y~x, color=Virus, 
      main="Number of S-phase cells Vs pErk staining", 
      xlab="ppErk", ylab="Number of S-phase cells")


No comments:

Post a Comment

Comments and suggestions are welcome.