Summer Institute in Statistical Genetics
Module 9: Elements of R for Genetics & Bioinformatics
Instructors: Thomas Lumley and Ken Rice

This page will feature slides from our sessions, exercises for you to complete, and their solutions (all to follow). Prior to the module, please install on an up-to-date version of R on the laptop you will use during the summer institute. R is free, and is available from this site.

To download and install Bioconductor to your laptop, first log on to the internet. Then open an R session and enter the following;

source("http://bioconductor.org/biocLite.R")
biocLite()

After doing this download, to download new Bioconductor packages (for example the hexbin package) use the following commands;

source("http://bioconductor.org/biocLite.R")
biocLite("hexbin")


Slides and exercises

Script files are posted following each session; these will contain our R code for the exercises. To make them work on your computer, remember to modify file names and locations appropriately. Also note that many different 'correct' solutions are possible.

Session 1, Introductions, reading in data. Exercises [.doc .pdf] (R script file)

Session 2; Learning to Draw. Exercises [.doc .pdf] (R script file)

Session 3; More advanced graphics. Exercises [.doc .pdf] (R script file)

Session 4; Data Manipulation. Exercises [.doc .pdf] (R script file)

Session 5; Replication - simulation and permutation. Exercises [.doc .pdf] (R script file)

Session 6; Writing Big Loops. Exercises [.doc .pdf] [timing commands] (R script file)

Session 7; Working with Big Data. Exercises [.doc .pdf] (R script file)

Session 8; Bioconductor Intro and Annotation. Exercises [.doc .pdf] (R script file)

Special Exercise: This is a more in-depth programming problem, for you to try on Tuesday night; we'll discuss it in the final session. [.doc, .pdf]

Session 9; Bioconductor II. Exercises [.doc .pdf] (R script file)

Session 10; Special Exercise review (R script file) and Interfacing R. [No exercises for this session]


Datasets - in alphabetical order

Before trying to read data into your R session, we recommend looking at it first, in a text editor. Is the data comma- or tab-delimited? Does it have a 'header' row containing variable names?

AMDchrom1snpStats.Rdata
annt.txt
antibiotics.txt
bpdata.csv
data.vsn.csv
example-pheno.txt
example-pheno.csv
example-snp.txt
foursnps.csv
foursnps.txt
hapmap6.db
hapmap6.nc
genepi.txt
justsnps.txt
niehs.csv
psa.txt
ribogreen.rda
salary.txt
sampleinfo.csv
SEAflightslocs.csv
SEAflights.db
sisg.nc


Other resources

Some recommended books;