函数calculate.overlap的输出顺序

时间:2016-05-26 02:45:38

标签: r venn-diagram

我正在使用" calculate.overlap" R包中的功能" VennDiagram"。我将以下四组数据进行比较:

library(VennDiagram)

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

输出文件"重叠"由15个列表组成。他们被称为:

$a6, a12, a11...  

我如何知道哪个列表属于哪个比较?

4 个答案:

答案 0 :(得分:3)

用红色数字1-15替换x中的overlap[[x]],您可以获得维恩图中特定位置的完整感兴趣基因列表。

此外,您可以使用length()函数获取基因数量。

enter image description here

答案 1 :(得分:1)

对不起,我需要指出这是错误的,可能会产生误导。我在下面提出了正确的答案:

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))];

答案 2 :(得分:0)

万一有人需要其他方式来完成此操作,我已经说明了如何使用nVennR列出所有区域in another post

答案 3 :(得分:0)

我有同样的问题。必须手动通过一个reprex来映射到哪个。除了@seanyun之外。

此代码将重命名列表,以使它们更有意义。

#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")