[Bioperl-l] PROPOSED new method Bio::Range->offsetStranded

Chris Fields cjfields at uiuc.edu
Wed Jan 10 16:10:21 UTC 2007


Malcolm,

I don't have a problem with it.  Just curious, but what would it be used
for?

chris

> Hi,
> 
> I'd like to commit changes to Bio::RangeI which defined 
> offsetStranded to allows the following tests to pass in Bio/Range.t
> 
> $r = Bio::Range->new(-start => 30, -end => 40, -strand => 
> -1); ok ($r->offsetStranded(-5,10)->toString, '(20, 45) 
> strand=-1'); ok ($r->offsetStranded(+5,-10)->toString, '(30, 
> 40) strand=-1'); $r->strand(1); ok 
> ($r->offsetStranded(-5,10)->toString, '(25, 50) strand=1'); 
> ok ($r->offsetStranded(+5,-10)->toString, '(30, 40) strand=1');
> 
> 
> Here's the implementation.
> 
> =head2 offsetStranded
> 
>     Title    : offsetStranded
>     Usage    : $rnge->ofsetStranded($fiveprime_offset,
> $threeprime_offset)
>     Function : destructively modifies RangeI implementing object to
>                offset its start and stop coordinates by 
> values $fiveprime_offset and
>                $threeprime_offset (positive values being in 
> the strand direction).
>     Args     : two integer offsets: $fiveprime_offset and
> $threeprime_offset
>     Returns  : $self, offset accordingly.
> 
> =cut
> 
> sub offsetStranded {
>   my ($self, $offset_fiveprime, $offset_threeprime) = @_;
>   my ($offset_start, $offset_end) = $self->strand() eq -1 ? 
> (- $offset_threeprime, - $offset_fiveprime) : 
> ($offset_fiveprime, $offset_threeprime);
>   $self->start($self->start + $offset_start);
>   $self->end($self->end + $offset_end);
>   return $self;
> };
> 
> 
> I'll commit tomorrow unless I'm told 'that would be a mistake'.
> 
> Cheers,
> 
> --Malcolm
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list