[Biopython-dev] why buffer in utils.count_monomers?

Iddo Friedberg idoerg at burnham.org
Mon Mar 15 17:37:28 EST 2004


Hi,

I tried the following (CVS version from last Friday, Python 2.2);
 >>> l = \ 
Seq.Seq('MINAIRTPDQRFSNLDQYPFSPNYLDDLPGYPGLRAHYLDEGNSDAEDVFLCLHGEPTWS',IUPAC.protein)
 >>>
 >>> utils.count_monomers(l)

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/home/iddo/biopy_cvs/biopython/Bio/utils.py", line 64, in 
count_monomers
     dict[c] = string.count(s, c)
   File "/usr/lib/python2.2/string.py", line 161, in count
     return s.count(*args)
AttributeError: 'buffer' object has no attribute 'count'

when I replaced the variable "s" in line 64 in utils.py with "seq.data" 
everything worked fine. In line 62 "s" is defined as:
s=buffer(seq.data)

Does that serve a purpose? Can we do without it, (meaning I deposit the 
bugfix) or is it important?

thanks,

Iddo




Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/home/iddo/biopy_cvs/biopython/Bio/utils.py", line 64, in 
count_monomers
     dict[c] = string.count(s, c)
   File "/usr/lib/python2.2/string.py", line 161, in count
     return s.count(*args)
AttributeError: 'buffer' object has no attribute 'count'




-- 
Iddo Friedberg, Ph.D.
The Burnham Institute
10901 N. Torrey Pines Rd.
La Jolla, CA 92037
USA
Tel: +1 (858) 646 3100 x3516
Fax: +1 (858) 713 9930
http://ffas.ljcrf.edu/~iddo




More information about the Biopython-dev mailing list