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