[Bioperl-l] Coordinate converter?
Dan Bolser
dan.bolser at gmail.com
Wed Jul 14 16:33:47 UTC 2010
Brilliant! Thanks Jason.
I found the example in the docs a bit confusing, so here is my version
(hopefully to be built into an AGP object):
#!/usr/bin/perl -w
use Bio::Location::Simple;
use Bio::Coordinate::Pair;
my $ctg = Bio::Location::Simple->
new( -seq_id => 'ctg', -start => 1, -end => 999, -strand => +1 );
my $ctg_on_chr = Bio::Location::Simple->
new( -seq_id => 'chr', -start => 2001, -end => 2999, -strand => -1 );
my $agp = Bio::Coordinate::Pair->
new( -in => $ctg,
-out => $ctg_on_chr
);
my $match_on_ctg = Bio::Location::Simple->
new( -seq_id => 'hit', -start => 25, -end => 125, -strand => +1 );
print_loc( $agp->map( $match_on_ctg ) );
which gives: "chr 2875 2975 -1"
I know the algorithm is simple, but it's not so simple to type it out,
base perfect and bug free every time you need it.
Cheers,
Dan.
On 13 July 2010 23:41, Jason Stajich <jason at bioperl.org> wrote:
> Bio::Coordinate::Pair?
>
>
> Dan Bolser wrote, On 7/13/10 10:15 AM:
>>
>> Hi,
>>
>> When one sequence exists in the context of another larger sequence
>> (with a precise start, end and strand), what is the easiest way to
>> convert coordinates between the two sequences?
>>
>> I'm guessing there is an object I can load with the appropriate
>> information with a conversion method? However, I'm stuck for details.
>>
>> I have implemented sub-sequences as features, but I'm not sure what to do
>> next.
>>
>> Thanks for any hints,
>> Dan.
>>
>>
>> irc://irc.freenode.net/#bioperl
>> _______________________________________________
>> 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