Extracting Gene Names From Venn Diagram
1
1
Entering edit mode
10.6 years ago
robjohn7000 ▴ 110

I created a venn diagram (5 intersecting circles) using the code below, but not sure how to go about extracting the genes that are differentially expressed across different compartments.

## create experimental design
experimentalFactors<-targets$time
sampleGroups <- factor(experimentalFactors, levels = unique(experimentalFactors))
exptDesign <- model.matrix(~ 0 + sampleGroups)
colnames(exptDesign) <- levels(sampleGroups)

## create contrasts
contrasts <- makeContrasts("hr6-0","hr24-hr0","hr48-hr0","hr72-hr0","hr80-hr0",levels = exptDesign)

fit <- lmFit(selDataMatrix, exptDesign)
fit2 <- contrasts.fit(fit, contrasts)
fit2 <- eBayes(fit2)

## venn diagram
fit2.venn <- fit2[,1:5]
results <- decideTests(fit2.venn, method="separate", adjust.method="BH", p.value=0.05, lfc=1.5)
vennDiagram(results)

Please help!

r limma bioconductor microarray • 7.0k views
ADD COMMENT
3
Entering edit mode
10.6 years ago
Irsan ★ 7.8k

The results-object you have that was returned by decideTests() is a TestResults-class. This is basically a matrix with rows as genes and colums as contrasts. Each value is -1, 0 or 1 meaning downregulated, unchanged and upregulated. So if you want to get all genes that are different in contrast 1 but not in 4 you can do

yourGenes<-which(results[,1]!=0 & results[,4]==0)
results[yourGenes,]
ADD COMMENT
0
Entering edit mode

Brilliant! That worked nicely. Thanks Irsan for the code and the explanations. I was able to get the genes that are upregulated in all contrasts with the following:

         Genes <- which(results[,1]==1 & results[,2]==1 & results[,3]==1 & results[,4]==1 & results[,5]==1)
         Genes <- results[Genes,]

But the gene names are in the "illumina" format and I wanted the official gene syambols, and then tried two ways (neither worked):

         Official_genes <- fit2$genes[Genes, "geneSymbol"]


         Official_genes <- fit2$genes$geneSymbol[Genes]

Is there a way of getting the genes in the official gene symbol format?

ADD REPLY
1
Entering edit mode

Well that depends on whether the official gene symbols are somewhere in your data in fit2 in the first place. Is it?

ADD REPLY
0
Entering edit mode

yes, it is here:fit2$genes$geneSymbol

ADD REPLY
0
Entering edit mode

I guess fit2$genes is a data frame. Does it also contain a column with the illumina ids you mentioned earlier?

ADD REPLY
0
Entering edit mode

yes it's the same data frame that contains a column of IDs.

ADD REPLY
1
Entering edit mode
Genes <- names(Genes)
Official_genes <- fit2$genes[Genes, "geneSymbol"]
ADD REPLY
1
Entering edit mode

Many thanks, your latest code worked with a modification, thus: Genes <- row.names(Genes) Official_genes <- fit2$genes[Genes, "geneSymbol"]

I really appreciate your help Irsan!!!

ADD REPLY
0
Entering edit mode

You are welcome :-)

ADD REPLY

Login before adding your answer.

Traffic: 1945 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