[Bioperl-l] Editing sub locations

Jason Stajich jason at bioperl.org
Sat Oct 25 11:44:43 EDT 2008

you can replace the stored location for a SeqFeature like this:

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

More information about the Bioperl-l mailing list