[Bioperl-l] change the location coordinates of a Bio::SeqFeat ureI object

Peili Zhang peili at morgan.harvard.edu
Thu Jun 26 09:46:12 EDT 2003


Hi Jason & Marc,

thanks for your messages. some questions about your code are embedded below.


>We separated Locations from SeqFeature a while a go so you can whole
>replace the location object for a feature
>$sf->location( $newlocation )
>or manipulate the fields directly, etc...
>$sf->location->start($newstart);

I understand this will work just fine for features with simple locations.

>> First check what kind of feature you have to deal wiht: split or not split
>> and adjust appropriately. This sub should do the job when passed a feature
>> object (reference).
>> sub adjust_location {
>>     my ( $sf, $cutoff ) = @_;
>>     my $loc = $sf->location;
>
>with newer bioperl code you can in fact replace this with
>#     if ( $loc->can('sub_Location') ) {
>#         foreach my $sl ( $loc->sub_Location ) {
>     foreach my $sl ( $loc->each_Location ) {
>
>             my $newstart = $sl->start + $cutoff;
>             my $newend   = $sl->end + $cutoff;
>             $sl->start($newstart), $sl->end($newend);

this changes the $sl object. does it change $loc, $sf->location, and the 
Bio::Seq object ($seq) hosting $sf? seems to me $sf is a separate object from 
$seq. so is $loc from $sf, and $sl from $loc. it seems to me that even if I can 
change the derived objects any way I want, the objects I'm deriving from just 
stay intact. this is why I asked my question at the first place. do I get it 
wrong completely?

thanks,
Peili
>         }
>#     }
>#     else {
>#         my $newstart = $loc->start + $cutoff;
>#         my $newend   = $loc->end + $cutoff;
>#        $loc->start($newstart), $loc->end($newend);
>#     }
>>
>> }
>> HTH,
>> Marc
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>--
>Jason Stajich
>Duke University
>jason at cgt.mc.duke.edu



More information about the Bioperl-l mailing list