Similarly to plotGeneralEnrichment and plotCommunitiesEnrichment, the results of the TF-based enrichment analysis are plotted. This function produces multiple plots. First, one plot per community to summarize the TF-specific enrichment. Second, a summary heatmap of all significantly enriched terms across all TFs and for the whole eGRN. The latter allows to compare the results with the general network enrichment. Third, a subset of the aforementioned heatmap, showing only the top most significantly enriched terms per TF and for the whole eGRN (as specified by nID) for improved visibility .

plotTFEnrichment(
  GRN,
  rankType = "degree",
  n = NULL,
  TF.IDs = NULL,
  topn_pvalue = 30,
  p = 0.05,
  nSignificant = 2,
  nID = 10,
  display_pAdj = FALSE,
  maxWidth_nchar_plot = 50,
  outputFolder = NULL,
  basenameOutput = NULL,
  plotAsPDF = TRUE,
  pdf_width = 12,
  pdf_height = 12,
  pages = NULL,
  forceRerun = FALSE
)

Arguments

GRN

Object of class GRN

rankType

Character. One of: "degree", "EV", "custom". This parameter will determine the criterion to be used to identify the "top" nodes. If set to "degree", the function will select top nodes based on the number of connections they have, i.e. based on their degree-centrality. If set to "EV" it will select the top nodes based on their eigenvector-centrality score in the network.

n

NULL or numeric. Default NULL. If set to NULL, all previously calculated TF enrichments will be plotted. If set to a value between (0,1), it is treated as a percentage of top nodes. If the value is passed as an integer it will be treated as the number of top nodes. This parameter is not relevant if rankType = "custom".

TF.IDs

NULL or character vector. Default NULL. For rankType="custom" the IDs of the TFs to plot. Ignored otherwise.

topn_pvalue

Numeric. Default 30. Maximum number of ontology terms that meet the p-value significance threshold to display in the enrichment dot plot

p

Numeric. Default 0.05. p-value threshold to determine significance.

nSignificant

Numeric > 0. Default 3. Threshold to filter out an ontology term with less than nSignificant overlapping genes.

nID

Numeric > 0. Default 10. For the reduced summary heatmap, number of top terms to select per community / for the general enrichment.

display_pAdj

TRUE or FALSE. Default FALSE. Is the p-value being displayed in the plots the adjusted p-value? This parameter is relevant for KEGG, Disease Ontology, and Reactome enrichments, and does not affect GO enrichments.

maxWidth_nchar_plot

Integer (>=10). Default 50. Maximum number of characters for a term before it is truncated.

outputFolder

Character or NULL. Default NULL. If set to NULL, the default output folder as specified when initiating the object in initializeGRN will be used. Otherwise, all output from this function will be put into the specified folder. If a folder is provided, while we recommend specifying an absolute path, a relative one also works.

basenameOutput

NULL or character. Default NULL. Basename of the output files that are produced. If set to NULL, a default basename is chosen. If a custom basename is specified, all output files will have the chosen basename as file prefix, be careful with not overwriting already existing files (if forceRerun is set to TRUE)

plotAsPDF

TRUE or FALSE. Default TRUE.Should the plots be printed to a PDF file? If set to TRUE, a PDF file is generated, the name of which depends on the value of basenameOutput. If set to FALSE, all plots are printed to the currently active device. Note that most functions print more than one plot, which means you may only see the last plot depending on your active graphics device.

pdf_width

Number>0. Default 12. Width of the PDF, in cm.

pdf_height

Number >0. Default 12. Height of the PDF, in cm.

pages

Integer vector or NULL. Default NULL. Page number(s) to plot. Can be used to plot only specific pages to a PDF or the currently active graphics device.

forceRerun

TRUE or FALSE. Default FALSE. Force execution, even if the GRN object already contains the result. Overwrites the old results.

Value

The same GRN object, without modifications.

Examples

# See the Workflow vignette on the GRaNIE website for examples
GRN = loadExampleObject()
#> Downloading GRaNIE example object from https://git.embl.de/grp-zaugg/GRaNIE/-/raw/master/data/GRN.rds
#> INFO [2023-08-16 17:29:50] Storing GRN@data$RNA$counts matrix as sparse matrix because fraction of 0s is > 0.1 (0.44)
#> Finished successfully. You may explore the example object. Start by typing the object name to the console to see a summaty. Happy GRaNIE'ing!
GRN = plotTFEnrichment(GRN, n = 5, plotAsPDF = FALSE, pages = 1)
#> INFO [2023-08-16 17:29:51] n = 5 equals finding the top 5 degree-central TFs in the network
#> INFO [2023-08-16 17:29:51]  Finished successfully. Execution time: 0.1 secs
#> INFO [2023-08-16 17:29:51] Plotting directly
#> INFO [2023-08-16 17:29:51]  Plotting results for ontology GO_BP
#> INFO [2023-08-16 17:29:51]   TF EGR1.0.A (ENSG00000120738)

#> INFO [2023-08-16 17:29:52]  Plotting results for ontology GO_MF
#> INFO [2023-08-16 17:29:52]  Finished successfully. Execution time: 1.2 secs