[BioPython] Making the Seq object act more like a string

Michiel de Hoon mdehoon at c2b2.columbia.edu
Mon Sep 10 00:04:28 UTC 2007


Peter wrote:
> I would like to make the following "small" change now, ready for the 
> next release of Biopython:
> 
> (1) Make __str__ give the full sequence as a string for Seq and
>     MutableSeq objects, allowing intuitive use of str(myseq) which
>     used to give a truncated representation including the alphabet.

Note that the __str__ is used to create the output of "print myseq", 
where myseq is a Seq object. So if __str__ returns the full sequence 
string, then "print myseq" will print the full sequence. This is not 
necessarily what you want. In essence, the str() function and the 
.tostring() method have different functions. So I think we should not 
drop .tostring() in favor of str().

Moreover, this problem will go away if and when a Seq object subclasses 
from a string object. Then, we won't need a Seq-to-string function at all.

--Michiel.



More information about the Biopython mailing list