EnsEMBL/DBSQL/MetaContainer.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 56 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_50'; # TRIAL
56 $Bio::EnsEMBL::DBSQL::MetaContainer::VERSION = '114.0.050';
57 use strict;
58 use warnings;
59  
60 use Bio::Species;
61  
62  
63 use base qw/Bio::EnsEMBL::DBSQL::BaseMetaContainer/;
64  
65 # add well known meta info get-functions below
66  
67 =head2 get_production_name
68  
69 Args : none
70 Example : $species = $meta_container->get_production_name();
71 Description : Obtains the name of the species in a form usable as, for
72 example, a table name, file name etc.
73 Returntype : string
74 Exceptions : none
75 Status : Stable
76  
77 =cut
78  
79 sub get_production_name {
80 my ($self) = @_;
81 return $self->single_value_by_key('species.production_name');
82 }
83  
84 =head2 get_display_name
85  
86 Args : none
87 Example : $species = $meta_container->get_display_name();
88 Description : Obtains the name of the species in a form usable as, for
89 example, a short label in a GUI.
90 Returntype : string
91 Exceptions : none
92 Status : Stable
93  
94 =cut
95  
96 sub get_display_name {
97 my ($self) = @_;
98 return $self->single_value_by_key('species.display_name');
99 }
100  
101 =head2 get_common_name
102  
103 Args : none
104 Example : $species = $meta_container->get_common_name();
105 Description : Obtains the common name of the species.
106 Returntype : string
107 Exceptions : none
108 Status : Stable
109  
110 =cut
111  
112 sub get_common_name {
113 my ($self) = @_;
114 return $self->single_value_by_key('species.common_name');
115 }
116  
117 =head2 get_scientific_name
118  
119 Args : none
120 Example : $species = $meta_container->get_scientific_name();
121 Description : Obtains the full scientific name of the species.
122 Returntype : string
123 Exceptions : none
124 Status : Stable
125  
126 =cut
127 sub get_scientific_name {
128 my ($self) = @_;
129 return $self->single_value_by_key('species.scientific_name');
130 }
131  
132 =head2 get_division
133  
134 Args : none
135 Example : $div = $meta_container->get_division();
136 Description : Obtains the Ensembl Genomes division to which the species belongs.
137 Returntype : string
138 Exceptions : none
139 Status : Stable
140  
141 =cut
142 sub get_division {
143 my ($self) = @_;
144 return $self->single_value_by_key('species.division');
145 }
146  
147 =head2 get_taxonomy_id
148  
149 Arg [1] : none
150 Example : $tax_id = $meta_container->get_taxonomy_id();
151 Description: Retrieves the taxonomy id from the database meta table
152 Returntype : string
153 Exceptions : none
154 Caller : ?
155 Status : Stable
156  
157 =cut
158  
159 sub get_taxonomy_id {
160 my ($self) = @_;
161 return $self->single_value_by_key('species.taxonomy_id', 1);
162 }
163  
164 =head2 get_genebuild
165  
166 Arg [1] : none
167 Example : $tax_id = $meta_container->get_genebuild();
168 Description: Retrieves the genebuild from the database meta table
169 Returntype : string
170 Exceptions : none
171 Caller : ?
172 Status : Stable
173  
174 =cut
175  
176 sub get_genebuild {
177 my ($self) = @_;
178 return $self->single_value_by_key('genebuild.start_date', 1);
179 }
180  
181 =head2 get_genebuild
182  
183 Example : $classification = $meta_container->get_classification();
184 Description: Retrieves the classification held in the backing database minus
185 any species specific levels. This means that the first element
186 in the array will be subfamily/family level ascending to
187 superkingdom
188 Returntype : ArrayRef[String]
189 Exceptions : none
190 Caller : ?
191 Status : Stable
192  
193 =cut
194  
195 sub get_classification {
196 my ($self) = @_;
197 my $classification = $self->list_value_by_key('species.classification');
198 my $copy = [@{$classification}];
199 splice(@{$copy}, 0, 1); # remove the Homo sapiens
200 return $copy;
201 }
202  
203  
204 1;
205