# [BioC] VennDiagram quesiont in limma

Jenny Drnevich drnevich at uiuc.edu
Thu Jun 1 16:52:55 CEST 2006

```Hi Jianping,

I recently wrote a detailed response along these same lines for a client.
It's not as elegant as Gordon's solution, but it works for me and can be
modified for any combination you want:

The coded.results object (output from 'decideTests') has the matrix of -1,
0 , and 1s. If BvT and AvT are the 5th and 6th columns in the coded.results
object, you can do:

BsameAup <- which(coded.results[,5] == 1 & coded.results[,6] == 1)

This will give you a vector of row numbers you can use to subset most other
objects that have the genes in the same order:

BsameAupgenes <- fit\$genes[BsameAup,]  #remember that between [], to the
left of the , refers to rows and to the right refers to columns

You can actually combine these two steps if you want to get fancy:

BsameAdowngenes <- fit\$genes[coded.results[,5] == -1 & coded.results[,6] ==
-1 , ]

This subsetting uses TRUE/FALSE output (a conditional statement), such as
== (equal to), != (not equal to), >, <=, etc.

BupAdown <- which(coded.results[,5] == 1,& coded.results[,6] != 1)
BchangedAnot <- which(coded.results[,5] != 0 & coded.results[,6] == 0)

In case you want to use it, the "or" equivalent of "&" is "||" (two
straight characters, not the letter l or capital I; on my keyboard it is on
the same key as the backslash \). You can also put more than two
conditional statements together - just tack as many as you want using & or ||.

Cheers,
Jenny

At 09:23 AM 6/1/2006, jjin at email.unc.edu wrote:
>Hi Gordon,
>
>Thanks very much for your help! That is what I wanted to extract. But
>what if I wanted genes DE for "A" and "B" but "C"? Or just for "A", not
>"B" and "C"?
>
>best wishes!
>
>Jianping
>
>
>Quoting Gordon Smyth <smyth at wehi.EDU.AU>:
>
> > Dear Jianping,
> >
> > I may be mis-interpreting your question (I'm not sure what you mean
> > by a "session"), but I think you just want the gene lists
> > corresponding to the counts in the Venn diagram.
> >
> > Suppose you have a fitted model 'fit' with columns "A", "B" and "C". Then
> >
> >   vennDiagram(fit)
> >
> > will give you a Venn diagram with 8 counts in it. You can do the
> > diagram in two steps
> >
> >   results <- decideTests(fit)
> >   vennDiagram(results)
> >
> > and this allows you to extract the gene lists. Suppose you want the
> > genes DE for both "A" and "B", you could use
> >
> >   myGenes <- apply(results[,c("A","B")],1,all)
> >   fit\$genes[myGenes,]
> >
> > to see the gene list.
> >
> > Best wishes
> > Gordon
> >
> >> Date: Tue, 30 May 2006 13:22:08 -0400
> >> From: Jianping Jin <jjin at email.unc.edu>
> >> Subject: [BioC] VennDiagram quesiont in limma
> >> To: BioConductor_list <bioconductor at stat.math.ethz.ch>
> >> Message-ID: <DBCD9D517C98493F3A37FA9D at unc-jpjin.pmbb.med.unc.edu>
> >> Content-Type: text/plain; charset=us-ascii; format=flowed
> >>
> >> Dear list:
> >>
> >> I am wondering if there is an easy way or a function by which one can
> >> extract (list) any session of genes, either in common or not in common
> with
> >> other sesseion(s), in vennDiagram of limma? I assumed that vennDiagram
> >> should be able to allow to do that. But I did not find anything like that
> >> after reading the on-line instructions.
> >>
> >> Many thanks if you could help me out!
> >>
> >> Jianping
> >>
> >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >> x Jianping Jin Ph.D.            x
> >> x Bioinformatics scientist      x
> >> x Center for bioinformatics     x
> >> x 3133 Bioinformatics Building  x
> >> x CB# 7104                      x
> >> x University of North Carolina  x
> >> x Chapel Hill, NC 27599         x
> >> x Tel: (919)843-6105            x
> >> x Fax: (919)843-3103            x
> >> x E-mail: jjin at email.unc.edu    x
> >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >
> >
>
>_______________________________________________
>Bioconductor mailing list
>Bioconductor at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/bioconductor
>Search the archives:
>http://news.gmane.org/gmane.science.biology.informatics.conductor

Jenny Drnevich, Ph.D.

Functional Genomics Bioinformatics Specialist
W.M. Keck Center for Comparative and Functional Genomics
Roy J. Carver Biotechnology Center
University of Illinois, Urbana-Champaign

330 ERML
1201 W. Gregory Dr.
Urbana, IL 61801
USA

ph: 217-244-7355
fax: 217-265-5066
e-mail: drnevich at uiuc.edu

```