Search code examples
rvenn-diagram

Compute a matrix comparison of lists with eVenn in R


I've got a number of lists with pairs of columns of intersecting elements, here supposing sets 1, 2, 3, that can have a 1-to-1, 1-to-many and many-to-many relationship:

df1 = data.frame(
    X1 = paste('set100',sample(10,8,replace=TRUE),sep=''),
    X2 = paste('set200',sample(10,8,replace=TRUE),sep='')
)

df2 = data.frame(
    X1 = paste('set100',sample(10,8,replace=TRUE),sep=''),
    X3 = paste('set300',sample(10,8,replace=TRUE),sep='')
)

df3 = data.frame(
    X2 = paste('set100',sample(10,8,replace=TRUE),sep=''),
    X3 = paste('set300',sample(10,8,replace=TRUE),sep='')
)

And I want to create a merged matrix of the two-column lists to use them as input for eVenn. In eVenn's 4-way example, the lists are already in an object like this:

> head(res3)
         liste_1_.194. liste_2_.149. liste_3_.366. Total_lists   ratios
10345445             1             0             0           1 2.159987
10345762             1             1             0           2 2.223848
10345791             1             1             1           3 2.519503
10345824             0             0             0           0       NA
10346191             0             0             0           0       NA
10346843             0             0             0           0       NA
           ratios    ratios
10345445       NA        NA
10345762 2.085687  2.264225
10345791 2.518024  2.668271
10345824       NA 36.246703
10346191       NA  2.527424
10346843       NA  3.852753

I want to be able to call the eVenn command on the merged data like this:

mergedmatrix <- create_the_merged_matrix_somehow(df1,df2,df3)
evenn(path_lists="test",res=mergedmatrix,ud=TRUE)

Any ideas?


Solution

  • Unfortunately your example is difficult to follow. I would suggest that you avoid using the eVenn package. The package documentation is very limited, and the examples are very cryptic. It does not produce a figure in the standard X11 (on unix systems) display, and will only print the results to file.

    I would suggest you consider the limma package, available from Bioconductor. It has functionality to make nice Venn diagrams. You can see some examples here.

    I guess that what you call create_the_merged_matrix_somehow() would be solved by vennCounts() in limma.