[Bioperl-l] zero length sequence in PrimarySeq
Hilmar Lapp
hilmarl@yahoo.com
Wed, 14 Mar 2001 09:08:34 -0800
Heikki Lehvaslaiho wrote:
>
> If you reset the sequence of a PrimarySeq to a zero length after first
> setting it to some value and you had not set moltype, method _guess_type
> got called and threw an exception. I've now fixed it in both 07 branch and
> main trunk by conditionally calling _guess_type only if the sequence ne ''.
>
> One could argue that one should always set the moltype but I think that is
> expecting a bit too much from a casual user.
>
> One alternative would be for _guess_type to silently do nothing rather than
> throw an exception.
>
> If you feel that some other implementation of the fix is better than the
> one I did, feel free to change the code, but please keep the functionality.
>
I have to admit that I am not happy with this change. It renders
the sequence object in an undetermined state, because then there
is no way to find out what type of sequence it is, which is
against the API definition.
So, I suggest to do one of the following:
1) Change the API definition of moltype() such that there is an
additional type 'unknown' allowed.
2) Change the code such that it retains the last active moltype if
the sequence is reset to zero length. (This then still requires a
moltype be supplied at initialization with a zero length seq,
which I'm a strong supporter of.)
I'd rather prefer option 2), because it seems cleaner to me, and I
don't see the use case that really needs option 1).
What do you think?
Hilmar
--
-----------------------------------------------------------------
Hilmar Lapp email: hlapp@gmx.net
GNF, San Diego, Ca. 92122 phone: +1 858 812 1757
-----------------------------------------------------------------
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com