#' Plot mechanism of action
#'
#' @param dsea is dsea object which is the output of the function getActiveDSEA()
#' @param ntop the number of the top enteries (genes or drug), ntop = 16 as a default value
#'
#' @return plot of mechanism of action
#' @export
#' @import utils
#' @import graphics
#'
#' @examples # from the data-sets provided as examples within the package load the .rda files
#' # DrugsAnnot, mDrugEnrich, mFC
#' dsea <- getActiveDSEA(mDrugEnrich, DrugsAnnot, mFC, contr = colnames(mFC)[1])
#' plotMOA(dsea)
plotMOA <- function(dsea, ntop = 16) {
moa <- getMOA(dsea)
res <- moa$drugClass
jj <- unique(c(utils::head(order(-res$NES), ntop), utils::tail(order(-res$NES), ntop)))
moa.top <- res$NES[jj]
names(moa.top) <- res$pathway[jj]
par(mfrow = c(2, 1), mar = c(3.5, 4, 3.5, 3.5), mgp = c(2.5, 1, 0.5), cex=1)
graphics::barplot(moa.top,
horiz = FALSE, las = 3,
ylab = "Enrichment score (NES)",
main = "Mechanism of action",
cex.names = 1.1
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.