[Bioperl-l] PrimarySeq::length

Lincoln Stein lstein@cshl.org
Fri, 11 Oct 2002 09:12:50 -0400


A nice feature with a lot of rope to hang ourselves with.

I'm leary to make it possible for length() to return one value, and seq() to 
return a string that has a different length.   I think it's ok to be able to 
set the length attribute in the virtual sequence situation where seq() is 
going to return undef -- although I don't remember how this discussion 
resolved -- but not ok in the real sequence case unless you're also willing 
to perform a truncation operation on the underlying sequence string.

Lincoln

On Friday 11 October 2002 03:34 am, Hilmar Lapp wrote:
> I changed this to possibly function as a real attribute. I.e., you
> can set a value and it will then return this value in get mode. (If
> you don't set a value it will still report the length of what seq()
> returns.)
>
> This is useful especially if you don't want to keep the actual
> sequence around (for memory efficiency for instance, or because you
> told the SeqBuilder not to parser the sequence). To this end, there
> is now also a parameter -length you can supply to new().
>
> I also changed seq() such that it allows setting to undef. Note that
> if you set seq to something not undef and different from the
> previous value, a previously set length() attribute will be
> invalidated (you need to set it again if you still want it).
>
> There was discussion a while ago regarding PrimarySeqIs without a
> sequence (VirtualSeq, EmptySeq, etc) ... I'm not convinced we need a
> separate class to allow this, but people should note that a format
> writer is not required to be able to cope with an empty sequence.
>
> 	-hilmar