[Bioperl-l] new/unannounced methods
Chris Fields
cjfields at uiuc.edu
Sat Mar 10 20:47:32 UTC 2007
On Mar 10, 2007, at 11:52 AM, Hilmar Lapp wrote:
>
> On Mar 9, 2007, at 9:55 PM, Chris Fields wrote:
>
>>> Is anyone out there currently working on this? If not I am
>>> volunteering.
>>> I'd like to move Bio::SeqUtils::trunc_with_features() and friends to
>>> Bio::SeqI::trunc(), etc.
>>
>> I don't think you'll hear too many protests if you want to take it
>> on. Just make sure to add decent tests as needed and document
>> everything (one lesson learned from all this!).
>>
>> The trunc() method is implemented in Bio::PrimarySeqI, so it probably
>> should stay there.
>
> Yes, but PrimarySeqI's don't have features.
>
> You could say that it may nevertheless know that there is a derived
> class of Seqs that do. However, why not override the method in, e.g.,
> Bio::SeqI, call the inherited function, and then add whatever is
> needed to truncate the features, too.
>
> -hilmar
Yes, that's true; it may make it simpler to keep that code confined
to SeqI. My point was that PrimarySeqI::trunc() already seems to
anticipate the object might be something else besides a simple
PrimarySeq so one could use isa->('FeatureHolderI') there:
...
my $seqclass;
if($self->can_call_new()) {
$seqclass = ref($self);
} else {
$seqclass = 'Bio::PrimarySeq';
$self->_attempt_to_load_Seq();
}
my $out = $seqclass->new( '-seq' => $str,
'-display_id' => $self->display_id,
'-accession_number' => $self->accession_number,
'-alphabet' => $self->alphabet,
'-desc' => $self->desc(),
'-verbose' => $self->verbose
);
return $out;
...
but it would be just as easy to do this in Bio::SeqI after calling
$self->SUPER::trunc().
chris
More information about the Bioperl-l
mailing list