Archive Ensembl HomeArchive Ensembl Home
Gap.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003   Copyright (c) 1999-2012 The European Bioinformatics Institute and
00004   Genome Research Limited.  All rights reserved.
00005 
00006   This software is distributed under a modified Apache license.
00007   For license details, please see
00008 
00009     http://www.ensembl.org/info/about/code_licence.html
00010 
00011 =head1 CONTACT
00012 
00013   Please email comments or questions to the public Ensembl
00014   developers list at <dev@ensembl.org>.
00015 
00016   Questions may also be sent to the Ensembl help desk at
00017   <helpdesk@ensembl.org>.
00018 
00019 =cut
00020 
00021 =head1 NAME
00022 
00023 Bio::EnsEMBL::Mapper::Gap
00024 
00025 =head1 SYNOPSIS
00026 
00027 =head1 DESCRIPTION
00028 
00029 Representation of a gap in a sequence; returned from Mapper.pm when the
00030 target region is in a gap.
00031 
00032 =head1 METHODS
00033 
00034 =cut
00035 
00036 package Bio::EnsEMBL::Mapper::Gap;
00037 
00038 use strict;
00039 
00040 =head2 new
00041 
00042   Arg [1]    : int $start
00043   Arg [2]    : int $end
00044   Example    : $gap = Bio::EnsEMBL::Mapper::Gap($start, $end);
00045   Description: Creates a new Gap object.
00046   Returntype : Bio::EnsEMBL::Mapper::Gap
00047   Exceptions : none
00048   Caller     : Bio::EnsEMBL::Mapper
00049   Status     : Stable
00050 
00051 =cut
00052 
00053 sub new {
00054   my ( $proto, $start, $end, $rank ) = @_;
00055 
00056   my $class = ref($proto) || $proto;
00057 
00058   return bless( { 'start' => $start, 'end' => $end, 'rank' => $rank  || 0 }, $class );
00059 }
00060 
00061 =head2 start
00062 
00063   Arg [1]    : (optional) int $start
00064                start coordinate of gap region
00065   Example    : $start = $gap->start();
00066   Description: Getter/Setter for the start attribute
00067   Returntype : int
00068   Exceptions : none
00069   Caller     : general
00070   Status     : Stable
00071 
00072 =cut
00073 
00074 sub start {
00075   my ( $self, $value ) = @_;
00076 
00077   if ( defined($value) ) {
00078     $self->{'start'} = $value;
00079   }
00080 
00081   return $self->{'start'};
00082 }
00083 
00084 =head2 end
00085 
00086   Arg [1]    : (optional) int $newval
00087                The new value to set the end coordinate to
00088   Example    : $end = $gap->end()
00089   Description: Getter/Setter for the end coordinate of the gap region
00090   Returntype : string
00091   Exceptions : none
00092   Caller     : general
00093   Status     : Stable
00094 
00095 =cut
00096 
00097 sub end {
00098   my ( $self, $value ) = @_;
00099 
00100   if ( defined($value) ) {
00101     $self->{'end'} = $value;
00102   }
00103 
00104   return $self->{'end'};
00105 }
00106 
00107 =head2 length
00108 
00109   Arg [1]    : none
00110   Example    : $len = $gap->length();
00111   Description: Getter for the length of this gap region
00112   Returntype : int
00113   Exceptions : none
00114   Caller     : general
00115   Status     : Stable
00116 
00117 =cut
00118 
00119 sub length {
00120   my ($self) = @_;
00121 
00122   return $self->{'end'} - $self->{'start'} + 1;
00123 }
00124 
00125 sub rank {
00126   my ( $self, $value ) = @_;
00127 
00128   if ( defined($value) ) {
00129     $self->{'rank'} = $value;
00130   }
00131 
00132   return $self->{'rank'};
00133 }
00134 
00135 1;