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
34 was NOT mapped to the ensembl.
42 -analysis => $analysis,
43 -external_db_id => 4100,
44 -identifier =>
"Q12345",
46 -target_score => 29.2,
47 -ensembl_id => 122346,
48 -ensembl_type =>
"Translation",
49 -summary =>
"match failed for exonerate",
50 -full_desc =>
"match failed for the xref exonerate run "
51 .
"as match was below threshold of 90"
56 UnmappedObjects represent entities NOT mapped to ensembl. Therefore
this
57 should help users to find out why certain accessions etc can not be
66 package Bio::EnsEMBL::UnmappedObject;
82 Arg [TYPE] : the type of mapping i.e.
'xref',
'cDNA'
84 Arg [EXTERNAL_DB_ID] :
id for the external db
id this identifier is from
85 Arg [IDENTIFIER] : name of the identifier i.e.
accession
86 Arg [QUERY_SCORE] : (optional) The query score
87 Arg [TARGET_SCORE] : (optional) The target score
88 Arg [SUMMARY] : The summary reason
for not mapping.
89 Arg [FULL_DESC] : The Full description of why it did not
map.
90 Arg [ENSEMBL_ID] : (optional)
internal ensembl
id for the best match
91 Arg [ENSEMBL_OBJECT_TYPE] : (optional) the type of
object for the best match
92 Example : see SYNOPSIS
94 Exceptions : If any of the none optional args are missing
103 #allow constructor to be called as class or object method
104 my $class = ref($caller) || $caller;
108 my ($dbID, $unmapped_reason_id, $type, $analysis, $ex_db_id, $identifier,
109 $query_score, $target_score, $summary, $full_desc,
110 $ensembl_id, $ensembl_object_type, $adaptor ) =
111 rearrange([qw(UNMAPPED_OBJECT_ID UNMAPPED_REASON_ID TYPE ANALYSIS
112 EXTERNAL_DB_ID IDENTIFIER QUERY_SCORE TARGET_SCORE
113 SUMMARY FULL_DESC ENSEMBL_ID ENSEMBL_OBJECT_TYPE ADAPTOR)], @_);
115 my $self = $class->SUPER::new(@_);
116 if(defined($analysis)) {
117 if(!ref($analysis) || !$analysis->isa(
'Bio::EnsEMBL::Analysis')) {
118 throw(
'-ANALYSIS argument must be a Bio::EnsEMBL::Analysis not '.
123 throw(
'-ANALYSIS argument must be given');
125 $self->{
'analysis'} = $analysis;
126 $self->{
'dbID'} = $dbID
if (defined($dbID));
127 $self->{
'description'} = $full_desc ||
throw(
'FULL_DESC must be given');
128 $self->{
'summary'} = $summary ||
throw(
'SUMMARY must be given');
129 $self->{
'type'} = $type ||
throw(
'TYPE must be given');
130 $self->{
'external_db_id'} = $ex_db_id;
132 if (lc($type) eq
"xref") {
133 throw(
'EXTERNAL_DB_ID must be given')
if ! defined $ex_db_id;
136 $self->{
'identifier'} = $identifier ||
throw(
'IDENTIFIER must be given');
137 $self->{
'query_score'} = $query_score
if(defined($query_score));
138 $self->{
'target_score'} = $target_score
if(defined($target_score));
139 $self->{
'ensembl_id'} = $ensembl_id
if(defined($ensembl_id));
140 $self->{
'ensembl_object_type'} = $ensembl_object_type
141 if(defined($ensembl_object_type));
142 $self->{
'unmapped_reason_id'} = $unmapped_reason_id
143 if(defined($unmapped_reason_id));
144 $self->adaptor($adaptor)
if(defined($adaptor));
151 Arg [1] : (optional) * to be set to
152 Example : print $unmappedObject->description.
"\n";
153 Description : Basic getter/setter
for description
166 $self->{
'description'} = $des;
169 return $self->{
'description'};
174 Arg [1] : (optional) summary to be set to
175 Example : print $unmappedObject->summary.
"\n";
176 Description : Basic getter/setter
for summary
189 $self->{
'summary'} = $des;
192 return $self->{
'summary'};
197 Arg [1] : (optional) type to be set to
198 Example : print $unmappedObject->type.
"\n";
199 Description : Basic getter/setter
for type
212 $self->{
'type'} = $arg;
215 return $self->{
'type'};
218 =head2 ensembl_object_type
220 Arg [1] : (optional) ensembl
object type to be set to
221 Example : print $unmappedObject->ensembl_object_type.
"\n";
222 Description : Basic getter/setter
for ensembl
object type
230 sub ensembl_object_type{
235 $self->{
'ensembl_object_type'} = $arg;
238 return $self->{
'ensembl_object_type'};
243 Arg [1] : (optional) ensembl
id to be set to
244 Example : print $unmappedObject->ensembl_id.
"\n";
245 Description : Basic getter/setter
for ensembl
id
258 $self->{
'ensembl_id'} = $arg;
261 return $self->{
'ensembl_id'};
264 =head2 external_db_id
266 Arg [1] : (optional) external_db_id to be set to
267 Example : print $unmappedObject->external_db_id.
"\n";
268 Description : Basic getter/setter
for external_db_id
281 $self->{
'external_db_id'} = $arg;
284 return $self->{
'external_db_id'};
287 =head2 external_db_name
289 Example : print $unmappedObject->external_db_name().
"\n";
290 Description : Basic getter
for external_db_name
298 sub external_db_name{
301 my $handle = $self->adaptor;
302 if(defined($handle) and defined($self->{
'external_db_id'})){
303 my $sth = $handle->prepare(
"select db_name from external_db where external_db_id = ".$self->{
'external_db_id'});
306 $sth->bind_columns(\$name);
317 my $handle = $self->adaptor;
318 if(defined($handle)){
319 my $sql =
"select stable_id from ".lc($self->{
'ensembl_object_type'}).
" where ".
320 lc($self->{
'ensembl_object_type'}).
"_id = ".
321 $self->{
'ensembl_id'};
322 my $sth = $handle->prepare($sql);
325 $sth->bind_columns(\$name);
333 # if($self->{'ensembl_object_type'} eq "Transcript"){
334 # $adaptor= $self->adaptor->db->get_TranscriptAdaptor();
336 # elsif($self->{'ensembl_object_type'} eq "Translation"){
337 # $adaptor= $self->adaptor->db->get_TranslationAdaptor();
339 # elsif($self->{'ensembl_object_type'} eq "Gene"){
340 # $adaptor= $self->adaptor->db->get_GeneAdaptor();
345 # my $object = $adaptor->fetch_by_dbID($self->{'ensembl_id'});
346 # if(defined($object)){
347 # return $object->stable_id;
357 Arg [1] : (optional) identifier to be set to
358 Example : print $unmappedObject->identifier.
"\n";
359 Description : Basic getter/setter
for identifier
372 $self->{
'identifier'} = $arg;
375 return $self->{
'identifier'};
380 Arg [1] : (optional) query_score to be set to
381 Example : print $unmappedObject->query_score.
"\n";
382 Description : Basic getter/setter
for query_score
395 $self->{
'query_score'} = $arg;
398 return $self->{
'query_score'};
403 Arg [1] : (optional) target_score to be set to
404 Example : print $unmappedObject->target_score.
"\n";
405 Description : Basic getter/setter
for target_score
418 $self->{
'target_score'} = $arg;
421 return $self->{
'target_score'};
424 =head2 unmapped_reason_id
426 Arg [1] : (optional) unmapped_reason_id to be set to
427 Example : print $unmappedObject->unmapped_reason_id.
"\n";
428 Description : Basic getter/setter
for unmapped_reason_id
436 sub unmapped_reason_id{
441 $self->{
'unmapped_reason_id'} = $arg;
444 return $self->{
'unmapped_reason_id'};
449 Arg [1] : (optional) analysis to be set to
450 Example : print $unmappedObject->analysis->logic_name.
"\n";
451 Description : Basic getter/setter
for analysis
464 if(defined($an) && (!ref($an) || !$an->isa(
'Bio::EnsEMBL::Analysis'))) {
465 throw(
'analysis argument must be a Bio::EnsEMBL::Analysis');
467 $self->{
'analysis'} = $an;
470 return $self->{
'analysis'};