Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Functional Enrichment TSV Links to functional-enrichment.Rmd #389

Open
menoldmt opened this issue Aug 16, 2023 · 0 comments
Open

Add Functional Enrichment TSV Links to functional-enrichment.Rmd #389

menoldmt opened this issue Aug 16, 2023 · 0 comments

Comments

@menoldmt
Copy link
Contributor

Problem:

It would be convenient to have links to TSV files directly below functional enrichment plots. These files include dimensions, like GeneRatio, not otherwise shown in the plots.
 
Proposed Solution:

To ease data access, write enrichResults data to a file and add markdown links to the enrichResults TSV files below respective dotplot, emapplot, and cnetplots.
For this, introduce a function, print_table_link() here. This function will take the contrast 'name', the log fold change 'direction' and the 'ontology' from "enrich_list", save the file in the 'enrichResults/tables/' directory and generate relevant links as such:

   print_table_link <- function(name, direction, ont){
   # Make links to enrichResults table .tsv and all plots .pdf, and .png
   file_name_tsv <- paste0(name, '-', direction, '-', ont, '.tsv')
   dir.create('enrichResults/tables', recursive = TRUE)
   file_path_tsv <- file.path('enrichResults', 'tables', file_name_tsv)
   write.table(data.frame(enrich_list[[name]][[direction]][[ont]]),
     file = file_path_tsv,
     sep = "\t",
     quote = FALSE,
     row.names = FALSE,
     col.names = TRUE)

   mdcat('enrichResults data table:')
   mdcat('- [', file_name_tsv, ']', '(', file_path_tsv, ')')
 }

Add the following lines after here for dotplot for example:

       plot_type <- "dotplot"
       dotplot <- dotplot_list[[name]][[direction]][[ont]]
       print(dotplot)
       print_table_link(name, direction, ont)

File names should comprise of the contrast's 'name', 'direction' and 'ontology' used.
Call print_table_link() under each plot print statement to maintain appropriate links for each plot being printed here for dotplot, here for emapplot, and here for cnetplot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant