[Bioperl-l] Editing sub locations

Cristián Serpell cserpell at dim.uchile.cl
Mon Oct 27 12:30:56 UTC 2008


Thanks

It seems that  location replacing such as in $feature->location 
($newlocation); was added in a newer version, and I was looking an  
older API. It worked.

Cristián
El 25-10-2008, a las 12:44, Jason Stajich escribió:

> you can replace the stored location for a SeqFeature like this:
> $feature->location($newlocation);
>
> You can also update the values for a sub location with this because  
> you have access to a reference to each of the individual sublocations
>
> Try this out (also added this example to http://bioperl.org/wiki/ 
> Module:Bio::Location::Split )
> #!/usr/bin/perl -w
> use Bio::Location::Split;
> use Bio::Location::Simple;
>
> my $split = Bio::Location::Split->new;
> $split->add_sub_Location(Bio::Location::Simple->new(-start => 1, - 
> end => 20,
> 						    -strand => 1));
> $split->add_sub_Location(Bio::Location::Simple->new(-start => 25, - 
> end => 35,
> 						    -strand => 1));
>
> print $split->to_FTstring(),"\n";
> for my $subloc ( $split->each_Location ) {
>   $subloc->start($subloc->start + 1001);
>   $subloc->end($subloc->end + 1001);
> }
>
> print $split->to_FTstring(),"\n";
>
> On Oct 24, 2008, at 10:50 AM, Cristián Serpell wrote:
>
>> Hi
>>
>> I would like to know if there is a way to edit a sub location from  
>> a Bio::Location::Split object, through the API.
>>
>> For example, you can get an array with $subloc = $location- 
>> >sub_Location(), and then modify it with $subloc->start($subloc- 
>> >start() + 1), but this does not change the original sub location.  
>> IF you get the array, you get the same original values (the same  
>> object).
>>
>> One idea I have got is to create a new Bio::Location::Split object  
>> and adding the modified sub locations, but then I don't know if  
>> you can change the Bio::SeqFeature location manually, even when  
>> creating a new one.
>>
>> The whole thing I'm doing is a program that "moves" an object,  
>> adding the same value to start and end values to everything.
>>
>> Any idea would help
>>
>> Thanks
>> Cristián
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> Jason Stajich
> jason at bioperl.org
>
>
>
>
> _______________________________________________
> 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