thackl / gggenomes

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

unexpected error on example data #181

Closed Jigyasa3 closed 1 month ago

Jigyasa3 commented 2 months ago

Dear @iimog @raynamharris @thackl @nschan @thomase4

Thanks again for a great package! I am using it for the first time so may be I am doing something wrong, but I am unable to run the example plot in the vignette https://thackl.github.io/gggenomes/articles/gggenomes.html

example-

library(gggenomes)

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

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

l0 <- tibble::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)
)

plot-

p <- gggenomes::gggenomes(genes=g0, seqs=s0, links=l0)
p + 
  geom_seq() +         # draw contig/chromosome lines
  geom_seq_label() +   # label each sequence 
  geom_gene() +        # draw genes as arrow
  geom_link()          # draw some connections between syntenic regions

all loaded packages-

(.packages()) [1] "gggenomes" "tidyr" "readr" "ggplot2" "stringr" "dplyr" "stats" "graphics" "grDevices" "utils" "datasets" [12] "methods" "base"

ggenomes version-

gggenomes version 0.9.12.9000

error-

Only sawtype=NAin genes and will treat everything astype="CDS". Error in guides$setup(scales, aesthetics, default = params$guide_default %||% : attempt to apply non-function

iimog commented 2 months ago

Hi @Jigyasa3 I just had the same error. In my case updating both ggplot and the dependencies solved the problem:

devtools::install_github("thackl/gggenomes")

When asked

These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                            
2: CRAN packages only             
3: None                           
4: stringi (1.8.3 -> 1.8.4) [CRAN]
5: munsell (0.5.0 -> 0.5.1) [CRAN]
6: gtable  (0.3.4 -> 0.3.5) [CRAN]
7: readr   (2.1.4 -> 2.1.5) [CRAN]
8: tidyr   (1.3.0 -> 1.3.1) [CRAN]
9: ggplot2 (3.5.0 -> 3.5.1) [CRAN]

I entered 1 to update all of them. Then, after restarting R, everything worked again. Hope that helps.