[Bioperl-l] Bio::SimpleAlign::order

Jason Stajich jason@chg.mc.duke.edu
Tue, 12 Jun 2001 08:55:47 -0400 (EDT)


Any problems with the following change over in Bio::SimpleAlign?
I'm currently getting unrelated errors from the in-progress changes to
LocateableSeq.

My comments are preceeded by a '#'

RCS file: /home/repository/bioperl/bioperl-live/Bio/SimpleAlign.pm,v
retrieving revision 1.25
diff -r1.25 SimpleAlign.pm

# change the invokation of from $self->{'_order'}->{$val}
# to $self->order($val)

# if you want to get the hash back just call $self->order with no args

# setting should only be done by the creating object IMHO so the
# SimpleAlign object will be read-only from the seq 'order' perspective
# okay?

408,410c408,410
<     foreach $order ( sort { $a <=> $b } keys %{$self->{'_order'}} ) {
<       if( exists $self->{'_seq'}->{$self->{'_order'}->{$order}} ) {
<           push(@arr,$self->{'_seq'}->{$self->{'_order'}->{$order}});
---
>     foreach $order ( sort { $a <=> $b } keys %{$self->order} ) {
>       if( exists $self->{'_seq'}->{$self->order->{$order}} ) {
>           push(@arr,$self->{'_seq'}->{$self->order->{$order}});

1169c1169
<     my $nse = $self->{'_order'}->{--$pos};
---
>     my $nse = $self->order->{--$pos};

# add the order method
1210a1211,1229
> 
> =head2 order
> 
>  Title   : order
>  Usage   : $obj->order($newval)
>  Function: returns the complete sequence order or a specific element
>  Returns : value of order either complete hash or a specific element
>  Args    : key to lookup
> 
> =cut
> 
> sub order{
>    my ($obj,$value) = @_;   
>    if( defined $value) {
>        return $obj->{'_order'}->{$value};
>    } else { 
>        return $obj->{'_order'};
>    }
>}


Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center 
http://www.chg.duke.edu/