从韦恩图的每个区域提取数值。

huangapple go评论114阅读模式
英文:

Extract values from each region of a venn diagram

问题

从韦恩图的每个区域提取数值。

我有6个列表。每个列表都包含特定状况下感兴趣的基因。然后使用这六个列表在R中使用venn包制作了一个Venn图。

这个Venn图正是我想要的,但现在我想生成一个包含Venn图中每个部分基因的列表。我该怎么做?即如何找出我的列表中构成每个列表/条件中存在的1251个基因的基因?

  1. library(venn)
  2. venn_list_no <- list(pt_v_lb = rownames(pt_v_lb_no), lbdm_v_lb = rownames(lbdm_v_lb_no), ptdm_v_lb = rownames(ptdm_v_lb_no), lbdm_v_pt = rownames(lbdm_v_pt_no), ptdm_v_pt = rownames(ptdm_v_pt_no), ptdm_v_lbdm = rownames(ptdm_v_lbdm_no))
  3. venn(venn_list_no, zcolor = "style", ggplot = T, opacity = 0.2, box = F)+
  4. theme()
英文:

从韦恩图的每个区域提取数值。

I have 6 lists. Each contains genes of interest from a given condition. These six lists were then used to make a venn diagram in r using the venn package.

The venn diagram is precisely what I want, but now I would like to produce a list of genes from each section of the venn diagram. how do I do this? i.e. how do I figure out what genes from my lists comprise the 1251 genes that are present in each list/condition?

  1. library(venn)
  2. venn_list_no <- list(pt_v_lb = rownames(pt_v_lb_no), lbdm_v_lb = rownames(lbdm_v_lb_no), ptdm_v_lb = rownames(ptdm_v_lb_no), lbdm_v_pt = rownames(lbdm_v_pt_no), ptdm_v_pt = rownames(ptdm_v_pt_no), ptdm_v_lbdm = rownames(ptdm_v_lbdm_no))
  3. venn(venn_list_no, zcolor = "style", ggplot = T, opacity = 0.2, box = F)+
  4. theme()

答案1

得分: 0

我查看了包的源代码,但我找不到任何文档化的用于提取区域元素的函数。实际上,venn 函数不返回任何内容,因此你无法进行检查。你可能想尝试使用我的 nVennR 包。目前该包在 CRAN 上不可用,但你可以通过以下命令从 Github 安装它:devtools::install_github("vqf/nVennR")。以下是一个示例:

  1. >library(nVennR)
  2. >myV <- plotVenn(list(set1=c(1, 2, 3), set2=c(2, 3, 4), set3=c(3, 4, 5, 'a', 'b'), set4=c(5, 6, 1, 4)))
  3. [![在此输入图片描述][1]][1]
  4. >getVennRegion(myV, c('set2', 'set3', 'set4'))
  5. [1] 4
  6. >getVennRegion(myV, c('set3'))
  7. [1] "a" "b"
  8. >listVennRegions(myV)
  9. $`0, 0, 0, 1 (set4)`
  10. [1] 6
  11. $`0, 0, 1, 0 (set3)`
  12. [1] "a" "b"
  13. $`0, 0, 1, 1 (set3, set4)`
  14. [1] 5
  15. $`0, 1, 1, 1 (set2, set3, set4)`
  16. [1] 4
  17. $`1, 0, 0, 1 (set1, set4)`
  18. [1] 1
  19. $`1, 1, 0, 0 (set1, set2)`
  20. [1] 2
  21. $`1, 1, 1, 0 (set1, set2, set3)`
  22. [1] "3"
  23. 你可以在 [vignette][2] 中找到更多示例。
  24. [1]: https://i.stack.imgur.com/i17x2.png
  25. [2]: https://mran.microsoft.com/snapshot/2022-01-07/web/packages/nVennR/vignettes/nVennR.html
  26. <details>
  27. <summary>英文:</summary>
  28. I have had a look at the package source and I cannot see any documented function to extract the elements in a region. In fact, the `venn` function does not return anything, so there is nothing you can check.
  29. You might want to try my `nVennR` package for that. At this time it is not available in CRAN, but you can install it from Github with `devtools::install_github(&quot;vqf/nVennR&quot;)`. An example:
  30. &gt;library(nVennR)
  31. &gt;myV &lt;- plotVenn(list(set1=c(1, 2, 3), set2=c(2, 3, 4), set3=c(3, 4, 5, &#39;a&#39;, &#39;b&#39;), set4=c(5, 6, 1, 4)))
  32. [![enter image description here][1]][1]
  33. &gt;getVennRegion(myV, c(&#39;set2&#39;, &#39;set3&#39;, &#39;set4&#39;))
  34. [1] 4
  35. &gt;getVennRegion(myV, c(&#39;set3&#39;))
  36. [1] &quot;a&quot; &quot;b&quot;
  37. &gt;listVennRegions(myV)
  38. $`0, 0, 0, 1 (set4)`
  39. [1] 6
  40. $`0, 0, 1, 0 (set3)`
  41. [1] &quot;a&quot; &quot;b&quot;
  42. $`0, 0, 1, 1 (set3, set4)`
  43. [1] 5
  44. $`0, 1, 1, 1 (set2, set3, set4)`
  45. [1] 4
  46. $`1, 0, 0, 1 (set1, set4)`
  47. [1] 1
  48. $`1, 1, 0, 0 (set1, set2)`
  49. [1] 2
  50. $`1, 1, 1, 0 (set1, set2, set3)`
  51. [1] &quot;3&quot;
  52. You can see more examples at the [vignette][2].
  53. [1]: https://i.stack.imgur.com/i17x2.png
  54. [2]: https://mran.microsoft.com/snapshot/2022-01-07/web/packages/nVennR/vignettes/nVennR.html
  55. </details>

huangapple
  • 本文由 发表于 2023年4月17日 11:24:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76031519.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定