Affymetrix 芯片數(shù)據(jù)處理流程及原理簡介

版權(quán)所有,轉(zhuǎn)載必究残炮!

本文作者:任紅雷, 聯(lián)系郵箱: renhongleiz@126.com

本文整理自個人匯報的PPT

首先趁曼,本文將結(jié)合代碼講解常用的Affymetrix 芯片數(shù)據(jù)處理流程

以GSE11787為例,數(shù)據(jù)為關于副豬嗜血桿菌對豬炎癥發(fā)生影響的數(shù)據(jù),請下載數(shù)據(jù)送淆,并將其解壓到任意的文件夾章鲤,以供之后使用:

http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE11787&format=file

首先介紹一下關于基因表達芯片的背景摊灭。(最后附上流程代碼)

1.提綱

提綱

2.中心法則(可自行百度)

中心法則

3.DNA 芯片是什么,作用如何败徊?

芯片的含義與作用

5.Affymetrix 芯片

Affymetrix 芯片

6.芯片上的信息

芯片上的信息

7.PM和MM

PM和MM

8.芯片掃描結(jié)果

芯片掃描結(jié)果及其工作原理

9..CEL文件格式

.CEL文件格式

10.intensity(信號強度)的實際含義

intensity(信號強度)的實際含義

11..CEL文件以及.CDF文件

.CEL文件以及.CDF文件

12.數(shù)據(jù)處理流程

數(shù)據(jù)處理流程

13.拓展學習書籍列表

(本教程內(nèi)容整理自Bioconductor Case Studies)

1.A (very) short introduction to R

https://cran.r-project.org/doc/contrib/Torfs+Brauer-Short-R-Intro.pdf

2.An Introduction to R

https://cran.r-project.org/doc/manuals/R-intro.pdf

3.Bioconductor Case Studies

lots of bioconductor workflows with source codes

鏈接: http://pan.baidu.com/s/1qYBtvIk

密碼: eq85

Affymetrix 芯片數(shù)據(jù)處理流程的源代碼

1.Read data

##1.ReadData##
#add bioconductor source

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

#install affy package from bioconductor

biocLite("affy")

#load affy package

library("affy")

#set the directory that you are working with,this can be replaced by your own CEL files path

setwd("/Users/Ren/Documents/Rcode/GSE11787_RAW")

#set the .CEL files path,this can be replaced by your own CEL files path

celpath="/Users/Ren/Documents/Rcode/GSE11787_RAW/"

#read .CEL files from directory of celfile.path

data = ReadAffy(celfile.path =celpath)

#replace the sample names of the data by trim off the ".CEL" suffix

sampleNames(data) = sub("\\.CEL$", "", sampleNames(data))

#read the phenoData of the CEL file.The "type.csv" file is consitituded with .csv format after you comprehensed the samples grouping on the GEO: http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE11787

samplestype <- read.csv(paste(celpath,"type.csv",sep = ""),header = TRUE,row.names = 1,na.strings = "NA",sep = ',',stringsAsFactors = F,as.is = !default.stringsAsFactors())

#replace the rownames of the samplestype by its sampleID

rownames(samplestype) = samplestype$sampleID

#match the rownames of your phenoData to the samplenames of experiments data,which will return the matched index

mt = match(rownames(samplestype), sampleNames(data))

#give a completed column description of the phenoData

vmd = data.frame(labelDescription = c("Sample ID", "Samples type: Haemophilus Parasuis infected or control"))

#make the matched sampletype rows and varMetadata to your data's phenoData

phenoData(data) = new("AnnotatedDataFrame", data = samplestype[mt, ], varMetadata = vmd)

#erase samples which has no type

data = data[,!is.na(data$type)]

其中type.csv的文件形式如下:


type.csv

2.Quality Control

##2.Quality Control##

#install the essential packages from Bioconductor

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

biocLite(c("affyQCReport","simpleaffy"))

#load the pakages of affyQCReport and simpleaffy

library("affyQCReport")

library("simpleaffy")

#Execute the Quality Control

saqc = qc(data)

#plot the quality control result

plot(saqc)

QC 之后的結(jié)果,如下圖:

Quality Control

3.Data Normalization

##3.Data Normalization##
#packaged affyPLM provides another set of diagnostics that can be used to help assess array quality

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

biocLite(c("affyPLM"))

library("affyPLM")

#fit the basic probe-level model

dataPLM = fitPLM(data)

#plot normalized unscaled standard error (NUSE)

boxplot(dataPLM, main="NUSE", outline = FALSE, col="lightblue", las=3, whisklty=0, staplelty=0)

#plot relative log expression (RLE)

Mbox(dataPLM, main="RLE", outline = FALSE, col="mistyrose", las=3, whisklty=0, staplelty=0)

#if some sample was significantly elevated or more spread out,you can remove it as bad arrays

#here we don not have bad array ,the code next line is just a example to remove the sample "GSM298263",to execute this ,you can remove the sharp at the head of next line

#badArray = data[,-match(c("GSM298263"), sampleNames(data)) ]

normalized unscaled standard error (NUSE) 的各樣本結(jié)果帚呼。

NUSE

relative log expression (RLE) 的各樣本結(jié)果。

RLE

4.Data preprocessing

##4.Data preprocessing##
#load affy package

library("affy")

#rma preprocessing:which concluded 1.background correction,2.between array normalization 3.reporter summarization

datarma = rma(data)

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

#install the porcines' db for get its specices annotation of the probe set

biocLite(c("porcine.db"))

#load the package of porcine.db

library("porcine.db")

#to filter out probe sets with no Entrez Gene identifiers and Affymetrix control probes

datafiltered = nsFilter(datarma, remove.dupEntrez=FALSE, var.cutof =0.5)$eset


#t-tests for rows of a matrix, intended to be speed efficient

#The function computes the t-statistic, the difference of the group means between the two disease groups, and the corresponding p-value by using the t-distribution.

datatt = rowttests(datafiltered, "type")

#draw the volcano plot using x-axis:dm(difference of the group means),y-axis:group log(p-value) 

lod = -log10(datatt$p.value)

plot(datatt$dm, lod, pch=".", xlab="log-ratio",ylab=expression(-log[10]~p))

#line indicates an untransformed p-value of 0.01, so points above it will be significant

abline(h=2)

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

#install the porcine's db for get its specices annotation of the probe set

biocLite(c("limma"))

library("limma")

#make the design of the experiment as a matrix with its type

design = model.matrix(~datafiltered$type)

datalim = lmFit(datafiltered, design)

#When there are few replicates, the variance is not well estimated and the t-statistic can perform poorly. 

#It can be solved by a improved method called empirical Bayes to give a sensible estimation of variance and t-statistic

#When sample sizes are moderate or large, say ten or more in each group, there is generally no advantage (but also no disadvantage) to using the Bayesian approach.

dataeb = eBayes(datalim)

火山圖的結(jié)果(Volcano plot),黑線之上的基因代表p值顯著的基因

Volcano plot

5.GO analysis

##GO analysis##

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

#install the porcine's db for get its specices annotation of the probe set

biocLite(c("topGO"))

library(topGO)

#multiple testing problem corrected by multtest package

#Alternatively,the function topTable in the limma package provides multiple testing adjustment methods, including Benjamini and Hochberg’s false discovery rate (FDR), simple Bonferroni correction, and several others.

#for more information you can access:http://www.reibang.com/p/9e97e9b351fd,and http://www.reibang.com/p/a262cf3d18b9

#get the top 10 differential expressed gene by multiple testing correction of Benjamini-Hochberg (FDR) method

tabofallgene = topTable(dataeb, coef=2, adjust.method="BH", n=length(datatt[,1]))

#get the p-value of all genes named with the probe set name

geneList=setNames(tabofallgene[,5],rownames(tabofallgene))

annotation_db_name=paste(annotation(datafiltered),".db",sep="")

#load the annotation db package

library(package = annotation_db_name, character.only = TRUE)

#method to extract top differential expressed gene

topDiffGenes <- function(allScore) {
  return(allScore < 0.01)
}

#get the count of the differential expressed gene set

sum(topDiffGenes(geneList))

#new a topGOdata type object and use biology process(a gene ontology category),all gene is geneList, differential expressed gene is  topDiffGenes

sampleGOdata <- new("topGOdata", description = "Simple session", ontology = "BP",allGenes = geneList, geneSel = topDiffGenes,nodeSize = 10,annot = annFUN.db, affyLib = annotation_db_name)

#Performing the enrichment tests

#Fisher’s exact test which is based on gene counts

resultFisher <- runTest(sampleGOdata, algorithm = "classic", statistic = "fisher")

#Kolmogorov-Smirnov like test which computes enrichment based on gene scores.

resultKS <- runTest(sampleGOdata, algorithm = "classic", statistic = "ks")

resultKS.elim <- runTest(sampleGOdata, algorithm = "elim", statistic = "ks")

#make all GO enrichment result to a table called allRes

allRes <- GenTable(sampleGOdata, classicFisher = resultFisher,classicKS = resultKS, elimKS = resultKS.elim,orderBy = "elimKS", ranksOf = "classicFisher", topNodes = 10)

#draw the GO tree graph,with a depth of 10

tree_depth=10

showSigOfNodes(sampleGOdata, score(resultKS.elim), firstSigNodes = tree_depth, useInfo = 'all')

GO terms的DAG圖:

GO

6.可選步驟.繪制樣本集的熱圖(heatmap)和level plot

##prestep:1.read data from .CEL files and 2.Quality control

##generate sample's level plot and heatmap##

#calculate the distance of a n*n matrix,and set the diagonal to zero

dd = dist2(log2(exprs(data)),diagonal=0)

#Hierarchical clustering of dd

dd.row <- as.dendrogram(hclust(as.dist(dd)))

#x or y axis sample order index in dd matrix

row.ord <- order.dendrogram(dd.row)

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

biocLite(c("latticeExtra"))

library("latticeExtra")

#add lengend

legend = list(top=list(fun=dendrogramGrob, args=list(x=dd.row, side="top")))

#give a level plot

lp = levelplot(dd[row.ord, row.ord],scales=list(x=list(rot=90)), xlab="", ylab="", legend=legend)

lp

install.packages(c("gplots","RColorBrewer"))

library(gplots)

library(RColorBrewer)

# creates a own color palette from red to green

my_palette <- colorRampPalette(c( "green","yellow", "red"))(n = 299)

gplots:::heatmap.2(dd, Rowv =FALSE,Colv=dd.row, col = my_palette, tracecol=NA,density.info="none",cexRow=0.4,cexCol=0.4)

熱圖如下:

heatmap

level plot如下:

levelplot
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末皱蹦,一起剝皮案震驚了整個濱河市煤杀,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌沪哺,老刑警劉巖沈自,帶你破解...
    沈念sama閱讀 206,126評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異辜妓,居然都是意外死亡枯途,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,254評論 2 382
  • 文/潘曉璐 我一進店門籍滴,熙熙樓的掌柜王于貴愁眉苦臉地迎上來酪夷,“玉大人,你說我怎么就攤上這事孽惰⊥砹耄” “怎么了?”我有些...
    開封第一講書人閱讀 152,445評論 0 341
  • 文/不壞的土叔 我叫張陵勋功,是天一觀的道長坦报。 經(jīng)常有香客問我,道長狂鞋,這世上最難降的妖魔是什么片择? 我笑而不...
    開封第一講書人閱讀 55,185評論 1 278
  • 正文 為了忘掉前任,我火速辦了婚禮要销,結(jié)果婚禮上构回,老公的妹妹穿的比我還像新娘。我一直安慰自己疏咐,他們只是感情好纤掸,可當我...
    茶點故事閱讀 64,178評論 5 371
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著浑塞,像睡著了一般借跪。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上酌壕,一...
    開封第一講書人閱讀 48,970評論 1 284
  • 那天掏愁,我揣著相機與錄音,去河邊找鬼卵牍。 笑死果港,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的糊昙。 我是一名探鬼主播辛掠,決...
    沈念sama閱讀 38,276評論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼释牺!你這毒婦竟也來了萝衩?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 36,927評論 0 259
  • 序言:老撾萬榮一對情侶失蹤没咙,失蹤者是張志新(化名)和其女友劉穎猩谊,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體祭刚,經(jīng)...
    沈念sama閱讀 43,400評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡牌捷,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 35,883評論 2 323
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了涡驮。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片宜鸯。...
    茶點故事閱讀 37,997評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖遮怜,靈堂內(nèi)的尸體忽然破棺而出淋袖,到底是詐尸還是另有隱情,我是刑警寧澤锯梁,帶...
    沈念sama閱讀 33,646評論 4 322
  • 正文 年R本政府宣布即碗,位于F島的核電站,受9級特大地震影響陌凳,放射性物質(zhì)發(fā)生泄漏剥懒。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,213評論 3 307
  • 文/蒙蒙 一合敦、第九天 我趴在偏房一處隱蔽的房頂上張望初橘。 院中可真熱鬧,春花似錦、人聲如沸保檐。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,204評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽夜只。三九已至垒在,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間扔亥,已是汗流浹背场躯。 一陣腳步聲響...
    開封第一講書人閱讀 31,423評論 1 260
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留旅挤,地道東北人踢关。 一個月前我還...
    沈念sama閱讀 45,423評論 2 352
  • 正文 我出身青樓,卻偏偏與公主長得像粘茄,于是被迫代替她去往敵國和親签舞。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,722評論 2 345

推薦閱讀更多精彩內(nèi)容