[Bioperl-l] PrimarySeq POD changes

Sendu Bala bix at sendu.me.uk
Wed Sep 27 23:03:19 UTC 2006


Chris Fields wrote:
>> Jason Stajich wrote:
>>> http://lists.open-bio.org/pipermail/bioperl-guts-l/2006-
>> September/023408.html
>>>
>>> This is wrong. Bio::PrimarySeq does take named  arguments - look at the
>>> actual method code.
>> I did look at the method code:
>>
>> sub seq {
>>     my ($obj, at args) = @_;
>>
>>     if( scalar(@args) == 0 ) {
>>         return $obj->{'seq'};
>>     }
>>
>>     my ($value,$alphabet) = @args;
>>
>>     if(@args) {
>>         if(defined($value) && (! $obj->validate_seq($value))) {
>> 	   $obj->throw(" [...]
>>
>>
>> Unless I'm being blind, if the first argument supplied to the method
>> isn't something that validates as a sequence, it throws. How can it
>> accept named args? Or, where is the code that works out what named args
>> have been supplied?
>>
>> The new() method accepts named args if that's what you meant, but I
>> didn't change the docs for new().
> 
> This could be changed to accept either named arguments and regular
> arguments, just like the docs state:
> 
>     my ($value,$alphabet) = $self->_rearrange([qw(SEQ ALPHABET)], @args);
> 
>     my $old_api = (!(grep {$_ =~ /(?:seq|alphabet)/} @args)) ? 1 : 0;
>     ($value, $alphabet)  = @args if $old_api;

Well, this new feature could be added of course, but it overcomplicated 
things for a two argument method. I don't think we should slow things 
down with a _rearrange call, especially in PrimarySeq seq() which must 
get called a hell of a lot.

Also, the reason I was looking at this in the first place is that I'm 
inheriting and partially overriding it, so the simpler its inputs are 
the better.



More information about the Bioperl-l mailing list