thackl / gggenomes

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

geom_feat size and position not responding #132

Closed TomasaSbaffi closed 1 year ago

TomasaSbaffi commented 2 years ago

Hello, thanks for the amazing tool!

I am having a issue with the tutorial that I am adapting to my needs. The geom_feat function from ggplot/gggenomes is not applying the size and position arguments in the way I set them, here for ex. I set the size=8 and position="pile" but it just doesn't show. I attach the code I used and the output I get, I am sure I am making some mistakes! Thanks a lot

library(thacklr)
library(gggenomes)
library(tidyverse)

p7 <- gggenomes(seqs=emale_seqs_6, genes=emale_genes, feats=list(emale_tirs), links=emale_links) %>%
  add_feats(emale_gc) %>%
  add_clusters(emale_cogs) %>%
  add_feats(emale_transposons) %>%
  add_subfeats(emale_blast, .transform="aa2nuc") %>%
  flip(3:5) +
  geom_feat(aes(color="integrated transposon"),
            feats(emale_transposons), size=7) +
  geom_seq() + geom_bin_label() +
  geom_link(offset = c(0.3, 0.2), color="white", alpha=.3) +
  geom_feat(size=8, aes(color="terminal inverted repeat"), data=feats(emale_tirs)) +
  geom_gene(aes(fill=cluster_label)) +
  geom_feat(size=8, position="pile", aes(color=blast_desc), feats(emale_blast)) + 
  geom_ribbon(aes(x=(x+xend)/2, ymax=y+.24, ymin=y+.38-(.4*score),
                  group=seq_id, linetype="GC-content"), feats(emale_gc),
              fill="blue", alpha=.5) +
  scale_fill_brewer("Conserved genes", palette="Set3") +
  scale_color_viridis_d("Blast hits & Features", direction = -1) +
  scale_linetype("Graphs") +
  ggtitle(expression(paste("Endogenous mavirus-like elements of ",
                           italic("C. burkhardae"))))

p7

p7

thackl commented 2 years ago

Hi Tomi,

impressive that you got this far with my outdated example (sorry for that). And great that you noticed the problem. I think it's related to ggplots latest v.3.4.0 upgrade which introduces linewidth to replace size for line-type geoms. geom_feat is pretty much ggplot::geom_segment. I'll look at the code later today and try to upload a fix.

TomasaSbaffi commented 1 year ago

Hello, just checking up on this one, did you manage to fix this issue? my easy fix is to downgrade my ggplot, just for now!

thackl commented 1 year ago

Fixed with 9f1560ba5dca3c3f2ed0c5933035798eca1f1085