# Using Bioconductor with Microarray Analysis

Bioconductor has advanced facilities for analysis of microarray platforms including Affymetrix, Illumina, Nimblegen, Agilent, and other one- and two-color technologies.

Bioconductor includes extensive support for analysis of expression arrays, and well-developed support for exon, copy number, SNP, methylation, and other assays.

Major workflows in Bioconductor include pre-processing, quality assessment, differential expression, clustering and classification, gene set enrichment analysis, and genetical genomics.

Bioconductor offers extensive interfaces to community resources, including GEO, ArrayExpress, Biomart, genome browsers, GO, KEGG, and diverse annotation sources.

- Sample Workflow
- Installation and Use
- Exploring Package Content
- Pre-Processing Resources

## Sample Workflow

    ## Warning: package 'limma' was built under R version 3.0.2
    ## Warning: package 'affy' was built under R version 3.0.2
    ## Warning: package 'BiocGenerics' was built under R version 3.0.2
    ## Warning: package 'Biobase' was built under R version 3.0.2

The following code illustrates a typical R / Bioconductor session. It uses RMA from the `affy` package to pre-process Affymetrix arrays, and the `limma` package for assessing differential expression.

    ## Load packages
    library(affy)   # Affymetrix pre-processing
    library(limma)  # two-color pre-processing; differential
                      # expression

    ## import "phenotype" data, describing the experimental design
    phenoData <-
        read.AnnotatedDataFrame(system.file("extdata", "pdata.txt",
        package="arrays"))

    ## RMA normalization
    celfiles <- system.file("extdata", package="arrays")
    eset <- justRMA(phenoData=phenoData,
        celfile.path=celfiles)

    ## Warning: package 'hgfocuscdf' was built under R version 3.0.2
    ## Warning: package 'AnnotationDbi' was built under R version 3.0.2

    ##

    ## differential expression
    combn <- factor(paste(pData(phenoData)[,1],
        pData(phenoData)[,2], sep = "_"))
    design <- model.matrix(~combn) # describe model to be fit

    fit <- lmFit(eset, design)  # fit each probeset to model
    efit <- eBayes(fit)        # empirical Bayes adjustment
    topTable(efit, coef=2)      # table of differentially expressed probesets

    ##              logFC AveExpr      t   P.Value adj.P.Val     B
    ## 204582_s_at  3.468  10.151  39.03 1.970e-14 1.732e-10 19.86
    ## 211548_s_at -2.326   7.179 -22.73 1.541e-11 6.776e-08 15.89
    ## 216598_s_at  1.936   7.693  21.74 2.659e-11 7.793e-08 15.48
    ## 211110_s_at  3.158   7.909  21.19 3.625e-11 7.969e-08 15.25
    ## 206001_at   -1.591  12.403 -18.64 1.715e-10 3.017e-07 14.02
    ## 202409_at    3.274   6.705  17.73 3.157e-10 4.626e-07 13.52
    ## 221019_s_at  2.252   7.104  16.35 8.353e-10 1.049e-06 12.69
    ## 204688_at    1.813   7.125  14.75 2.834e-09 3.115e-06 11.62
    ## 205489_at    1.241   7.552  13.62 7.265e-09 7.098e-06 10.77
    ## 209288_s_at -1.226   7.604 -13.33 9.401e-09 7.785e-06 10.53

A top table resulting from a more complete analysis, described in Chapter 7 of Bioconductor Case Studies, is shown below. The table enumerates Affymetrix probes, the log-fold difference between two experimental groups, the average expression across all samples, the t-statistic describing differential expression, the unadjusted and adjusted (controlling for false discovery rate, in this case) significance of the difference, and log-odds ratio. These results can be used in further analysis and annotation.

          ID logFC AveExpr    t  P.Value adj.P.Val     B
    636_g_at  1.10    9.20 9.03 4.88e-14  1.23e-10 21.29
    39730_at  1.15    9.00 8.59 3.88e-13  4.89e-10 19.34
     1635_at  1.20    7.90 7.34 1.23e-10  1.03e-07 13.91
     1674_at  1.43    5.00 7.05 4.55e-10  2.87e-07 12.67
    40504_at  1.18    4.24 6.66 2.57e-09  1.30e-06 11.03
    40202_at  1.78    8.62 6.39 8.62e-09  3.63e-06  9.89
    37015_at  1.03    4.33 6.24 1.66e-08  6.00e-06  9.27
    32434_at  1.68    4.47 5.97 5.38e-08  1.70e-05  8.16
    37027_at  1.35    8.44 5.81 1.10e-07  3.08e-05  7.49
    37403_at  1.12    5.09 5.48 4.27e-07  1.08e-04  6.21

[ Back to top ]

## Installation and Use

Follow installation instructions to start using these packages. You can install `affy` and `limma` as follows:

    source("http://bioconductor.org/biocLite.R")
    biocLite(c("affy", "limma"))

To install additional packages, such as the annotations associated with the Affymetrix Human Genome U95A 2.0, use

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

Package installation is required only once per R installation. View a /packagesfull list of available packages.

To use the `affy` and `limma` packages, evaluate the commands

    library("affy")
    library("limma")

These commands are required once in each R session.

[ Back to top ]

## Exploring Package Content

Packages have extensive help pages, and include vignettes highlighting common use cases. The help pages and vignettes are available from within R. After loading a package, use syntax like

    help(package="limma")
    ?topTable

to obtain an overview of help on the `limma` package, and the `topTable` function, and

    browseVignettes(package="limma")

to view vignettes (providing a more comprehensive introduction to package functionality) in the `limma` package. Use

    help.start()

to open a web page containing comprehensive help resources.

[ Back to top ]

## Pre-Processing Resources

The following provide a brief overview of packages useful for pre-processing. More comprehensive workflows can be found in documentation (available from package descriptions) and in Bioconductor Books and monographs.

### Affymetrix 3'-biased Arrays

affy, gcrma, affyPLM

- Require cdf package, probe package and annotation package
- All these packages are available from Bioconductor via `biocLite()`

xps

- Requires installation of ROOT
- Uses data files from Affymetrix (.CDF, .PGF, .CLF, .CSV) directly

### Affymetrix Exon ST Arrays

oligo

- Requires a pdInfoPackage built using pdInfoBuilder
- This package collates cdf, probe, annotation data together
- These packages are available from Bioconductor via `biocLite()`
- Most cases will require a 64-bit computer running Linux and >= 8Gb RAM

exonmap

- Requires installation of MySQL and Ensembl core database tables
- Requires specially modified cdf and affy package
- Requires a 64-bit computer running Linux and >= 8 Gb RAM

xps

- Requires installation of ROOT
- Uses data files from Affymetrix (.CDF, .PGF, .CLF, .CSV) directly
- Will run on conventional desktop computers

### Affymetrix Gene ST Arrays

oligo

- Requires a pdInfoPackage built using pdInfoBuilder
- This package collates cdf, probe, annotation data together
- These packages are available from Bioconductor via `biocLite()`

xps

- Requires installation of ROOT
- Uses data files from Affymetrix (.CDF, .PGF, .CLF, .CSV) directly

### Affymetrix SNP Arrays

oligo

- Requires a pdInfoPackage built using pdInfoBuilder
- This package collates cdf, probe, annotation and HapMap data
- These packages are available from Bioconductor via `biocLite()`
- Not yet capable of processing CNV regions in SNP5.0 and SNP6.0

### Affymetrix Tiling Arrays

oligo

- Requires a pdInfoPackage built using pdInfoBuilder
- This package collates data from bpmap and cif files

### Nimblegen Arrays

oligo

- Requires a `pdInfoPackage` built using pdInfoBuilder

### Illumina Expression Microarrays

lumi

- Requires lumi-specific mapping and annotation packages (e.g., `lumiHumanAll.db` and `lumiHumanIDMapping`)

beadarray

- Requires beadarray-specific mapping and annotation packages (e.g., `illuminaHumanv1BeadID.db` and `illuminaHumanV1.db`)

[ Back to top ]

    sessionInfo()

    ## R version 3.0.1 (2013-05-16)
    ## Platform: i386-w64-mingw32/i386 (32-bit)
    ##
    ## locale:
    ## [1] LC_COLLATE=C
    ## [2] LC_CTYPE=English_United States.1252
    ## [3] LC_MONETARY=English_United States.1252
    ## [4] LC_NUMERIC=C
    ## [5] LC_TIME=English_United States.1252
    ##
    ## attached base packages:
    ## [1] parallel  stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ## [1] hgfocuscdf_2.13.0    AnnotationDbi_1.24.0 affy_1.40.0
    ## [4] Biobase_2.22.0       BiocGenerics_0.8.0   limma_3.18.13
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] BiocInstaller_1.12.1  DBI_0.2-7             IRanges_1.20.7
    ##  [4] RSQLite_0.11.4        affyio_1.30.0         evaluate_0.5.5
    ##  [7] formatR_0.10          knitr_1.6             preprocessCore_1.24.0
    ## [10] stats4_3.0.1          stringr_0.6.2         tools_3.0.1
    ## [13] zlibbioc_1.8.0

[ Back to top ]