Archive Ensembl HomeArchive Ensembl Home
Entry.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::IdMapping::Entry - object representing a ScoredMappingMatrix entry
00024 
00025 =head1 SYNOPSIS
00026 
00027 =head1 DESCRIPTION
00028 
00029 This object represents a ScoredMappingMatrix entry. It is defined by a
00030 pair of a source and target object's internal Id and a score for this
00031 mapping.
00032 
00033 =head1 METHODS
00034 
00035   new
00036   new_fast
00037   source
00038   target
00039   score
00040   to_string
00041 
00042 =cut
00043 
00044 package Bio::EnsEMBL::IdMapping::Entry;
00045 
00046 use strict;
00047 use warnings;
00048 no warnings 'uninitialized';
00049 
00050 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
00051 
00052 
00053 =head2 new
00054 
00055   Example     : my $entry = Bio::EnsEMBL::IdMapping::Entry->new();
00056   Description : Constructor. This is a no-argument constructor, so you need to
00057                 populate the object manually. Rarely used since in most cases
00058                 new_fast() is preferred.
00059   Return type : a Bio::EnsEMBL::IdMapping::Entry object
00060   Exceptions  : none
00061   Caller      : general
00062   Status      : At Risk
00063               : under development
00064 
00065 =cut
00066 
00067 sub new {
00068   my $caller = shift;
00069   my $class = ref($caller) || $caller;
00070 
00071   my $self = [];
00072   bless ($self, $class);
00073 
00074   return $self;
00075 }
00076 
00077 
00078 =head2 new_fast
00079 
00080   Arg[1]      : Arrayref $array_ref - the arrayref to bless into the Entry
00081                 object 
00082   Example     : my $entry = Bio::EnsEMBL::IdMapping::Entry->new_fast([
00083                   $source_gene->id, $target_gene->id, 0.9]);
00084   Description : Fast constructor.
00085   Return type : a Bio::EnsEMBL::IdMapping::Entry object
00086   Exceptions  : none
00087   Caller      : general
00088   Status      : At Risk
00089               : under development
00090 
00091 =cut
00092 
00093 sub new_fast {
00094   my $class = shift;
00095   my $array_ref = shift;
00096   return bless $array_ref, $class;
00097 }
00098 
00099 
00100 =head2 source
00101 
00102   Arg[1]      : (optional) Int - source object's internal Id
00103   Description : Getter/setter for source object's internal Id.
00104   Return type : Int
00105   Exceptions  : none
00106   Caller      : general
00107   Status      : At Risk
00108               : under development
00109 
00110 =cut
00111 
00112 sub source {
00113   my $self = shift;
00114   $self->[0] = shift if (@_);
00115   return $self->[0];
00116 }
00117 
00118 
00119 =head2 target
00120 
00121   Arg[1]      : (optional) Int - target object's internal Id
00122   Description : Getter/setter for target object's internal Id.
00123   Return type : Int
00124   Exceptions  : none
00125   Caller      : general
00126   Status      : At Risk
00127               : under development
00128 
00129 =cut
00130 
00131 sub target {
00132   my $self = shift;
00133   $self->[1] = shift if (@_);
00134   return $self->[1];
00135 }
00136 
00137 
00138 =head2 score
00139 
00140   Arg[1]      : (optional) Float - a score
00141   Description : Getter/setter for score for the mapping between source and
00142                 target object.
00143   Return type : Float
00144   Exceptions  : none
00145   Caller      : general
00146   Status      : At Risk
00147               : under development
00148 
00149 =cut
00150 
00151 sub score {
00152   my $self = shift;
00153   $self->[2] = shift if (@_);
00154   return $self->[2];
00155 }
00156 
00157 
00158 =head2 to_string
00159 
00160   Example     : print LOG $entry->to_string, "\n";
00161   Description : Returns a string representation of the Entry object. Useful for
00162                 debugging and logging.
00163   Return type : String
00164   Exceptions  : none
00165   Caller      : general
00166   Status      : At Risk
00167               : under development
00168 
00169 =cut
00170 
00171 sub to_string {
00172   my $self = shift;
00173   return sprintf('%-10s%-10s%-5.6f', $self->source, $self->target, $self->score);
00174 }
00175 
00176 
00177 1;
00178