[BioPython] sequence logo with biopython

bartek wilczynski bartek at rezolwenta.eu.org
Tue Sep 18 19:09:29 EDT 2007


Giovanni Marco Dall'Olio <dalloliogm at gmail.com>:

> ok, thank you.
> 
> so, let's see if I understand how to use it:
> 
> from Bio.Seq import Seq
> from Bio.AlignAce.Motif import Motif
> 
> m = Motif()
> m.add_instance(Seq('ACTG'))
> m.add_instance(Seq('ACCG'))
> m.add_instance(Seq('ACTC'))
> 
> m.search_instance(Seq('ACACGACAACGTGTCGAT'))
> 
> m.weblogo('/home/user/logo.png')
> 

You got it mostly right. However, the .search_instance() and .search_pwm()
methods return generators, so you should rather use:

for pos,instance in m.search_instance(sequence):
    print "found %s at %d"%(instance,pos)

> 
> Well, about refactoring.... honestly I think it would be a good idea.
> The problem is that for example, I have never used AlignAce and I
> don't know which kind of program is it... so I feel a bit confusing to
> import a module called like this.

The basic idea is to create a new Motif class aggregating the good parts of the
AlignAce and MEME versions and modify these modules so they would use the new
class. I'll try to look into that next week. I also have some code for reading
modules from the JASPAR database and motif comparisons. I'll try to clean it up
ands submit as well. Then we could try to come up with a section in the tutorial
devoted to motif analysis. If you have anything you would consider useful in the
Motif library, let me know.

> Anyway the Motif class seems useful, and I will use it in my program..
> problably I will have to ask a few questions on it in the next days!
> :)

No problem, I'll do my best to answer your questions. However I'm leaving
tomorrow for the CMSB conference, so I may be slow at responding to email this
week.

-- 
cheers
   Bartek


More information about the BioPython mailing list