gaospecial / ggVennDiagram

A 'ggplot2' implement of Venn Diagram.
https://gaospecial.github.io/ggVennDiagram/
GNU General Public License v3.0
277 stars 37 forks source link

ggVennDiagram plot and Upset plots to show count of ALL common genes shared at every Group intersection (new useful Feature?) #64

Closed sfd99 closed 5 months ago

sfd99 commented 7 months ago

Hi Chun-Hui !

Really like ggVennDiagram !

QUICK & SIMPLE ggVennDiagram Test w / 4 groups: A, B, C, D. Each group: 5 genes.

  A <-  c("VT","LF","DI","TU","HY" )
  B <-  c("ZT","TU","AL","UF","QT" )
  C <-  c("ZT","VT","LF","TU","QT" ) 
  D <-  c("XX","DI","YY","LF","RW" )

 input <- list( A, B, C, D)

# assign group names to input list!...
 names(input) <-  c("A", "B", "C", "D")

 input
$A
[1] "VT" "LF" "DI" "TU" "HY"

$B
[1] "ZT" "TU" "AL" "UF" "QT"

$C
[1] "ZT" "VT" "LF" "TU" "QT"

$D
[1] "XX" "DI" "YY" "LF" "RW"

Now do 2 color plots and Upset plot, using ggVennDiagram():

 ggVennDiagram::ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple"))

 # plus onHover Plot...
 ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple") , show_intersect = TRUE  )

venn = Venn(input)
plot_upset(venn)
image image

A suggested USEFUL and important additional plot Option for the Venn Plot ggVennDiagram() command:

It would be VERY nice to generate a Venn diagram that shows in each plot intersection, the same count results as the base::intersect() function for that intersection: (maybe an extra T/F argument to the plot function?...).

ie:
base::intersect(A,C) [1] "VT" "LF" "TU"

So... the Count: 3 would be shown in the plot for the A:C intersection. These 3 genes are shared by both A and C..

Similarly, for all the other group intersections in the Venn plot.

Count values for all possible intersections of A, B, C, D!.

What is your opinion?. Hope you like the idea!.

**SFd99 San Francisco latest Rstudio ggVennDiagram PKG version 1.5.1 Ubuntu LINUX 20.0.4

gaospecial commented 7 months ago

Thanks for your issue. We add this feature in https://github.com/gaospecial/ggVennDiagram/commit/3fe7e848b3477dd509eba4ca07f1428ec4035b00

Install the dev version, and try it again.

A <-  c("VT","LF","DI","TU","HY" )
B <-  c("ZT","TU","AL","UF","QT" )
C <-  c("ZT","VT","LF","TU","QT" )
D <-  c("XX","DI","YY","LF","RW" )
input <- list( A, B, C, D)
names(input) <-  c("A", "B", "C", "D")
venn = Venn(input)
plot_upset(venn) -> p1
plot_upset(venn, specific = FALSE) -> p2
aplot::plot_list(p1,p2, ncol = 1, labels = c("specific ON","specific OFF"))

image

If you have feedback, just let me know.

BTW, check our Venn Calculator at https://gaospecial.github.io/ggVennDiagram/articles/VennCalculator.html

sfd99 commented 7 months ago

Wow, Chun-Hui ! version 1.5.2... That was really quick.

The upset plot is great with the new specific = T/F option:

venn = Venn(input) plot_upset(venn) venn = Venn(input) plot_upset(venn, specific = F)

Q: Will you also add the specific = F option for ggVennDiagram() ? :

 ggVennDiagram::ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple"),  **specific = F**)

 # and also the great onHover Plot...?.
 ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple") , show_intersect = TRUE,  **specific = F** )
gaospecial commented 7 months ago

Wow, Chun-Hui ! version 1.5.2... That was really quick.

The upset plot is great with the new specific = T/F option:

venn = Venn(input) plot_upset(venn) venn = Venn(input) plot_upset(venn, specific = F)

Q: Will you also add the specific = F option for ggVennDiagram() ? :

 ggVennDiagram::ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple"),  **specific = F**)

 # and also the great onHover Plot...?.
 ggVennDiagram(input, category.names = names(input),set_color = c("blue","red","green","purple") , show_intersect = TRUE,  **specific = F** )

Venn diagram show all subsets at a time, so I hardly find a way to show non-specific items in the plot.

sfd99 commented 7 months ago

Hi Chun-Hui,

Just to let you know, as you suggested - your Venn Calculator is REALLY nice, too... :-)

Q: can we have an extra argument specific = T/F or BOTH to Fx: venn_region()
so that its shows either:

Again, BOTH counts would be really helpful to many people, in this your example R statement:

venn_region(pd) |> dplyr::rowwise() |> dplyr::mutate(item = paste0(item, collapse = ", "))

A tibble: 15 × 4

Rowwise:

id name item count

1 1 A "HY" 1 2 2 B "AL, UF" 2 3 3 C "" 0 4 4 D "XX, YY, RW" 3 5 1/2 A/B "" 0 6 1/3 A/C "VT" 1 7 1/4 A/D "DI" 1 8 2/3 B/C "ZT, QT" 2 9 2/4 B/D "" 0 10 3/4 C/D "" 0 11 1/2/3 A/B/C "TU" 1 12 1/2/4 A/B/D "" 0 13 1/3/4 A/C/D "LF" 1 14 2/3/4 B/C/D "" 0 15 1/2/3/4 A/B/C/D "" 0
gaospecial commented 7 months ago

glad to know.  Happy Chinese Loong year 在 2024年2月10日,上午4:25,sfd99 @.***> 写道: Hi Chun-Hui, Just to let you know, as you suggested your Venn Calculator is REALLY nice, too... :-)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

sfd99 commented 7 months ago

Happy Chinese Loong year to you too, Chun-Hui. Very best!.