Plotting a “sequence logo” using ggplot2?

前端 未结 6 2072
无人共我
无人共我 2020-12-02 20:24

Is it (reasonably) possible to plot a sequence logo plot using ggplot2?

There is a package to do it which is based on \"grid\" called \"seqLogo\", but I was wonderin

6条回答
  •  鱼传尺愫
    2020-12-02 21:06

    There is now a gglogo package (also on CRAN, yet another amazing ggplot2 extension by Heike Hofmann).

    This package that produces plots like these:

    library(ggplot2)
    library(gglogo)
    ggplot(data = ggfortify(sequences, "peptide")) +      
      geom_logo(aes(x=position, y=bits, group=element, 
         label=element, fill=interaction(Polarity, Water)),
         alpha = 0.6)  +
      scale_fill_brewer(palette="Paired") +
      theme(legend.position = "bottom")
    

    The example is from https://github.com/heike/gglogo/blob/master/visual_test/logos.R and there's a manuscript on the package here: https://github.com/heike/logopaper/blob/master/logos.Rmd

提交回复
热议问题