[Bioperl-l] Bio::Coordinate::Pair

Heikki Lehvaslaiho heikki at sanbi.ac.za
Mon Aug 4 06:42:57 UTC 2008


Prashanth,

Your example coordinates do not do the conversion but more or less report the 
locations of your features in some third coordinates.

The way to think coordinates pairs is to use them as HSPs. You tell the pair 
object what is the matching segment in the pair of sequences.


The synopsis in Bio::Coordinate::Pair class file gives the following example:


use Bio::Location::Simple;
use Bio::Coordinate::Pair;

my $match1 = Bio::Location::Simple->new
    (-seq_id => 'propeptide', -start => 21, -end => 40, -strand=>1 );
my $match2 = Bio::Location::Simple->new
    (-seq_id => 'peptide', -start => 1, -end => 20, -strand=>1 );
my $pair = Bio::Coordinate::Pair->new(-in => $match1,
				      -out => $match2
    );
# location to match
$pos = Bio::Location::Simple->new
    (-start => 25, -end => 25, -strand=> -1 );

$res = $pair->map($pos);
print $res->match->start; # 5


In other words, region 25-40 in the propeptide matches locations 1-20 in the 
final peptide. Therefore conversion from 25 gives 5:

     signalp        21  25             40
--------------------|---|--------------|
                    1   5  pep         20

I hope this clarifies it.

The advantage of using these objects over manual conversion is that the code 
has been debugged (no all too easy +/-1 errors) and that they can be chained 
together.

Yours,

      -Heikki




On Tuesday 29 July 2008 22:07:55 Prashanth Athri wrote:
> Dear Professor Lehvaslaiho:
>
> I had a quick question about the module- Bio::Coordinate::Pair
>
> The BioPerl tutorial has the following example:
>
> $input_coordinates = Bio::Location::Simple->new
> (-seq_id => 'propeptide', -start => 1000, -end => 2000, -strand=>1 );
>
> $output_coordinates = Bio::Location::Simple->new
> (-seq_id => 'peptide', -start => 1100, -end => 2100, -strand=>1 );
>
> $pair = Bio::Coordinate::Pair->new
> (-in => $input_coordinates , -out => $output_coordinates );
>
> $pos = Bio::Location::Simple->new (-start => 500, -end => 500 );
>
> $res = $pair->map($pos);
> $converted_start = $res->start;
>
> The way I understand it, $converted_start should return ³1600². But when I
> run this snippet, it returns ³500². Could you please let me know how
> $pair->map($pos) is processed?
>
> I appreciate your time and thanks in advance.
>
> Regards,
> Prashanth



-- 
______ _/      _/_____________________________________________________
      _/      _/
     _/  _/  _/  Heikki Lehvaslaiho    heikki at_sanbi _ac _za
    _/_/_/_/_/  Senior Scientist    skype: heikki_lehvaslaiho
   _/  _/  _/  SANBI, South African National Bioinformatics Institute
  _/  _/  _/  University of Western Cape, South Africa
     _/      Phone: +27 21 959 2096   FAX: +27 21 959 2512
___ _/_/_/_/_/________________________________________________________




More information about the Bioperl-l mailing list