BioinformaticsFMRP / TCGAbiolinks

TCGAbiolinks
http://bioconductor.org/packages/devel/bioc/vignettes/TCGAbiolinks/inst/doc/index.html
284 stars 109 forks source link

Which genes are in each GO termn #589

Open Jomagrax opened 1 year ago

Jomagrax commented 1 year ago

I have performed GO enrichment and obtained the barplot, I was wondering if it is possible to obtain the list of the genes present in each Go term

Thanks in advance

tiagochst commented 1 year ago

You can access the objects with the genes as following:

TCGAbiolinks:::DAVID_MF_matrix %>% as_tibble() TCGAbiolinks:::DAVID_CC_matrix %>% as_tibble() TCGAbiolinks:::listEA_pathways %>% as.tibble() TCGAbiolinks:::DAVID_BP_matrix %>% as_tibble()

[image: Screenshot 2023-07-05 at 12.07.03 PM.png]

On Wed, Jul 5, 2023 at 10:51 AM Jomagrax @.***> wrote:

I have performed GO enrichment and obtained the barplot, I was wondering if it is possible to obtain the list of the genes present in each Go term

Thanks in advance

— Reply to this email directly, view it on GitHub https://github.com/BioinformaticsFMRP/TCGAbiolinks/issues/589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQ6NLBQYGVQXM6KZGN4LXOV5OBANCNFSM6AAAAAAZ7CLFMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jomagrax commented 12 months ago

Thanks Tiago,

With you answer I was able to produce what I needed

Here you have an example for the "Biological Process" GO term Genelist is produced as in here

# Download genes in each GO class
TCGAbiolinks:::DAVID_MF_matrix %>% as_tibble()
TCGAbiolinks:::DAVID_CC_matrix %>% as_tibble()
TCGAbiolinks:::listEA_pathways %>% as_tibble()
bp_DB <- TCGAbiolinks:::DAVID_BP_matrix %>% as_tibble()

## Go terms present in the barplot have to  be introduced manually
GO <- c("nuclear division","mitosis")

bp_DEG <- bp_DB  %>%
   mutate(DavidBP = sub("^.{11}", "", DavidBP))     %>%  
   filter(DavidBP %in% GO ) %>%               # Application of separate_rows() function
   separate_rows(Molecules, sep=",") %>%
   mutate(Molecules = sub("^.{1}", "", Molecules)) %>% 
   filter(Molecules %in% Genelist) %>%   
   as.data.frame()