Plotting a “sequence logo” using ggplot2?

前端 未结 6 2073
无人共我
无人共我 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 20:54

    No direct way to do so in ggplot2, as far as I'm concerned.

    However, check out RWebLogo. It's an R wrapper I have written for the WebLogo python library. You can download it from CRAN and it's hosted on github

    Simple example:

    # Load package
    library('RWebLogo')
    
    # Sample alignment
    aln <- c('CCAACCCAA', 'CCAACCCTA', 'AAAGCCTGA', 'TGAACCGGA')
    # Plot logo to file
    weblogo(seqs=aln, file.out='logo.pdf')
    
    # Plot logo to R graphics device (uses generated jpeg logo and raster package)
    weblogo(seqs=aln, plot=TRUE, open=FALSE, format='jpeg', resolution=600)
    

    For more options see ?weblogo or ?plotlogo

提交回复
热议问题