R/plotreact.R

Defines functions plotreact

Documented in plotreact

#' rnareactplot function
#'
#' Uses ReactomePA to find enriched pathways from the RNAseq differential gene analysis
#'
#' @param react data frame generated by rnareact function
#' @param deg data frame generated by rnadeg function
#' @param graph character(1) type of graph to plot, (dot, map, cnet)
#' @param n numeric(1) number of pathways to plot
#'
#' @import gage
#' @import data.table
#' @import ReactomePA
#' @import DOSE
#'
#' @return dotplot or enrichment pathway or cnetmap of Reactome gene sets
#'
#' @examples
#' data(skcm)
#' gene <- "SOX10"
#' sox10.pat <- rnasubset(pat, rna, gene, 10)
#' sox10.deg <- rnadeg(sox10.pat, rna)
#' sox10.react <- rnareact(sox10.deg)
#' plotreact(sox10.react, sox10.deg, "dot", 15)
#' plotreact(sox10.react, sox10.deg, "map", 15)
#' plotreact(sox10.react, sox10.deg, "cnet", 5)
#'
#' @export
#'
plotreact <- function(react, deg, graph, n) {
  switch(graph,
         "dot" = dotplot(react, showCategory=n),
         "map" = enrichMap(react, n=n, layout=igraph::layout.kamada.kawai, vertex.label.cex = 1),
         "cnet" = cnetplot(react, showCategory = n, categorySize="pvalue", foldChange=deg$logFC))
}
pcheng84/TCGAbrowser documentation built on Sept. 7, 2021, 8:28 p.m.