I have multiple character vectors containing gene names found in some analyzed samples (cells). I would like to compare those sets and figure out whether they have some genes in common (and if they do, I would like to know how many and which genes are overlapping between which sets). My goal is to visualize those data in some informative, reader-friendly manner. I decided to use upset plot, since the venn diagram for so many groups would be too messy.
Here is a dummy dataset containing 4 groups (although my real life data are >10):
lista <- list(cell_1 = c("Tmed9", "Lrp1", "Dlx3", "Igfbp2", "Ubl3", "Rab5b",
"Rab1b", "Ppm1g", "Drap1", "Matr3", "Exosc2", "Fstl1", "Rpl38",
"Sarnp", "Ppp4c", "Znhit1", "Fam20a", "Cnbp", "Rpl27", "Grb14",
"Gng11", "Cyfip1"), cell_2 = c("Tmed9", "Clec2d", "Cd74", "Uba5",
"Lars2", "mt-Co1", "mt-Co3", "Lax1", "Cnbp", "Insig1", "Eaf2",
"Pcbp2", "Top1", "Gm2000", "Rexo2", "Hnrnpa0", "Cox17", "Grk2",
"Vmp1", "1810037I17Rik", "Pim1", "Lmnb1", "Gm9844", "Eif4a3"),
cell_3 = c("Rab1b", "Lars2", "Rpl38", "Cnbp", "H2aj", "M6pr",
"B2m", "Il10ra", "H2-D1", "mt-Co3", "Cd74", "Pld4", "Ptp4a2",
"Pomp", "mt-Co1", "Ivns1abp", "Plac8", "Myl12b", "Rpl27",
"Eif3i", "Csk", "Rgs2", "mt-Cytb"), cell_4 = c("Spon1", "Phactr1",
"Lrp1", "Tmed9", "Cit", "Fads2", "Igfbp2", "Camk2b", "Ubqln2",
"Ddn", "Kifc2", "Ripor1", "Ubl3", "Rab1b", "Ppm1g", "Samd4b",
"Lrrc4b", "Cmtm5", "Git1", "Rph3a", "Matr3", "Pgp", "Fstl1",
"Nrgn"))
I want to use this nested list of gene names to create an upset plot in R.
Here is my example code:
library(UpSetR)
UpSetR::upset(fromList(lista), order.by = "freq",nintersects = NA,nsets = 4)
I would like to incorporate there, somehow, the actual gene labels, for instance "Tmed9" which contribute to the respective intersections, so I would not only know how many items are common between which sets, but also know which elements exactly are shared between the sets.
I did not find similar question on SO, did not find clues in the vignette nor on Github, so I am posting my question here.