error in enrichmentPlot() when providing a partially empty GO object
spribitzer opened this issue · 1 comments
spribitzer commented
I recently encountered an error during a call to 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$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 NA
s:
> 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
}
}
jianhong commented
Thank you for reporting this and kindly give the solutions. I will fix the issue as soon as possible.