ensembl-hive  2.8.1
Genome.pm
Go to the documentation of this file.
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::Genome - A generic Genome class.
34 
35 =head1 SYNOPSIS
36 
38 
39  my $genome = Bio::EnsEMBL::Genome->new
40  (-NAME => 'myName',
41  -CODE => 'MyCode',
42  -DESCRIPTION => 'This is my statistics description.',
43  -VALUE => '10023');
44 
45  print $statistic->name(), "\n";
46  print $statistic->code(), "\n";
47  print $statistic->description(), "\n";
48  print $statistic->value(), "\n";
49 
50 =head1 DESCRIPTION
51 
52 This is a generic genome class used to represent statistics
53 associated with a genome and species
54 
55 =head1 SEE ALSO
56 
58 
59 =cut
60 
61 package Bio::EnsEMBL::Genome;
62 
63 use strict;
64 use warnings;
65 
66 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
67 use Scalar::Util qw(weaken isweak);
68 
69 =head2 new
70 
71  Arg [-NAME] : string - the name for this statistic
72  Arg [-CODE] : string - the code for this statistic
73  Arg [-DESCRIPTION] : string - a description for this statistic
74  Arg [-VALUE] : value - the value of this statistic
75  Example : my $genome = Bio::EnsEMBL::Genome->new
76  (-name => 'myName',
77  -CODE => 'MyCode',
78  -DESCRIPTION => 'This is my statistics description.',
79  -VALUE => '10023');
80  Description : Constructor. Instantiates a Bio::EnsEMBL::Genome object.
81  Returntype : Bio::EnsEMBL::Genome
82  Exceptions : none
83  Caller : general
84  Status : Stable
85 
86 =cut
87 
88 
89 sub new {
90  my $caller = shift;
91 
92  # allow to be called as class or object method
93  my $class = ref($caller) || $caller;
94 
95  my ($dbID, $statistic, $value, $species_id, $code, $name, $desc) =
96  rearrange([qw(DBID STATISTIC VALUE SPECIES_ID CODE NAME DESCRIPTION)], @_);
97 
98  return bless {'dbID' => $dbID,
99  'statistic' => $statistic,
100  'value' => $value,
101  'species_id' => $species_id,
102  'code' => $code,
103  'name' => $name,
104  'description' => $desc}, $class;
105 }
106 
107 =head2 new_fast
108 
109  Arg [1] : hashref to be blessed
110  Description: Construct a new Bio::EnsEMBL::Genome using the hashref.
111  Exceptions : none
112  Returntype : Bio::EnsEMBL::Genome
113  Caller : general, subclass constructors
114  Status : Stable
115 
116 =cut
117 
118 
119 sub new_fast {
120  my $class = shift;
121  my $hashref = shift;
122  my $self = bless $hashref, $class;
123  weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
124  return $self;
125 }
126 
127 =head2 statistic
128 
129  Arg [1] : string $statistic (optional)
130  Example : $statistic = $statistic->name();
131  Description: Getter/Setter for the statistic name
132  Returntype : string
133  Exceptions : none
134  Caller : general
135  Status : Stable
136 
137 =cut
138 
139 sub statistic {
140  my $self = shift;
141  $self->{'statistic'} = shift if(@_);
142  return $self->{'statistic'};
143 }
144 
145 =head2 code
146 
147  Arg [1] : string $code (optional)
148  Example : $code = $genome->code();
149  Description: Getter/Setter for code statistic
150  Returntype : string
151  Exceptions : none
152  Caller : general
153  Status : Stable
154 
155 =cut
156 
157 sub code {
158  my $self = shift;
159  $self->{'code'} = shift if(@_);
160  return $self->{'code'};
161 }
162 
163 
164 =head2 name
165 
166  Arg [1] : string $name (optional)
167  Example : $name = $statistic->name();
168  Description: Getter/Setter for the name associated to the statistic attribute
169  Returntype : string
170  Exceptions : none
171  Caller : general
172  Status : Stable
173 
174 =cut
175 
176 sub name {
177  my $self = shift;
178  $self->{'name'} = shift if(@_);
179  return $self->{'name'};
180 }
181 
182 =head2 description
183 
184  Arg [1] : string $description (optional)
185  Example : $description = $statistic->description();
186  Description: Getter/Setter for description statistic
187  Returntype : string
188  Exceptions : none
189  Caller : general
190  Status : Stable
191 
192 =cut
193 
194 sub description {
195  my $self = shift;
196  $self->{'description'} = shift if(@_);
197  return $self->{'description'};
198 }
199 
200 
201 =head2 value
202 
203  Arg [1] : string $value (optional)
204  Example : $value = $statistic->value();
205  Description: Getter/Setter for value statistic
206  Returntype : string
207  Exceptions : none
208  Caller : general
209  Status : Stable
210 
211 =cut
212 
213 sub value {
214  my $self = shift;
215  $self->{'value'} = shift if(@_);
216  return $self->{'value'};
217 }
218 
219 =head2 dbID
220 
221  Arg [1] : string $value (optional)
222  Example : $dbID = $statistic->dbID();
223  Description: Getter/Setter for statistic internal id
224  Returntype : string
225  Exceptions : none
226  Caller : general
227  Status : Stable
228 
229 =cut
230 
231 sub dbID {
232  my $self = shift;
233  $self->{'dbID'} = shift if(@_);
234  return $self->{'dbID'};
235 }
236 
237 =head2 species_id
238 
239  Arg [1] : string $value (optional)
240  Example : $species_id = $statistic->dbID();
241  Description: Getter/Setter for statistic species id
242  Returntype : string
243  Exceptions : none
244  Caller : general
245  Status : Stable
246 
247 =cut
248 
249 sub species_id {
250  my $self = shift;
251  $self->{'species_id'} = shift if(@_);
252  return $self->{'species_id'};
253 }
254 
255 
256 1;
Bio::EnsEMBL::Genome
Definition: Genome.pm:32
Bio::EnsEMBL::Genome::name
public String name()
Bio::EnsEMBL::Genome::new
public Bio::EnsEMBL::Genome new()
Bio::EnsEMBL::Utils::Argument
Definition: Argument.pm:34
Bio::EnsEMBL::DBSQL::GenomeContainer
Definition: GenomeContainer.pm:37