Closed olekto closed 2 years ago
Try geom_wiggle()
. It's a wrapper around ribbon that is much easier to use with gggenomes data.
The issue with your ribbon example is how you refer to the GC data. When adding to the gggenomes object, you are labeling the track with a track_id. In your case the track_id is "feats" because you wrote `"feats"=emale_gc. You need to use this track_id when referring to the data
p <- gggenomes(seq=emale_seqs, links=emale_ava, feats=emale_gc) +
geom_seq() +
geom_bin_label() +
geom_link()
p %>% track_info() # show tracks with track_ids
p + geom_ribbon(aes(x=(x+xend)/2, ymax=y+.24, ymin=y+.38-(.4*score), group=seq_id),
feats()) ## default feat track name for feats is "feats"
# Alternatively feats with custom different track_id
gggenomes(seq=emale_seqs, links=emale_ava, feats=list(emale_gc)) +
geom_ribbon(aes(x=(x+xend)/2, ymax=y+.24, ymin=y+.38-(.4*score), group=seq_id),
feats(emale_gc) ## emale_gc added with track name "emale_gc"
Thank you!
And thank you for the prompt answer.
Ole
Hi, I feel a stupid asking this, because this is likely an R issue, and not necessary gggenomes. What I want to do is to plot something similar to the GC plot from the example, the geom_ribbon. I've tried trimming down the example to just the seqences, links and the GC ribbon, but I get an error.
I basically want this, and then add ribbon:
Adding
to that example doesn't work (Error: Can't convert a
spec_tbl_df/tbl_df/tbl/data.frame
object to a string). I'm not fluent in R, and have to wrangle with it every time I need to do something a bit more complicated. I might be getting old, but it is not straight forward to understand the error messages and the language itself.Any help would be highly appreciated.
Thank you.
Ole