Using Genes List From Limma Venn Diagram To Make Heat Map
1
4
Entering edit mode
12.4 years ago
Ly ▴ 130

Hello,

I am using limma to analysis data from a two color agilent chip. I've made my venn diagram using the significant genes that I've acquired from limma. However, I am having trouble trying to link my gene in each compartment of the venn diagram back to the original data to make a heat map. This is what I have so far:

Data Analysis

MA.l<-normalizeWithinArrays(RG,method="loess")

MA.lq<-normalizeBetweenArrays(MA.l,method="quantile")

MA.lqav<- avereps(MA.lq, ID=MA$genes$ProbeName)

design<- modelMatrix(targets, ref="Ref")

contrast.matrix<-makeContrasts(BxM-Control, cMyc-Control,MXH-Control, TxM-Control, levels=design)

contrast.matrix

Contrasts Levels BxM - Control cMyc - Control MXH - Control TxM - Control BxM 1 0 0 0 cMyc 0 1 0 0 Control -1 -1 -1 -1 MXH 0 0 1 0 TxM 0 0 0 1

fit<-lmFit(MA.lqav, design)

fit2<-contrasts.fit(fit, contrast.matrix)

fit2<-eBayes(fit2)

Venn Diagram:

BxM.toptable<-topTable(fit2,coef=1, adjust="fdr", p.value=0.01 )

cMyc.toptable<-topTable(fit2,coef=2,n=40000, adjust="fdr", p.value=0.01)

MXH.toptable<-topTable(fit2,coef=3 ,n=40000, adjust="fdr", p.value=0.01)

TxM.toptable<-topTable(fit2,coef=4, n=40000, adjust="fdr", p.value=0.01)

input<-list(BxM.toptable$ProbeName, MXH.toptable$ProbeName, cMyc.toptable$ProbeName, TxM.toptable$ProbeName)

venn(input)

Table for Venn Diagram

results<-decideTests(fit2, method="separate", adjust.method="fdr", p.value=0.01)

BxM.V<-results[,1]

cMyc.V<-results[,2]

MxH.V<-results[,3]

TxM.V<-results[,4]

VennT<-cbind(BxM.V, cMyc.V, MxH.V, TxM.V)

VennTable<-vennCounts(VennT)

Getting genes that are DE in all comparisons

All<-results[,1]!=0 & results[,2]!=0 & results[,3]!=0 & results[,4]!=0

allgene<-fit2$genes[All, "GeneName"]

a<-na.omit(allgene)

So now I have a list of genes that are differentially expressed in all of my comparisons but I don't know how to link it back to the individual sample and make a heat map. Any help in this would really be appreciated. I am new to R and hope I have not confused you. Also, if I am doing this all wrong or it's not a relevant thing to do, please let me know.

Thank you in advance, Ly

limma gene r • 8.3k views
ADD COMMENT
0
Entering edit mode

Looks like your Venn diagram code is all on one line, which is hard to read.

ADD REPLY
0
Entering edit mode

Can you post sample data for your function. That makes it easier to help you. To post the R data you can use the function dput( object ) and copy the output.

ADD REPLY
3
Entering edit mode
12.3 years ago
seidel 11k

The thing to keep in mind is that the results matrix, all the fit objects (fit, fit2), and your MA.lqav object have the same number of rows for the ratio data from the arrays, so an index into one is an index for all of them. Thus, when you build "All" using the boolean combination of the columns in "results", you end up with a vector of TRUE and FALSE that can be used to access the data for the genes in fit, fit2, and MA.lqav. Too see a heat map of the values from all the individual samples you could do:

heatmap(MA.lqav$M[All,])

The table of ratio data for each array is in MA.lqav$M, and since All is a boolean index (also called an index vector) with TRUE for row that has a significant gene, the statement above creates a submatrix of the ratios in all samples of the significant genes.

If you you want individual heat maps of various venn compartments, then you have to create an index vector using combinations from the results matrix which reflect the logic of the venn compartment. For instance a given compartment might be:

venn_region <- results[,1]==1 & results[,2]!=1 & results[,3]==1
heatmap(MA.lqav$M[venn_region,])
ADD COMMENT

Login before adding your answer.

Traffic: 2641 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6