[BioC] Extracting genes within venn diagram

Celine Carret ckc at sanger.ac.uk
Thu Nov 6 17:04:19 CET 2008

Thank you all for your advices and explanations
It's clear now.
Best wishes

-----Original Message-----
From: Jenny Drnevich [mailto:drnevich at illinois.edu] 
Sent: 06 November 2008 16:01
To: James W. MacDonald; Celine Carret
Cc: bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] Extracting genes within venn diagram

Hi Celine,

There's also the old-fashion way of subsetting by hand. The object of 
class "TestResults" created by decideTests() is simply a matrix of 
-1, 0, and 1, so you can use == to find the genes you are interested in:

results <- decideTests(fit2)

fit2$genes[results[,2] != 0 & results[,3] == 0 , ]
# This should give you the 43 genes

fit2$genes[results[,2] == 0 & results[,3] != 0 ,]
# This should give you the 58 genes

Subsetting this way will give you exactly what you want, although it 
can get a bit complicated once you start getting into 3 contrasts or 
more. I'll remember to use the affycoretools:::makeIndices in the

>Most likely what you want here is
>alls <- affycoretools:::makeIndices(results[,2:3], "both")
>as the default for vennCounts() is "both" (and you have implicitly 
>called vennCounts() in your call to vennDiagram()).

What Jim is referring to here is that the default of "both" counts a 
gene in both lists even if it is significantly up in one list but 
significantly down in the other list. Jim thought it makes more sense 
to only count a gene in both lists if it is changing in the same 
direction, and so wrote functions in affycoretools that have "same" 
as the default rather than "both". This explains the difference in 
the numbers. Personally, the genes that change in opposite directions 
might even be more interesting, and so I use a combination of "both" 
and "same" to see if there are any.


>>>alls.genes <- lapply(alls, function(x) row.names(results[,2:3])[x])
>>[[1]] gives 56 genes
>>[[2]] gives 71 genes
>>[[3]] gives 669 genes
>>Shouldn't I get [[1]] 43; [[2]] 58 and [[3]] 682?
>>I will be grateful for any help or advice on this matter.
>>Best wishes
>>Here is my R session info
>>R version 2.8.0 (2008-10-20) i386-pc-mingw32
>>LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
>>Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>>attached base packages:
>>[1] splines   tools     stats     graphics  grDevices utils
>>methods   base
>>other attached packages:
>>  [1] affycoretools_1.14.0 annaffy_1.14.0       KEGG.db_2.2.5
>>gcrma_2.14.1         matchprobes_1.14.0
>>  [6] biomaRt_1.16.0       GOstats_2.8.0        Category_2.8.0
>>genefilter_1.22.0    survival_2.34-1
>>[11] RBGL_1.18.0          annotate_1.20.0      xtable_1.5-4
>>GO.db_2.2.5          RSQLite_0.7-1
>>[16] DBI_0.2-4            AnnotationDbi_1.4.0  graph_1.20.0
>>affy_1.20.0          limma_2.16.2
>>[21] Biobase_2.2.0
>>loaded via a namespace (and not attached):
>>[1] affyio_1.10.1        cluster_1.11.11      GSEABase_1.4.0
>>preprocessCore_1.4.0 RCurl_0.91-0
>>[6] XML_1.94-0.1
>James W. MacDonald, M.S.
>Hildebrandt Lab
>1150 W. Medical Center Drive
>Ann Arbor MI 48109-0646
>Bioconductor mailing list
>Bioconductor at stat.math.ethz.ch
>Search the archives: 

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

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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 

05/11/2008 17:36

 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE.

More information about the Bioconductor mailing list