Intro to R III: heatmaps!

As many of us biologists know, heatmaps are so common in papers about any kind of high-throughput assay that they’re almost a cliché. The reason is that they let you view, at a glance, global patterns of differences between clusters of samples and/or genes, allowing you to see the forest instead of the trees (to use another cliché). Making and customizing heatmaps doesn’t have to be as groan-worthy as this introduction, though. It’s as easy as knowing how to navigate a handful of functions in R, which Igor will be walking us through today.

To prepare, please copy, paste, and run the R code posted here in RStudio. Below, I’ve posted the installation instructions, but please check out the link for the full tutorial code.

# install the relevant packages if they are not installed
install.packages("RColorBrewer")
install.packages("pheatmap")

# download the data files (it will download to the current working directory)
fileName="ca-genes-fpkm.csv"
download.file(paste0("https://raw.githubusercontent.com/igordot/tutorials/master/", fileName), destfile=fileName)
fileName="ca-genes-stats-sig.csv"
download.file(paste0("https://raw.githubusercontent.com/igordot/tutorials/master/", fileName), destfile=fileName)

# load the relevant packages
library(RColorBrewer)
library(pheatmap)

If you want the files themselves just to keep, download them here and here. The R code posted above will also manage the installations you will need for this tutorial, namely RColorBrewer (a package for fancy colour schemes in R) and pheatmap (the package that does the work of making the heatmap).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s