lolaBarPlot: lolaBarPlot

View source: R/lolaUtils.R

lolaBarPlotR Documentation

lolaBarPlot

Description

plot a barplot of LOLA enrichment results

Usage

lolaBarPlot(
  lolaDb,
  lolaRes,
  scoreCol = "pValueLog",
  orderCol = scoreCol,
  signifCol = "qValue",
  includedCollections = c(),
  recalc = TRUE,
  pvalCut = 0.01,
  maxTerms = 50,
  colorpanel = sample(rainbow(maxTerms, v = 0.5)),
  groupByCollection = TRUE,
  orderDecreasing = NULL,
  appendTermDbId = TRUE
)

Arguments

lolaDb

LOLA DB object as returned by LOLA::loadRegionDB or loadLolaDbs

lolaRes

LOLA enrichment result as returned by the runLOLA function from the LOLA package

scoreCol

column name in lolaRes to be plotted

orderCol

column name in lolaRes which is used for sorting the results

signifCol

column name of the significance score in lolaRes. Should be one of c("pValueLog", "qValue")

includedCollections

vector of collection names to be included in the plot. If empty (default), all collections are used

recalc

recalculate adjusted p-value/q-value and ranks after the specified subsetting (by includedCollections)

pvalCut

p-value cutoff to be employed for filtering the results

maxTerms

maximum number of items to be included in the plot

colorpanel

colors to be used for coloring the bars according to "target" (see getTargetFromLolaDb). An empty vector indicates that black will be used for all bars.

groupByCollection

facet the plot by collection

orderDecreasing

flag indicating whether the value in orderCol should be considered as decreasing (as opposed to increasing). NULL (default) for automatic determination.

appendTermDbId

attach the index of the item in the LOLA DB object to the name of the set

Value

ggplot object containing the plot

Author(s)

Fabian Mueller

Examples


# example taken from RnBeads
library(RnBeads.hg19)
data(small.example.object)
logger.start(fname=NA)
# compute differential methylation
dm <- rnb.execute.computeDiffMeth(rnb.set.example,pheno.cols=c("Sample_Group","Treatment"))
# download LOLA DB
lolaDest <- tempfile()
dir.create(lolaDest)
lolaDirs <- downloadLolaDbs(lolaDest, dbs="LOLACore")
# perform enrichment analysis
res <- performLolaEnrichment.diffMeth(rnb.set.example,dm,lolaDirs[["hg19"]])
# select the 500 most hypermethylated tiling regions in ESCs compared to iPSCs
# in the example dataset
lolaRes <- res$region[["hESC vs. hiPSC (based on Sample_Group)"]][["tiling"]]
lolaRes <- lolaRes[lolaRes$userSet=="rankCut_500_hyper",]
# plot
lolaBarPlot(res$lolaDb, lolaRes, scoreCol="oddsRatio", orderCol="maxRnk", pvalCut=0.05)


demuellae/muRtools documentation built on Nov. 6, 2024, 9:44 a.m.