Skip to content

Scale on ribbon #116

@Daniel-Ze

Description

@Daniel-Ze

Hi,
lately I have been playing around with the amazing gggenomes library. I'm interested in visualizing gene counts within non overlapping sliding windows. Similar to the GC content example in the documentation I wanted to plot the data in a ribbon above and below the chromosomes / genomic regions plus some extra ribbons representing alternative treatments.

Is there a way to show a scale next to the ribbons that I drew in this picture?

I know there are some overlaps that I still have to work out. The scale next to the ribbons would be one step closer to a perfect plot :) It would be amazing if someone could help me out with this!

Below is some example code to show how I generated the red ribbon plot. I added all the other ribbons in the same way adjusting their y value and their fill color.

seqs = fasta index file read in with read_fai()
mapping = paf file generated with minimap2 read in with read_paf()
gene_cluster = bed file with genes per window count read in with read_bed()

p1<-gggenomes(seqs = seqs, links = mapping)+
  geom_seq()+
  geom_link(aes(fill=blast, color=blast), alpha=0.8, offset = c(0.3, 0.3))+
p2<- p1 %>% add_feats(gene_cluster)+ 
  new_scale("color")+
  geom_ribbon(aes(x=(x+xend)/2, 
                  ymax=y, 
                  ymin=y-(0.03*score),
                  group=seq_id,
                  linetype="Genes"), 
              feats(gene_cluster),
              fill="red", 
              linetype=1,
              size=0.1,
              color="black",
              alpha=.5)

continuing like this for all the ribbons shown.

Cheers,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions