thackl / gggenomes

A grammar of graphics for comparative genomics
https://thackl.github.io/gggenomes/
Other
606 stars 65 forks source link

Error in `geom_link()`: #131

Closed fhu2008 closed 2 years ago

fhu2008 commented 2 years ago

Hello, and thanks for an awesome tool!

I have a question regarding geom_link. when geom_link() was added, the errores were showed. Could you help me fix this.

Thanks in advance!

----sample data (R.version 4.2.0)

s0 <- tibble( seq_id = c("a", "b"), length = c(600, 550) )

g0 <- tibble( seq_id = c("a", "a", "b"), start = c(50, 350, 80), end = c(250, 500, 450) )

l0 <- tibble( seq_id = c("a", "a"), start = c(50, 400), end = c(250, 480), seq_id2 = c("b", "b"), start2 = c(80, 350), end2 = c(300, 430) )

p <- gggenomes(genes=g0, seqs=s0, links=l0) p + geom_seq() +
geom_seq_label() +
geom_gene() +

-----ok

when added geom_link() ,

Error in geom_link(): ! Problem while converting geom to grob. i Error occurred in the 4th layer. Caused by error in link_to_poly(): ! object 'new_data_frame' not found Run rlang::last_error() to see where the error occurred

Backtrace:

  1. base (local) <fn>(x)
  2. ggplot2:::print.ggplot(x)
  3. ggplot2:::ggplot_gtable.ggplot_built(data)
  4. ggplot2:::by_layer(...)
    1. ggplot2 (local) f(l = layers[[i]], d = data[[i]])
    2. l$draw_geom(d, layout)
    3. ggplot2 (local) draw_geom(..., self = self)
    4. self$geom$draw_layer(...)
    5. ggplot2 (local) draw_layer(..., self = self)
    6. base::lapply(...)
    7. ggplot2 (local) FUN(X[[i]], ...)
    8. self$draw_panel(data, panel_params, coord, offset = <dbl>)
    9. gggenomes (local) draw_panel(..., self = self)
    10. base::lapply(...)
    11. gggenomes (local) FUN(X[[i]], ...)
    12. gggenomes:::link_to_poly(...) Run rlang::last_trace() to see the full context.
FWittmers commented 2 years ago

Hi, I can't help with this, but I did run into the same exact error just now. I tried a few things but couldn't figure out what's going wrong...

thackl commented 2 years ago

Hi, thanks for reporting. Unfortunately, I cannot reproduce this issue on my system, which makes it a bit tricky to debug. Could you send me the output of sessionInfo() after loading gggenomes?

thackl commented 2 years ago

OK, I think I found the issue. In the latest ggplot2 v3.4.0 release, the function ggplot2:::new_data_frame() has been removed. I'll try to upload a fix later today

FWittmers commented 2 years ago

Hi, thanks for the swift response. If you still would like me to get you the sessionInfo I can do that, but looks like you know what's going on already. Thanks again!

thackl commented 2 years ago

Ok, should be fixed by https://github.com/thackl/gggenomes/commit/f70d3fae346d9494f453ddf11f9393a04c649674. Let me know if you still have problems after updating the package.

fhu2008 commented 2 years ago

It still doesn't work after updating the package., the errors information are the same as before. However, it works when I change the ggplot2 version from 3.4 to 3.0.0 . many thanks.

FWittmers commented 2 years ago

For me reinstalling the package fixed this bug, no need to change my ggplot2 version. Thanks for the quick fix!