[Bioperl-l] PrimarySeq POD changes

Chris Fields cjfields at uiuc.edu
Wed Sep 27 17:46:21 EDT 2006


> 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;

That way no one is lying or going blind!

Christopher Fields
Postdoctoral Researcher - Switzer Lab
Dept. of Biochemistry
University of Illinois Urbana-Champaign



More information about the Bioperl-l mailing list