[BioC] Extracting elements from a table with VennCounts

James W. MacDonald jmacdon at uw.edu
Tue Apr 17 17:17:03 CEST 2012


Hi Leonor,

On 4/17/2012 5:19 AM, lcarvalh at btk.fi wrote:
>
> I have a table in this format that comes from the function vennCounts:
>
>        c1 c2 c3 c4 Counts
>   [1,]  0  0  0  0     26
>   [2,]  0  0  0  1     27
>   [3,]  0  0  1  0      4
>   [4,]  0  0  1  1      6
>   [5,]  0  1  0  0      5
>   [6,]  0  1  0  1     12
>   [7,]  0  1  1  0     42
>   [8,]  0  1  1  1     78
>   [9,]  1  0  0  0     18
> [10,]  1  0  0  1     52
> [11,]  1  0  1  0      4
> [12,]  1  0  1  1     63
> [13,]  1  1  0  0     13
> [14,]  1  1  0  1     47
> [15,]  1  1  1  0     88
> [16,]  1  1  1  1    182
> attr(,"class")
> [1] "VennCounts"
>
>
> I am trying to write a R script that will "extract" from the table for example
> the cases that have c2==1, (c2 and c3)== 1, (c2 and c4)==1, (c1 and c2 and
> c3)==1, and so on ... so that in the end I will have a list that has the Counts
> value for each case.
>
> Example list for columns that have c2 == 1: C2<-c(4, 42, 12, ...)
>
> I tried to it on this way: totalC2<-table[table[c1]], also if I use table$c1 ==
> 1 it is not working.
>
> Can anyone give-me a suggestion how to solve this problem?

I'm not sure that I understand exactly what you want. You say you want a 
list of counts for each case, yet the VennCounts object that you show 
above has just that.

However, maybe in fact what you want is a list of say TRUE/FALSE that 
indicates if a given gene is in a particular cell of the Venn diagram. 
If that is what you want, then you could use the makeIndices() function 
in affycoretools.

Note that this function isn't designed for end users; instead it is a 
helper function for vennSelect(), which goes one step further and 
outputs annotated tables for each cell of a Venn diagram, which may 
actually what you are after. The makeIndices() function is buried in the 
affycoretools namespace, so you have to use the triple colon operator to 
get to it. An example would be

rslt <- decideTests(fit)
indlst <- affycoretools:::makeIndices(rslt)

Also note that makeIndices() has a method argument. See ?vennSelect for 
possible values for this argument.

Best,

Jim


>
> Thank you,
>
> Leonor
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list