Module Discussion:Bio::Coordinate::Pair

From BioPerl
Jump to: navigation, search

Here is a simple test script:

#!/usr/bin/perl -w
 
## Stress test Bio::Coordinate::Pair
 
use strict;
use Data::Dumper;
 
use Bio::Location::Simple;
use Bio::Coordinate::Pair;
 
## A contig
my $ctg = Bio::Location::Simple->
  new( -seq_id => 'ctg',
       -start  =>    1,
       -end    => 1001,
       -strand =>   +1,
     );
 
## The contigs position on a chromosome (forward)
my $ctg_on_chr_f = Bio::Location::Simple->
  new( -seq_id => 'ctg on chr f',
       -start  =>           5001,
       -end    =>           6001,
       -strand =>             +1,
     );
 
## The contigs position on a chromosome (reverse)
my $ctg_on_chr_r = Bio::Location::Simple->
  new( -seq_id => 'ctg on chr r',
       -start  =>           5001,
       -end    =>           6001,
       -strand =>             -1,
     );
 
## Coordinate mapping (forward)
my $agp_f = Bio::Coordinate::Pair->
  new( -in  => $ctg,
       -out => $ctg_on_chr_f
     );
 
## Coordinate mapping (reverse)
my $agp_r = Bio::Coordinate::Pair->
  new( -in  => $ctg,
       -out => $ctg_on_chr_r
     );
 
 
 
## A match in contig coordinates...
my $match_on_ctg_4 = Bio::Location::Simple->
  new( -seq_id => 'hit 4',
       -start  =>     925,
       -end    =>    1125,
       -strand =>      -1,
     );
 
## Map it into chromosome coordinates (forward)
my $match_on_chr_4_f =
  $agp_f->map( $match_on_ctg_4 );
 
print Dumper $match_on_chr_4_f;
 
## Map it into chromosome coordinates (reverse)
my $match_on_chr_4_r =
  $agp_r->map( $match_on_ctg_4 );
 
print Dumper $match_on_chr_4_r;


RESULTS:

$VAR1 = bless( {
                 '_sublocations' => [
                                      bless( {
                                               '_strand' => -1,
                                               '_seqid' => 'ctg on chr f',
                                               '_start' => 5925,
                                               '_location_type' => 'EXACT',
                                               '_end' => 6001
                                             }, 'Bio::Coordinate::Result::Match' ),
                                      bless( {
                                               '_strand' => -1,
                                               '_seqid' => 'ctg',
                                               '_location_type' => 'EXACT',
                                               '_start' => 1002,
                                               '_end' => 1125
                                             }, 'Bio::Coordinate::Result::Gap' )
                                    ],
                 '_gap' => $VAR1->{'_sublocations'}[1],
                 'strand' => -1,
                 '_match' => $VAR1->{'_sublocations'}[0],
                 '_splittype' => 'JOIN'
               }, 'Bio::Coordinate::Result' );
$VAR1 = bless( {
                 '_sublocations' => [
                                      bless( {
                                               '_strand' => 1,
                                               '_seqid' => 'ctg on chr r',
                                               '_start' => 5001,
                                               '_location_type' => 'EXACT',
                                               '_end' => 5077
                                             }, 'Bio::Coordinate::Result::Match' ),
                                      bless( {
                                               '_strand' => -1,
                                               '_seqid' => 'ctg',
                                               '_location_type' => 'EXACT',
                                               '_start' => 1002,
                                               '_end' => 1125
                                             }, 'Bio::Coordinate::Result::Gap' )
                                    ],
                 '_gap' => $VAR1->{'_sublocations'}[1],
                 'strand' => 1,
                 '_match' => $VAR1->{'_sublocations'}[0],
                 '_splittype' => 'JOIN'
               }, 'Bio::Coordinate::Result' );
Personal tools
Namespaces
Variants
Actions
Main Links
documentation
community
development
Toolbox