Extract Genes from ggvenn
1
0
Entering edit mode
2.6 years ago
axe880 • 0

Hi there,

Here is my script for generating a Venn diagram:

vennlistUp <- list( "Control" = UPDEGsTRCSRCgenes,
                    "40-min" = UPDEGsTR40SR40genes,
                    "120-min" = UPDEGsTR120SR120genes,
                    "Recovery" = UPDEGsTRRSRRgenes)

vennlistUp_venn <- ggvenn(vennlistUp, fill_color = c("orange", "#0073C2FF", "#EFC000FF", "#868686FF"), 
                      stroke_size = 1, set_name_size = 8, text_size = 5)
vennlistUp_venn*

This works well and shows what I want it to.

My issue is, I need to extract the gene ID's that are shared across three time points: 40-min, 120-min, and Recovery. I do not want to observe the genes that overlap with the control.

Is there a method of doing this? I understand the intersect function can intersect the genes, but I seem to only be able to do this for all 4 time points at once.

Any help is appreciated, thanks!

ggvenn • 2.0k views
ADD COMMENT
0
Entering edit mode
2.6 years ago
Michael 55k
intersect(intersect(UPDEGsTRRSRRgenes, UPDEGsTR120SR120genes), UPDEGsTR40SR40genes)

This should do it.

ADD COMMENT
0
Entering edit mode

Thank you but I think I tried this to no avail. If I show you my diagram:

enter image description here

I am trying to look at the 89 genes. This is because there is no overlap with the control. When I tried the suggested command, I instead got a number which included both the 89 and the 627, where 627 is the genes seen across all 4 points.

So, in theory, my problem is my inability to remove the 627 genes from the 89.

Is there any solution you could perhaps suggest for this?

Thanks again.

ADD REPLY
3
Entering edit mode

So you want the intersection of 40min,120min, Recovery, but not those genes that are also in the control? I might have overread this, but set operators in R are very powerful, so:

 setdiff (intersect(intersect(UPDEGsTRRSRRgenes, UPDEGsTR120SR120genes), UPDEGsTR40SR40genes),  UPDEGsTRCSRCgenes)

will remove the control genes from the intersection. Hope this works out

ADD REPLY
0
Entering edit mode

Worked perfect - appreciate the help.

ADD REPLY

Login before adding your answer.

Traffic: 2047 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6