问题
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?
回答1:
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.
回答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))];
回答3:
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
回答4:
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")
来源:https://stackoverflow.com/questions/37450698/the-output-order-of-function-calculate-overlap