Mercurial > repos > willmclaren > ensembl_vep
comparison variant_effect_predictor/Bio/EnsEMBL/IdMapping/Entry.pm @ 0:21066c0abaf5 draft
Uploaded
author | willmclaren |
---|---|
date | Fri, 03 Aug 2012 10:04:48 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:21066c0abaf5 |
---|---|
1 =head1 LICENSE | |
2 | |
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and | |
4 Genome Research Limited. All rights reserved. | |
5 | |
6 This software is distributed under a modified Apache license. | |
7 For license details, please see | |
8 | |
9 http://www.ensembl.org/info/about/code_licence.html | |
10 | |
11 =head1 CONTACT | |
12 | |
13 Please email comments or questions to the public Ensembl | |
14 developers list at <dev@ensembl.org>. | |
15 | |
16 Questions may also be sent to the Ensembl help desk at | |
17 <helpdesk@ensembl.org>. | |
18 | |
19 =cut | |
20 | |
21 =head1 NAME | |
22 | |
23 Bio::EnsEMBL::IdMapping::Entry - object representing a ScoredMappingMatrix entry | |
24 | |
25 =head1 SYNOPSIS | |
26 | |
27 =head1 DESCRIPTION | |
28 | |
29 This object represents a ScoredMappingMatrix entry. It is defined by a | |
30 pair of a source and target object's internal Id and a score for this | |
31 mapping. | |
32 | |
33 =head1 METHODS | |
34 | |
35 new | |
36 new_fast | |
37 source | |
38 target | |
39 score | |
40 to_string | |
41 | |
42 =cut | |
43 | |
44 package Bio::EnsEMBL::IdMapping::Entry; | |
45 | |
46 use strict; | |
47 use warnings; | |
48 no warnings 'uninitialized'; | |
49 | |
50 use Bio::EnsEMBL::Utils::Exception qw(throw warning); | |
51 | |
52 | |
53 =head2 new | |
54 | |
55 Example : my $entry = Bio::EnsEMBL::IdMapping::Entry->new(); | |
56 Description : Constructor. This is a no-argument constructor, so you need to | |
57 populate the object manually. Rarely used since in most cases | |
58 new_fast() is preferred. | |
59 Return type : a Bio::EnsEMBL::IdMapping::Entry object | |
60 Exceptions : none | |
61 Caller : general | |
62 Status : At Risk | |
63 : under development | |
64 | |
65 =cut | |
66 | |
67 sub new { | |
68 my $caller = shift; | |
69 my $class = ref($caller) || $caller; | |
70 | |
71 my $self = []; | |
72 bless ($self, $class); | |
73 | |
74 return $self; | |
75 } | |
76 | |
77 | |
78 =head2 new_fast | |
79 | |
80 Arg[1] : Arrayref $array_ref - the arrayref to bless into the Entry | |
81 object | |
82 Example : my $entry = Bio::EnsEMBL::IdMapping::Entry->new_fast([ | |
83 $source_gene->id, $target_gene->id, 0.9]); | |
84 Description : Fast constructor. | |
85 Return type : a Bio::EnsEMBL::IdMapping::Entry object | |
86 Exceptions : none | |
87 Caller : general | |
88 Status : At Risk | |
89 : under development | |
90 | |
91 =cut | |
92 | |
93 sub new_fast { | |
94 my $class = shift; | |
95 my $array_ref = shift; | |
96 return bless $array_ref, $class; | |
97 } | |
98 | |
99 | |
100 =head2 source | |
101 | |
102 Arg[1] : (optional) Int - source object's internal Id | |
103 Description : Getter/setter for source object's internal Id. | |
104 Return type : Int | |
105 Exceptions : none | |
106 Caller : general | |
107 Status : At Risk | |
108 : under development | |
109 | |
110 =cut | |
111 | |
112 sub source { | |
113 my $self = shift; | |
114 $self->[0] = shift if (@_); | |
115 return $self->[0]; | |
116 } | |
117 | |
118 | |
119 =head2 target | |
120 | |
121 Arg[1] : (optional) Int - target object's internal Id | |
122 Description : Getter/setter for target object's internal Id. | |
123 Return type : Int | |
124 Exceptions : none | |
125 Caller : general | |
126 Status : At Risk | |
127 : under development | |
128 | |
129 =cut | |
130 | |
131 sub target { | |
132 my $self = shift; | |
133 $self->[1] = shift if (@_); | |
134 return $self->[1]; | |
135 } | |
136 | |
137 | |
138 =head2 score | |
139 | |
140 Arg[1] : (optional) Float - a score | |
141 Description : Getter/setter for score for the mapping between source and | |
142 target object. | |
143 Return type : Float | |
144 Exceptions : none | |
145 Caller : general | |
146 Status : At Risk | |
147 : under development | |
148 | |
149 =cut | |
150 | |
151 sub score { | |
152 my $self = shift; | |
153 $self->[2] = shift if (@_); | |
154 return $self->[2]; | |
155 } | |
156 | |
157 | |
158 =head2 to_string | |
159 | |
160 Example : print LOG $entry->to_string, "\n"; | |
161 Description : Returns a string representation of the Entry object. Useful for | |
162 debugging and logging. | |
163 Return type : String | |
164 Exceptions : none | |
165 Caller : general | |
166 Status : At Risk | |
167 : under development | |
168 | |
169 =cut | |
170 | |
171 sub to_string { | |
172 my $self = shift; | |
173 return sprintf('%-10s%-10s%-5.6f', $self->source, $self->target, $self->score); | |
174 } | |
175 | |
176 | |
177 1; | |
178 |