[Biopython-dev] Sequence object allows non-alphabet characters

Eric Talevich eric.talevich at gmail.com
Tue Dec 20 00:49:28 UTC 2011


On Mon, Dec 19, 2011 at 6:02 AM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

> On Mon, Dec 19, 2011 at 12:49 PM, Markus
> <Markus.Piotrowski at ruhr-uni-bochum.de> wrote:
> >
> > What about an additional optional option in the sequence object
> > like "validate=True/False" with false as default. This would not
> > break existing code, will not influence speed (if validate=False)
> > but gives the possibility to have the sequence validated against
> > the selected alphabet.
>
> That could work, although there would still be trivial speed impact
> (the extra if statement), but it shouldn't really hurt. However, most
> Seq objects are created not directly by the user, but via SeqIO.
> I suppose that could get another argument for Seq construction...
>
>
As another alternative, you could add a method Seq.validate() which must be
called separately. Then you'd have a way to trigger validation even after
directly setting seq.data or .alphabet.

-E



More information about the Biopython-dev mailing list