thackl / gggenomes

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

flip_by_links() is not working #112

Closed xvtyzn closed 10 months ago

xvtyzn commented 2 years ago

Hi

I have observed a different behavior regarding flip_by_links() than before. I'm sorry if it's my mistake.

library(gggenomes)

# to inspect the example data shipped with gggenomes
data(package="gggenomes")

gggenomes(emale_genes, emale_seqs, emale_tirs, emale_ava) %>%
  add_feats(ngaros=emale_ngaros, gc=emale_gc) %>%
  add_sublinks(emale_prot_ava) %>%
  flip_by_links() +
  geom_feat(position="identity", size=6) +
  geom_seq() +
  geom_link(data=links(2)) +
  geom_bin_label() +
  geom_gene(aes(fill=name)) +
  geom_gene_tag(aes(label=name), nudge_y=0.1, check_overlap = TRUE) +
  geom_feat(data=feats(ngaros), alpha=.3, size=10, position="identity") +
  geom_feat_note(aes(label="Ngaro-transposon"), feats(ngaros),
                 nudge_y=.1, vjust=0) +
  geom_ribbon(aes(x=(x+xend)/2, ymax=y+.24, ymin=y+.38-(.4*score),
                  group=seq_id, linetype="GC-content"), feats(gc),
              fill="lavenderblush4", position=position_nudge(y=-.1)) +
  scale_fill_brewer("Genes", palette="Dark2", na.value="cornsilk3")

image

Also, it seems that flip_by_links() is not working in the official references.

I appreciate any help you can provide.

Keigo

thackl commented 2 years ago

I can confirm that this is a bug. It seems to be related to providing both seqs and genes at the same time. Otherwise flip_by_links seems to work fine. Unfortunately, I haven't gotten to the bottom of the problem yet...