lawremi / ggbio

Grid and ggplot2 based visualization for biological data
111 stars 24 forks source link

No method or default for coercing "gg" to "ggORNULL" #94

Closed twooldridge closed 6 years ago

twooldridge commented 6 years ago

Hi,

As I was walking through some of the examples in the ggbio vignette, I quickly realized that I was unable to generate any of the example plots, and kept receiving the exact same error. For example, running:

set.seed(1)
N <- 100
gr <- GRanges(seqnames = sample(c("chr1", "chr2", "chr3"), size = N, replace = TRUE),
IRanges(start = sample(1:300, size = N, replace = TRUE), width = sample(70:75,
size = N, replace = TRUE)), strand = sample(c("+", "-", "*"), size = N,
replace = TRUE), value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),
sample = sample(c("Normal", "Tumor"), size = N, replace = TRUE), pair = sample(letters,
size = N, replace = TRUE))

ggplot(gr) + geom_rect()

produces this:

Error in as(slotVal, slotClass, strict = FALSE) : 
  no method or default for coercing "gg" to "ggORNULL"

This error appeared regardless of what sort of plot I tried to generate. I tried interpreting the traceback, but I couldn't figure it out:

10. stop(gettextf("no method or default for coercing %s to %s", dQuote(thisClass), dQuote(Class)), domain = NA)
9.  as(slotVal, slotClass, strict = FALSE)
8. initialize(value, ...)
7. initialize(value, ...)
6. (function (Class, ...) { ClassDef <- getClass(Class, where = topenv(parent.frame())) value <- .Call(C_new_object, ClassDef) ...
5. do.call(new, c(list("GGbio", ggplot = ggplot, data = data, fetchable = fetchable, blank = blank), args))
4. do.call(new, c(list("GGbio", ggplot = ggplot, data = data, fetchable = fetchable, blank = blank), args))
3. GGbio(gg, data = data)
2. ggplot.Vector(gr)
1. ggplot(gr)

I'm using ggplot version 2.2.1 and ggbio version 1.22.4. Thank you for your help!

twooldridge commented 6 years ago

This problem was solved by updating R to version 3.4, then installing the newest releases of ggplot2 and ggbio.