EnsEMBL/DBSQL/MetaContainer.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 55 CC 1 SCAR 6.9
CC
1
Cov
0%
get_production_name
2.0
get_display_name
2.0
get_common_name
2.0
CRAP 2.0
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
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
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
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.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::DBSQL::MetaContainer - Encapsulates all access to core
34 database meta information
35  
36 =head1 SYNOPSIS
37  
38 my $meta_container =
39 $registry->get_adaptor( 'Human', 'Core', 'MetaContainer' );
40  
41 my @mapping_info =
42 @{ $meta_container->list_value_by_key('assembly.mapping') };
43
44 my $scientific_name = $meta_container->get_scientific_name();
45  
46 =head1 DESCRIPTION
47  
48 An object that encapsulates specific access to core db meta data
49  
50 =head1 METHODS
51  
52 =cut
53  
54 package Bio::EnsEMBL::DBSQL::MetaContainer;
55 $Bio::EnsEMBL::DBSQL::MetaContainer::VERSION = '114.0.0';
56 use strict;
57 use warnings;
58  
59 use Bio::Species;
60  
61  
62 use base qw/Bio::EnsEMBL::DBSQL::BaseMetaContainer/;
63  
64 # add well known meta info get-functions below
65  
66 =head2 get_production_name
67  
68 Args : none
69 Example : $species = $meta_container->get_production_name();
70 Description : Obtains the name of the species in a form usable as, for
71 example, a table name, file name etc.
72 Returntype : string
73 Exceptions : none
74 Status : Stable
75  
76 =cut
77  
78 sub get_production_name {
79 my ($self) = @_;
80 return $self->single_value_by_key('species.production_name');
81 }
82  
83 =head2 get_display_name
84  
85 Args : none
86 Example : $species = $meta_container->get_display_name();
87 Description : Obtains the name of the species in a form usable as, for
88 example, a short label in a GUI.
89 Returntype : string
90 Exceptions : none
91 Status : Stable
92  
93 =cut
94  
95 sub get_display_name {
96 my ($self) = @_;
97 return $self->single_value_by_key('species.display_name');
98 }
99  
100 =head2 get_common_name
101  
102 Args : none
103 Example : $species = $meta_container->get_common_name();
104 Description : Obtains the common name of the species.
105 Returntype : string
106 Exceptions : none
107 Status : Stable
108  
109 =cut
110  
111 sub get_common_name {
112 my ($self) = @_;
113 return $self->single_value_by_key('species.common_name');
114 }
115  
116 =head2 get_scientific_name
117  
118 Args : none
119 Example : $species = $meta_container->get_scientific_name();
120 Description : Obtains the full scientific name of the species.
121 Returntype : string
122 Exceptions : none
123 Status : Stable
124  
125 =cut
126 sub get_scientific_name {
127 my ($self) = @_;
128 return $self->single_value_by_key('species.scientific_name');
129 }
130  
131 =head2 get_division
132  
133 Args : none
134 Example : $div = $meta_container->get_division();
135 Description : Obtains the Ensembl Genomes division to which the species belongs.
136 Returntype : string
137 Exceptions : none
138 Status : Stable
139  
140 =cut
141 sub get_division {
142 my ($self) = @_;
143 return $self->single_value_by_key('species.division');
144 }
145  
146 =head2 get_taxonomy_id
147  
148 Arg [1] : none
149 Example : $tax_id = $meta_container->get_taxonomy_id();
150 Description: Retrieves the taxonomy id from the database meta table
151 Returntype : string
152 Exceptions : none
153 Caller : ?
154 Status : Stable
155  
156 =cut
157  
158 sub get_taxonomy_id {
159 my ($self) = @_;
160 return $self->single_value_by_key('species.taxonomy_id', 1);
161 }
162  
163 =head2 get_genebuild
164  
165 Arg [1] : none
166 Example : $tax_id = $meta_container->get_genebuild();
167 Description: Retrieves the genebuild from the database meta table
168 Returntype : string
169 Exceptions : none
170 Caller : ?
171 Status : Stable
172  
173 =cut
174  
175 sub get_genebuild {
176 my ($self) = @_;
177 return $self->single_value_by_key('genebuild.start_date', 1);
178 }
179  
180 =head2 get_genebuild
181  
182 Example : $classification = $meta_container->get_classification();
183 Description: Retrieves the classification held in the backing database minus
184 any species specific levels. This means that the first element
185 in the array will be subfamily/family level ascending to
186 superkingdom
187 Returntype : ArrayRef[String]
188 Exceptions : none
189 Caller : ?
190 Status : Stable
191  
192 =cut
193  
194 sub get_classification {
195 my ($self) = @_;
196 my $classification = $self->list_value_by_key('species.classification');
197 my $copy = [@{$classification}];
198 splice(@{$copy}, 0, 1); # remove the Homo sapiens
199 return $copy;
200 }
201  
202  
203 1;
204