[Bioperl-l] PrimarySeq::length
Hilmar Lapp
hlapp@gnf.org
Fri, 11 Oct 2002 09:50:26 -0700
On Friday, October 11, 2002, at 02:16 AM, Ewan Birney wrote:
>
> I worry about this as I suspect that lots of programs make
> the not-unreasonable-assumption that a Bio::SeqI object has
> a seq() and length() returning sane stuff.
>
> Hmmm.... are we setting ourselves up to be burnt badly somewhere?
>
My view on this is to put a prominent caveat: if you set the length
we assume you know what you are doing. If you set the length to
something else than the seq's length, you're on your own. If you set
the seq to undef, a format writer may not work anymore as expected.
>
> (yeah, I know, the saving grace here is that a user really has to
> indicate that no sequence is parsed...)
>
Well, you can also just set it to undef and retain the length:
$seq->length($seq->length);
$seq->seq(undef);
May look scary to you ... This is useful for e.g. memory
conservation if really all you need to know about the actual
sequence is it's length (and you're juggling contigs). It is also
useful for serialization tasks; for example, we will want to not
upload the actual sequence string to biosql, but still want the
length in there.
I think if you are willing to go the extra mile you should be
allowed to push the system to its limits.
-hilmar
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------