Closed spribitzer closed 2 years ago
I recently encountered an error during a call to enrichmentPlot():
enrichmentPlot()
> x <- getEnrichedGO(annotatedPeakList, orgAnn="org.Hs.eg.db", condense=TRUE) > enrichmentPlot(x) Error in `[.data.frame`(.ele, !is.na(.ele$pvalue), c(cn.id, cn.term, "pvalue", : undefined columns selected
Upon investigation I noticed that one of the list items in x was an empty dataframe:
x
> x$mf [1] go.id go.term Definition Ontology count.InDataset [6] count.InGenome pvalue totaltermInDataset totaltermInGenome EntrezID <0 rows> (or 0-length row.names)
I could successfully plot with enrichmentPlot() by adding a row of NAs:
NA
> x$mf[nrow(x$mf)+1,] <- NA > enrichmentPlot(x)
It might be worth adding a test for an empty df into enrichmentPlot(), e.g. similar to this:
for (item in c("bp", "mf", "cc")) { if (nrow(x[[item]]) == 0) { x[[item]][nrow(x[[item]])+1,] <- NA } }
Thank you for reporting this and kindly give the solutions. I will fix the issue as soon as possible.
I recently encountered an error during a call to
enrichmentPlot()
:Upon investigation I noticed that one of the list items in
x
was an empty dataframe:I could successfully plot with
enrichmentPlot()
by adding a row ofNA
s:It might be worth adding a test for an empty df into
enrichmentPlot()
, e.g. similar to this: