User Tools

Site Tools


Back to Manny's Bioinformatics Workshop Home

Volcano Plot using sample Microarray Data

In this exercise we will practice our R-coding skills by analyzing a sample microarray dataset to create a Volcano plot. A volcano plot is a great visual aid to identify genes that are differentially expressed. The Log Fold Change is plotted on the x-axis and the -1 * Log base 10 of the p-value from a statistical test is plotted on the y-axis. Significantly differentially expressed genes have a p-value less than a cutoff (usually 0.05) and a log fold change of atleast 1.5x (plus or minus).

We will separate the exercise into 5 different steps.

  1. Load the file into the R workspace
  2. Calculate the log fold change for each gene
  3. Calculate the p-value for each gene using t-test
  4. Create the Volcano plot
  5. Create a boxplot of expression values from genes that are significantly induced.

Read the file into R workspace

expvalues = read.table("expvalues.txt", header=T)

Calculate log fold change for each gene

Using a loop

expvaluesfc = numeric()
for (i in 1:nrow(expvalues)) {
  trtmean = mean(as.numeric(expvalues[i,4:6]))
  expvaluesfc[i] = log2(trtmean/ctrlmean)


Calculate p-value using t-test for each gene

Using a loop

expvaluestt= numeric()

for (j in 1:nrow(expvalues)) {


Creating a volcano plot

expvalueslog = -1*log(expvaluestt)
plot(expvaluesfc, expvalueslog)
abline(v=-1, col="blue")
abline(v=1, col="blue")
abline(h=29.95, col="red")

A boxplot of induced genes

expvaluefc2tt05 = expvaluesfc > 1 & expvaluestt < 0.05
mkatari-bioinformatics-august-2013-volcano-plot.txt · Last modified: 2013/08/16 21:13 by mkatari