[Biopython] Bio.Motif search_pwm

Michiel de Hoon mjldehoon at yahoo.com
Thu Aug 2 13:27:56 UTC 2012


Hi all,

> > We could either use str(sequence) instead of
> > sequence.tostring() to cover both [plain strings and Seq objects]
> 
> That would also accept other objects accidentally, e.g. a
> list, and probably lead to some obscure errors downstream.
> 
> > or have the Seq class inherit from strings (which we
> > have been discussing for some time; see
> > https://redmine.open-bio.org/issues/2351).
> 
> Or perhaps the Seq is already string like enough for this
> function (it supports upper()) so no casting is needed?

This indeed works, so I simply removed the casting.

> Or, we could follow the pattern used in Bio.SeqUtils and try
> the tostring() method, catching any AttributeError and then
> treating it like a string (since real strings don't have
> this). The advantage of this route is low risk.

To avoid these kinds of complications, at some point we should really move forward to let Seq inherit from plain strings. We have been discussing this issue for five years now.

Best,
-Michiel.



More information about the Biopython mailing list