The output order of function calculate.overlap
Asked Answered
M

4

8

I am using "calculate.overlap" function in R package "VennDiagram". I am comparing four sets of data as following:

library(VennDiagram)

overlap=calculate.overlap(
    x=list(
        "1"=1,
        "2"=2,
        "3"=3,
        "4"=4
    )
) 

The output file "overlap" consists of 15 lists. They are called:

$a6, a12, a11...  

How do I know which list belongs to which comparison?

Matrona answered 26/5, 2016 at 2:45 Comment(0)
M
4

By replacing x in overlap[[x]] with red number 1-15, you can get a complete list of genes of interest at the specific location in Venn diagram.

Also, you can get the numbers of genes by using length() function.

enter image description here

Matrona answered 26/5, 2016 at 3:29 Comment(1)
I am having the same issue and your solution looks elegant. How did you get the red numbers 1-15 to graph on this Venn Diagram?Marksman
A
2

Sorry, I need to point out that it is wrong and could be misleading. I've oulined the correct answer below:

a6  = n1234;
a12 = n123[-which(n123 %in% a6)];
a11 = n124[-which(n124 %in% a6)];
a5  = n134[-which(n134 %in% a6)];
a7  = n234[-which(n234 %in% a6)];
a15 = n12[-which(n12 %in% c(a6,a11,a12))];
a4  = n13[-which(n13 %in% c(a6,a5,a12))];
a10 = n14[-which(n14 %in% c(a6,a5,a11))];
a13 = n23[-which(n23 %in% c(a6,a7,a12))];
a8  = n24[-which(n24 %in% c(a6,a7,a11))];
a2  = n34[-which(n34 %in% c(a6,a5,a7))];
a9  = A[-which(A %in% c(a4,a5,a6,a10,a11,a12,a15))];
a14 = B[-which(B %in% c(a6,a7,a8,a11,a12,a13,a15))];
a1  = C[-which(C %in% c(a2,a4,a5,a6,a7,a12,a13))];
a3  = D[-which(D %in% c(a2,a5,a6,a7,a8,a10,a11))];
Araujo answered 8/3, 2017 at 17:47 Comment(0)
Z
0

In case somebody needs a different way to do this, I have explained how to use nVennR to list all the regions in another post

Zalea answered 9/4, 2019 at 10:4 Comment(0)
H
0

I had this same issue. Had to manually go through a reprex to map which goes to which. Slight addition to @seanyun.

This code will rename the lists so that they make more sense.

#for a 3-way overlap
>names(overlap) <- c("a123", "a12", "a13", "a23", "a1", "a2", "a3")

#for a 4-way overlap
>names(overlap) <- c("a1234", "a123", "a124", "a134", "a234", "a12", "a13", "a14", "a23", "a24", "a34", "a1", "a2", "a3", "a4")
Hough answered 13/9, 2019 at 20:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.