00001 00002 =head1 LICENSE 00003 00004 Copyright [1999-2014] EMBL-European Bioinformatics Institute 00005 00006 Licensed under the Apache License, Version 2.0 (the "License"); 00007 you may not use this file except in compliance with the License. 00008 You may obtain a copy of the License at 00009 00010 http://www.apache.org/licenses/LICENSE-2.0 00011 00012 Unless required by applicable law or agreed to in writing, software 00013 distributed under the License is distributed on an "AS IS" BASIS, 00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 See the License for the specific language governing permissions and 00016 limitations under the License. 00017 00018 =head1 CONTACT 00019 00020 Please email comments or questions to the public Ensembl 00021 developers list at <dev@ensembl.org>. 00022 00023 Questions may also be sent to the Ensembl help desk at 00024 <helpdesk@ensembl.org>. 00025 00026 =head1 NAME 00027 00028 Bio::EnsEMBL::MetaData::GenomeOrganismInfo 00029 00030 =head1 SYNOPSIS 00031 00032 my $info = 00033 Bio::EnsEMBL::MetaData::GenomeOrganismInfo->new( 00034 -DISPLAY_NAME=>$display_name, -NAME=>$name, -STRAIN=>$strain, -SEROTYPE=>$serotype, -IS_REFERENCE=>$is_reference 00035 ); 00036 00037 =head1 DESCRIPTION 00038 00039 Object encapsulating information about the organism to which a particular genome belongs 00040 00041 =head1 SEE ALSO 00042 00043 Bio::EnsEMBL::MetaData::BaseInfo 00044 Bio::EnsEMBL::MetaData::DBSQL::GenomeOrganismInfoAdaptor 00045 00046 =head1 AUTHOR 00047 00048 Dan Staines 00049 00050 =cut 00051 00052 package Bio::EnsEMBL::MetaData::GenomeOrganismInfo; 00053 use base qw/Bio::EnsEMBL::MetaData::BaseInfo/; 00054 use Bio::EnsEMBL::Utils::Argument qw(rearrange); 00055 use strict; 00056 use warnings; 00057 00058 =head1 CONSTRUCTOR 00059 =head2 new 00060 Arg [-NAME] : 00061 string - human readable version of the name of the organism 00062 Arg [-SPECIES] : 00063 string - computable version of the name of the organism (lower case, no spaces) 00064 Arg [-TAXONOMY_ID] : 00065 string - NCBI taxonomy identifier 00066 Arg [-SPECIES_TAXONOMY_ID] : 00067 string - NCBI taxonomy identifier of species to which this organism belongs 00068 Arg [-STRAIN]: 00069 string - name of strain to which organism belongs 00070 Arg [-SEROTYPE]: 00071 string - name of serotype to which organism belongs 00072 Arg [-IS_REFERENCE]: 00073 bool - 1 if this organism is the reference for its species 00074 00075 Example : $info = Bio::EnsEMBL::MetaData::GenomeOrganismInfo->new(...); 00076 Description: Creates a new info object 00077 Returntype : Bio::EnsEMBL::MetaData::GenomeOrganismInfo 00078 Exceptions : none 00079 Caller : general 00080 Status : Stable 00081 00082 =cut 00083 00084 sub new { 00085 my ( $class, @args ) = @_; 00086 my $self = $class->SUPER::new(@args); 00087 ( $self->{display_name}, $self->{name}, 00088 $self->{strain}, $self->{serotype}, 00089 $self->{is_reference}, $self->{taxonomy_id}, 00090 $self->{species_taxonomy_id} ) 00091 = rearrange( [ 'DISPLAY_NAME', 'NAME', 00092 'STRAIN', 'SEROTYPE', 00093 'IS_REFERENCE', 'TAXONOMY_ID', 00094 'SPECIES_TAXONOMY_ID' ], 00095 @args ); 00096 $self->{is_reference} ||= 0; 00097 return $self; 00098 } 00099 00100 =head1 ATTRIBUTE METHODS 00101 00102 =head2 name 00103 Arg : (optional) computationally safe name for species name to set 00104 Description: Gets/sets computationally safe name for species name for genome 00105 Returntype : string 00106 Exceptions : none 00107 Caller : general 00108 Status : Stable 00109 =cut 00110 00111 sub name { 00112 my ( $self, $arg ) = @_; 00113 $self->{name} = $arg if ( defined $arg ); 00114 return $self->{name}; 00115 } 00116 00117 =head2 display_name 00118 Arg : (optional) display_name to set 00119 Description: Gets/sets display_name 00120 Returntype : string 00121 Exceptions : none 00122 Caller : general 00123 Status : Stable 00124 =cut 00125 00126 sub display_name { 00127 my ( $self, $display_name ) = @_; 00128 $self->{display_name} = $display_name if ( defined $display_name ); 00129 return $self->{display_name}; 00130 } 00131 00132 =head2 strain 00133 Arg : (optional) strain to set 00134 Description: Gets/sets strain of genome 00135 Returntype : string 00136 Exceptions : none 00137 Caller : general 00138 Status : Stable 00139 =cut 00140 00141 sub strain { 00142 my ( $self, $arg ) = @_; 00143 $self->{strain} = $arg if ( defined $arg ); 00144 return $self->{strain}; 00145 } 00146 00147 =head2 serotype 00148 Arg : (optional) serotype to set 00149 Description: Gets/sets serotype 00150 Returntype : string 00151 Exceptions : none 00152 Caller : general 00153 Status : Stable 00154 =cut 00155 00156 sub serotype { 00157 my ( $self, $arg ) = @_; 00158 $self->{serotype} = $arg if ( defined $arg ); 00159 return $self->{serotype}; 00160 } 00161 00162 =head2 taxonomy_id 00163 Arg : (optional) taxonomy_id to set 00164 Description: Gets/sets NCBI taxonomy ID 00165 Returntype : string 00166 Exceptions : none 00167 Caller : general 00168 Status : Stable 00169 =cut 00170 00171 sub taxonomy_id { 00172 my ( $self, $taxonomy_id ) = @_; 00173 $self->{taxonomy_id} = $taxonomy_id if ( defined $taxonomy_id ); 00174 return $self->{taxonomy_id}; 00175 } 00176 00177 =head2 species_taxonomy_id 00178 Arg : (optional) taxonomy_id to set 00179 Description: Gets/sets NCBI taxonomy ID of species to which this belongs 00180 Returntype : string 00181 Exceptions : none 00182 Caller : general 00183 Status : Stable 00184 =cut 00185 00186 sub species_taxonomy_id { 00187 my ( $self, $taxonomy_id ) = @_; 00188 $self->{species_taxonomy_id} = $taxonomy_id if ( defined $taxonomy_id ); 00189 return $self->{species_taxonomy_id}; 00190 } 00191 00192 =head2 aliases 00193 Arg : (optional) arrayref of aliases to set 00194 Description: Gets/sets aliases by which the genome is also known 00195 Returntype : Arrayref of aliases 00196 Exceptions : none 00197 Caller : general 00198 Status : Stable 00199 =cut 00200 00201 sub aliases { 00202 my ( $self, $aliases ) = @_; 00203 if ( defined $aliases ) { 00204 $self->{aliases} = $aliases; 00205 } 00206 $self->_load_child( 'aliases', '_fetch_aliases' ); 00207 return $self->{aliases}; 00208 } 00209 00210 =head2 publications 00211 Arg : (optional) arrayref of pubmed IDs to set 00212 Description: Gets/sets PubMed IDs for publications associated with the genome 00213 Returntype : Arrayref of PubMed IDs 00214 Exceptions : none 00215 Caller : general 00216 Status : Stable 00217 =cut 00218 00219 sub publications { 00220 my ( $self, $publications ) = @_; 00221 if ( defined $publications ) { 00222 $self->{publications} = $publications; 00223 } 00224 $self->_load_child( 'publications', '_fetch_publications' ); 00225 return $self->{publications}; 00226 } 00227 00228 =head2 is_reference 00229 Arg : (optional) whether organism is reference 00230 Description: Gets/sets whether this organism is the reference for its species 00231 Returntype : string 00232 Exceptions : none 00233 Caller : general 00234 Status : Stable 00235 =cut 00236 00237 sub is_reference { 00238 my ( $self, $is_reference ) = @_; 00239 $self->{is_reference} = $is_reference if ( defined $is_reference ); 00240 return $self->{is_reference}; 00241 } 00242 00243 =head1 UTILITY METHODS 00244 =head2 to_string 00245 Description: Render as plain string 00246 Returntype : string 00247 Exceptions : none 00248 Caller : general 00249 Status : Stable 00250 =cut 00251 00252 sub to_string { 00253 my ($self) = @_; 00254 return $self->name(); 00255 } 00256 00257 1;