-
Notifications
You must be signed in to change notification settings - Fork 17
Description
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