Intro

R

Vectors

x = rnorm(1000)
y = x + rnorm(sd=.5, 1000)

functions: argument names;

list()

data.frame()

closures

acctFactory = function() {
  balance <- 0
  list(deposit=function(amt) {
    balance <<- balance + amt
  }, currBalance=function() {
    balance
  })
}

S3 classes and methods

x = rnorm(1000)
y = x + rnorm(sd=.5, 1000)
df = data.frame(X=x, Y=y)

Use of data.frame():

fit = lm(Y ~ X, df)
plot(Y ~ X, df)
abline(fit, lwd=4, col="red")

plot of chunk unnamed-chunk-6

anova(fit)
## Analysis of Variance Table
## 
## Response: Y
##            Df  Sum Sq Mean Sq F value    Pr(>F)    
## X           1 1018.73 1018.73  4098.4 < 2.2e-16 ***
## Residuals 998  248.07    0.25                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Bioconductor

S4

suppressPackageStartupMessages({
    library(IRanges)
})
start <- as.integer(runif(1000, 1, 1e4))
width <- as.integer(runif(length(start), 50, 100))
ir <- IRanges(start, width=width)
coverage(ir)
## integer-Rle of length 10092 with 1723 runs
##   Lengths: 34  5  4  8  3  1  8  5  6 16 ...  3  1  7  7 14  1  4 25 15 17
##   Values :  1  2  3  4  5  6  5  6  7  8 ... 10  9  8  7  6  5  4  3  2  1

Essential classes

Sequences

Ranges

Integrated containers

Working with large data

Brief review of lecture material

Efficient R code

GenomicFiles and BiocParallel

Annotation

Brief review of lecture material

General importance of select() interface, including to on-line resources such as biomaRt

AnnotationHub