NAME

Bio::Coordinate::GeneMapper - transformations between gene related coordinate systems

SYNOPSIS

# to use
use Bio::Coordinate::GeneMapper;

# defaults to ID 1 "Standard"
$gmap = Bio::Coordinate::GeneMapper->new();
$gmap = Bio::Coordinate::GeneMapper -> new (-in => 'chr',
                                            -out=> 'cds',
                                            -strict => 1,
                                            -nozero => 0 );

DESCRIPTION

Bio::Coordinate::GeneMapper is a module for simple mapping of coodinate locations between various gene related locations in human genetics. It uses a relaxed form of Bio::Coordinate::Pair called Bio::Coordinate::ExtrapolatingPair which in addition to freely extrapolaiting values beyond boundaries disallows the use of location zero.

It understands by name the following coordinate systems and mapping between them:

                 peptide (peptide length)
                    ^
                    | -peptide_offset
                    |
          (frame) propeptide (propeptide length)
               ^    ^
                \   |
    translate    \  |
                  \ |
                   cds  (transcript start and end)
                    ^
negative_introns    | \
            ^       |  \  transcript 
             \      |   \
inex  =  introns  exons  \
               ^    ^    /
                \   |   /
       splice    \  |  /
                  \ | /
                  gene (gene length)
                    ^
                    | - gene_offset
                    |
                   chr (or entry)

This structure is kept in global variable $DAG which is a representation of a Directed Acyclic Graph. The path calculations traversing this graph are done in a helper class. See Bio::Coordinate::Graph.

Of these, two operations are special cases, translate and splice. Translating and reverse translating are implemented as internal methods that do the simple 1<->3 conversion. Splicing needs additional information that in BioPerl is represented by Bio::SeqFeature::Gene::GeneStructureI modules. Splicing depends on method exons() which takes in a more general array of Bio::LocationI objects.

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing lists Your participation is much appreciated.

bioperl-l@bioperl.org                 - General discussion
http://bio.perl.org/MailList.html     - About the mailing lists

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web:

bioperl-bugs@bio.perl.org
http://bugzilla.bioperl.org/

AUTHOR - Heikki Lehvaslaiho

Email: heikki@ebi.ac.uk Address:

EMBL Outstation, European Bioinformatics Institute
Wellcome Trust Genome Campus, Hinxton
Cambs. CB10 1SD, United Kingdom

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

graph

Title   : graph
Usage   : $obj->graph('peptide');
Function: Set and read the input coordinate system.
Example :
Returns : value of input system
Args    : new value (optional)

in

Title   : in
Usage   : $obj->in('peptide');
Function: Set and read the input coordinate system.
Example :
Returns : value of input system
Args    : new value (optional)

out

Title   : out
Usage   : $obj->out('peptide');
Function: Set and read the output coordinate system.
Example :
Returns : value of output system
Args    : new value (optional)

strict

Title   : strict
Usage   : $obj->strict('peptide');
Function: Set and read weather strict boundaried of coordinate
          systems are enforced.
          When strict is on, the end of the coordinate range must be defined.
Example :
Returns : boolean
Args    : boolean (optional)

nozero

Title   : nozero
Usage   : $obj->nozero(1);
Function: Flag to disable the use of zero in the input,
          output or both coordinate systems. Use of coordinate
          systems without zero is a peculiarity  common in
          human genetics community.
Example :
Returns : 0 (default), or 'in', 'out', 'in&out'
Args    : 0 (default), or 'in', 'out', 'in&out'

peptide

Title   : peptide
Usage   : $obj->peptide_offset($peptide_coord);
Function: Read and write the offset of peptide from the start of propeptide
          and peptide length
Returns : a Bio::Location::Simple object
Args    : a Bio::LocationI object

peptide_offset

Title   : peptide_offset
Usage   : $obj->peptide_offset(20);
Function: Set and read the offset of peptide from the start of propeptide
Returns : set value or 0
Args    : new value (optional)

peptide_length

Title   : peptide_length
Usage   : $obj->peptide_length(20);
Function: Set and read the offset of peptide from the start of propeptide
Returns : set value or 0
Args    : new value (optional)

transcript

Title   : transcript
Usage   : $obj->transcript(20);
Function: Set and read the start and end of the  transcipt
          in chromosamal or entry coordinates

Returns : set value or 0
Args    : new value (optional)

exons

Title   : exons
Usage   : $obj->exons(@exons);
Function: Set and read the offset of CDS from the start of transcipt
          You do not have to sort the exons before calling this method as
          they will be sorted automatically
Returns : array of Bio::LocationI exons in genome coordinates or 0
Args    : array of Bio::LocationI exons in genome (or entry) coordinates

cds

Title   : cds
Usage   : $obj->cds(20);
Function: Set and read the offset of CDS from the start of transcipt

          Simple input can be an integer which gives the start of the
          coding region in genomic coordinate. If you want to provide
          the end of the coding r
egion or indicate the use of the
          opposite strand, you have to pass a Bio::Location::Simple
          object to this method.

Returns : set value or 0
Args    : new value (optional)

map

Title   : map
Usage   : $newpos = $obj->map(5);
Function: Map the location from the input coordinate system
          to a new value in the output coordinate system.
Example :
Returns : new value in the output coordiante system
Args    : a Bio::Location::Simple

direction

Title   : direction
Usage   : $obj->direction('peptide');
Function: Read-only method for the direction of mapping deduced from
          predefined input and output coordinate names.
Example :
Returns : 1 or -1, mapping direction
Args    : new value (optional)

swap

Title   : swap
Usage   : $obj->swap;
Function: Swap the direction of transformation
          (input <-> output)
Example :
Returns : 1
Args    : 

to_string

Title   : to_string
Usage   : $newpos = $obj->to_string(5);
Function: Dump the mapping values into human readable format
Example :
Returns : string
Args    : 

_create_pair

Title   : _create_pair
Usage   : $mapper = $obj->_create_pair('chr', 'gene', 0, 2555, 10000, -1);
Function: Internal helper method to create a mapper between 
          two coordinate systems
Returns : a Bio::Coordinate::Pair object
Args    : string, input coordinate system name,
          string, output coordinate system name,
          boolean, strict mapping
          positive integer, offset
          positive integer, length
          1 || -1 , strand

_translate

Title   : _translate
Usage   : $newpos = $obj->_translate(5);
Function: Translate the location from the CDS coordinate system
          to a new value in the propeptide coordinate system.
Example :
Returns : new location
Args    : a Bio::Location::Simple

_reverse_translate

Title   : _reverse_translate
Usage   : $newpos = $obj->_reverse_translate(5);
Function: Reverse translate the location from the propeptide
          coordinate system to a new value in the CSD.
          Note that a single peptide location expands to cover
          the codon triplet
Example :
Returns : new location in the CDS coordinate system
Args    : a Bio::Location::Simple

_check_direction

Title   : _check_direction
Usage   : $obj->_check_direction();
Function: Check and swap when needed the direction the location
          mapping Pairs based on input and output values
Example :
Returns : new location
Args    : a Bio::Location::Simple

_get_path

Title   : _get_path
Usage   : $obj->_get_path('peptide');
Function: internal method for finding that shortest path between
          input and output coordinate systems.
          Calcultaions and caching are handled by the graph class.
          See L<Bio::Coordinate::Graph>.
Example :
Returns : array of the mappers
Args    : none