[BioPython] sequence logo with biopython

Robert Campbell robert.campbell at queensu.ca
Wed Sep 19 13:32:14 UTC 2007


On Wed, 19 Sep 2007 01:09:29 +0200, bartek wilczynski
<bartek at rezolwenta.eu.org> wrote:

> 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)

I believe that should be "m.search_instances(sequence)" not
"m.search_instance(sequence)"  (i.e. "instances", plural).

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821            Fax: 613-533-2497
<robert.campbell at queensu.ca>    http://pldserver1.biochem.queensu.ca/~rlc



More information about the Biopython mailing list