Repository navigation
Affymetrix
##Introduction and Instructions
Welcome to the Affymetrix Tutorial. This tutorial will guide you through a basic Affymetrix experiment using freely available Affymetrix microarray data from Gene Expression Omnibus (GEO). Below is the recommended progression for advancing through this tutorial:
(1) Go through the Shared Features page to familiarize yourself with the methods shared across all microarray experiments
(2) Return to this page to go through the annotated code along with accompanying tutorial slides to become acquainted with a typical Affymetrix microarray experiment
(3) Download Affymetrix.R to work through the tutorial directly on your own computer/server
(4) Use Affymetrix.R as a template for your own Affymetrix microarray experiment, and refer to the annotated code and tutorial slides as needed
In the future, this page will hold links to the more useful slides that accompany this presentation
####Experiment Progression
Here are the steps for a basic Affymetrix microarray experiment:
1. Get Data
2. QC on Non-Normalized Data
3. Normalization
4. Batch Correction
5. Outlier Removal
6. QC on Normalized Data
7. Covariate Analysis
8. Annotating Probes
9. Collapse Rows
10. Differential Expression Analysis
For this tutorial we will be using data from GEO, experiment GSE20295. This is a Parkinson's disease multi-region brain study done with human post-mortem brain tissue. In the tutorial, we will only be looking at the prefrontal cortex.
It is key to download the affy R library for your Affymetrix experiment, since it contains functions for reading the raw data into your R session (ReadAffy) and normalization of Affymetrix arrays (rma).
For your Affymetrix experiment, you have two choices for getting your data into your R session:
**(a)**You load your data directly from a source (such as GEO or ArrayExpress) into your R session
**(b)**You download your data to your local computer or server before loading it into your R session
Option (a) can fully utilize tools such as the GEOquery R library. Specific sources often have R libraries for downloading microarray data directly into your R session. In the code tutorial, we use GEOquery for option (a).
Option (b) is more suitable if you are using data from your own experiment, OR you need to select specific parts of the entire dataset to analyze. Sometimes with large datasets (> 500 Mb) it is better to 'pre-filter', or only extract/download data that you need - in this experiment, we only want prefrontal cortex.
You only need to use option (a) OR option (b) to get data into your R session.
#####(a) Load your data directly from a source into your R session (using GEOquery R library)
Use getGEO() to get phenotype data from the entire experiment, and create your datMeta
gse <- getGEO("GSE20295", GSEMatrix =TRUE,getGPL=FALSE) datMeta = pData(gse[[1]]) rownames(datMeta) = datMeta[,2] datMeta$title = gsub(" ","_",datMeta$title) idx = which(datMeta$source_name_ch1 == "Postmortem brain prefrontal cortex")
Create an index idx to later use in keeping only prefrontal cortex samples.
Next, use getGEOSuppFiles() to directly download .CEL.gz files onto your computer from the whole experiment.
getGEOSuppFiles("GSE20295")
Use software such as 7-zip to extract your new "GSE20295_RAW" folder. Also, take care to manually change GSM506039_1_1364_BA9_Pm.CEL.gz to GSM506039_1364_BA9_Pm.CEL.gz before moving on. This is an upload error in GEO - this kind of mistake definitely happens all the time.
filesPFC = paste(datMeta$geo_accession,"_",datMeta$title,".CEL.gz",sep="")[idx] data.affy = ReadAffy(celfile.path = "./GSE20295/GSE20295_RAW", filenames = filesPFC) datExpr = exprs(data.affy) datMeta = datMeta[idx,]
ReadAffy() will now create an affy object data.affy that only contains the prefrontal cortex samples that we are interested in. It is important for your affy object to only contain the samples you are investigating, since the normalization function rma() needs this affy object as input.
Next, check datMeta/datExpr ordering and reformat as necessary.
`GSM = rownames(pData(data.affy))
GSM = substr(GSM,1,9)
idx = match(GSM, datMeta$geo_accession)
datMeta = datMeta[idx,]
datMeta = datMeta[,-c(3:7,14:36)]
datMeta$characteristics_ch1 = gsub("disease state: control","CTL",datMeta$characteristics_ch1)
datMeta$characteristics_ch1 = gsub("disease state: Parkinson's disease","PKD",datMeta$characteristics_ch1)
datMeta$characteristics_ch1.1 = gsub("gender: male","M",datMeta$characteristics_ch1.1)
datMeta$characteristics_ch1.1 = gsub("gender: female","F",datMeta$characteristics_ch1.1)
datMeta$characteristics_ch1.2 = gsub("age: ","",datMeta$characteristics_ch1.2)
datMeta$characteristics_ch1.3 = gsub("brain region: ","",datMeta$characteristics_ch1.3)
colnames(datMeta)[5:8] = c("Dx","Sex","Age","Region")
datMeta$Dx = as.factor(datMeta$Dx)`
#####(b) Download your data to your local computer or server before loading it into your R session