thackl / gggenomes

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

flip_seqs ignores .bin #77

Closed thackl closed 3 years ago

thackl commented 3 years ago

The three flip operations should be equivalent, but the last one actually gives the same result as flip_seqs(2)...

s0 <- tibble(
bin_id = c("A", "B", "B", "B", "C", "C", "C"),
seq_id = c("a1","b1","b2","b3","c1","c2","c3"),
length = c(1e4, 6e3, 2e3, 1e3, 3e3, 3e3, 3e3))

p <- gggenomes(seqs=s0) +
  geom_seq(aes(color=bin_id), size=1, arrow = arrow(angle = 30, length = unit(10, "pt"),
      ends = "last", type = "open")) +
  geom_bin_label() + geom_seq_label() +
  expand_limits(color=c("A","B","C"))

p %>% flip_seqs(6)
p %>% flip_seqs(c2)
p %>% flip_seqs(2, .bins = C)