bayesiandna-sequenceinformation-theoryprobability-distribution

Creating sequence logo for DNA aligned sequences


How to create a sequence logo for aligned DNA sequences? For the given sequences in Kevin Murphy book (chapter 2, figure 2.5), I am deriving logo using this wiki_link I am not getting expected results.

DNA Sequences:

  1. a t a g c c g g t a c g g c a
  2. t t a g c t g c a a c c g c a
  3. t c a g c c a c t a g a g c a
  4. a t a a c c g c g a c c g c a
  5. t t a g c c g c t a a g g t a
  6. t a a g c c t c g t a c g t a
  7. t t a g c c g t t a c g g c c
  8. a t a t c c g g t a c a g t a
  9. a t a g c a g g t a c c g a a
  10. a c a t c c g t g a c g g a a

Solution

  • You can do it using weblogo as added above, here is a little code to do it in python

    from Bio.Seq import Seq
    from Bio import motifs
    instances = df['binding'] #just input the list of DNA sequences 
    m = motifs.create(instances)
    m.weblogo('logo.png')
    

    Here you have to provide instances as list of DNA sequences and the result will be saved as logo.png or you may change the png to jpeg or tiff as you may want it.