3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
38 -stable_id =>
'ENSG001',
44 -stable_id =>
'ENSG001',
55 # directly access attributes in old and new ArchiveStableId
56 my $old_stable_id = $event->
get_attribute(
'old',
'stable_id' );
60 This
object represents a stable ID mapping
event. Such an
event links two
61 ArchiveStableIds with a mapping score.
72 =head1 RELATED MODULES
80 package Bio::EnsEMBL::StableIdEvent;
84 no warnings
'uninitialized';
96 Arg[3] : (optional)
float $score - score of
this mapping event
98 $arch_id1, $arch_id2, 0.977);
99 Description :
object constructor
101 Exceptions : thrown on wrong argument types
110 my $class = ref($caller) || $caller;
112 my ($old_id, $new_id, $score) = rearrange([qw(OLD_ID NEW_ID SCORE)], @_);
114 throw(
"Need old or new Bio::EnsEMBL::ArchiveStableId to create StableIdEvent")
115 unless ($old_id || $new_id);
121 $self->old_ArchiveStableId($old_id);
122 $self->new_ArchiveStableId($new_id);
123 $self->score($score);
129 =head2 old_ArchiveStableId
134 my $archive_id = $event->old_ArchiveStableId;
137 $event->old_ArchiveStableId($archive_id);
138 Description : Getter/setter
for old
ArchiveStableId in
this mapping
event.
140 Exceptions : thrown on wrong argument type
147 sub old_ArchiveStableId {
152 my $archive_id = shift;
154 # if argument is defined, check type. undef is also legal as an argument.
155 if (defined($archive_id)) {
156 throw(
"Need a Bio::EnsEMBL::ArchiveStableId.") unless
157 (ref($archive_id) && $archive_id->isa(
'Bio::EnsEMBL::ArchiveStableId'));
160 $self->{
'old_id'} = $archive_id;
164 return $self->{
'old_id'};
168 =head2 new_ArchiveStableId
171 The
new ArchiveStableId to set
for this mapping event
173 my $archive_id = $event->new_ArchiveStableId;
176 $event->new_ArchiveStableId($archive_id);
177 Description : Getter/setter
for new ArchiveStableId in
this mapping
event.
179 Exceptions : thrown on wrong argument type
186 sub new_ArchiveStableId {
191 my $archive_id = shift;
193 # if argument is defined, check type. undef is also legal as an argument.
194 if (defined($archive_id)) {
195 throw(
"Need a Bio::EnsEMBL::ArchiveStableId.") unless
196 (ref($archive_id) && $archive_id->isa(
'Bio::EnsEMBL::ArchiveStableId'));
199 $self->{
'new_id'} = $archive_id;
203 return $self->{
'new_id'};
209 Arg[1] : (optional)
float $score - the score to set
210 Example : my $score = $event->score;
211 Description : Getter/setter
for mapping event score.
212 Return type :
float or undef
222 $self->{
'score'} = shift
if (@_);
223 return $self->{
'score'};
229 Arg[1] : String $type - determines whether to get attribute from
'old'
230 or
'new' ArchiveStableId
231 Arg[2] : String $attr - ArchiveStableId attribute to fetch
232 Example : my $old_stable_id = $event->get_attribute(
'old',
'stable_id');
233 Description : Accessor to attributes of the ArchiveStableIds attached to
this
234 event. Convenience method that does the check
for undef old
235 and/or
new ArchiveStableId
for you.
238 Exceptions : thrown on wrong arguments
246 my ($self, $type, $attr) = @_;
248 throw(
"First argument passed to this function has to be 'old' or 'new'.")
249 unless ($type eq
'old' or $type eq
'new');
251 my %allowed_attribs =
map { $_ => 1 }
252 qw(stable_id version db_name release assembly);
254 throw(
"Attribute $attr not allowed.") unless $allowed_attribs{$attr};
256 my $call = $type.
'_ArchiveStableId';
258 if (my $id = $self->$call) {
268 Example : print $event->ident_string,
"\n";
269 Description : Returns a
string that can be used to identify your StableIdEvent.
270 Useful in
debug warnings.
282 my $old_id = $self->old_ArchiveStableId;
283 my $new_id = $self->new_ArchiveStableId;
288 $str = $old_id->stable_id.
'.'.$old_id->version.
' ('.
289 $old_id->release.
')';
297 $str .= $new_id->stable_id.
'.'.$new_id->version.
' ('.
298 $new_id->release.
')';
303 $str .=
' ['.$self->score.
']';