diff --git a/modules/Bio/EnsEMBL/Biotype.pm b/modules/Bio/EnsEMBL/Biotype.pm index ffe530d8433475a637781bfbaf5fd81d0fad2dde..11b7c5e104d6c903c03414791de8ec2994894b66 100644 --- a/modules/Bio/EnsEMBL/Biotype.pm +++ b/modules/Bio/EnsEMBL/Biotype.pm @@ -90,9 +90,6 @@ use base qw(Bio::EnsEMBL::Storable); Description: Creates a new biotype object Returntype : Bio::EnsEMBL::Biotype Exceptions : none - Caller : general - Status : Stable - =cut @@ -126,8 +123,6 @@ sub new { Description: Getter/Setter for the name of this biotype. Returntype : string Exceptions : none - Caller : general - Status : Stable =cut @@ -146,6 +141,8 @@ sub name { Arg [1] : (optional) string $biotype_group Example : $biotype_group = $biotype->biotype_group(); Description: Getter/Setter for the biotype_group of this biotype. + Biotype groups are used internally at ensembl pipelines + and consist on few defined categories. Returntype : string Exceptions : none Caller : general @@ -167,14 +164,10 @@ sub biotype_group { Arg [1] : (optional) string $so_acc Example : $feat->so_acc(); - Description: Getter/Setter for the so_acc of this biotype. - It must be a Sequence Ontology like accession (SO:\d*) - -1 is the reverse (negative) so_acc and 1 is the forward - (positive) so_acc. No other values are permitted. + Description: Getter/Setter for the Sequence Ontology accession of this biotype. + It must be a SO like accession. Returntype : string Exceptions : thrown if an invalid so_acc argument is passed - Caller : general - Status : Stable =cut @@ -197,10 +190,10 @@ sub so_acc { Arg [1] : (optional) string $object_type Example : $object_type = $biotype->object_type(); Description: Getter/Setter for the object_type of this biotype. + Biotypes can be assigned to either genes or transcripts, + object_type refers to which of them. Returntype : string - Exceptions : none - Caller : general - Status : Stable + Exceptions : thrown if an invalid object_type argument is passed (not gene or transcript) =cut @@ -208,31 +201,16 @@ sub object_type { my ( $self, $value ) = @_; if ( defined($value) ) { + $value = lc $value; + throw("object_type must be gene or transcript. Got '$value'.") + unless ( $value eq 'gene' || $value eq 'transcript' ); + $self->{'object_type'} = $value; } return $self->{'object_type'}; } -=head2 as_hash - - Example : $biotype_hash = $biotype->as_hash(); - Description : Retrieves this Biotype as a hash. - Returns : hashref of descriptive strings - Status : Intended for internal use -=cut - -sub as_hash { - my ( $self ) = @_; - - return { - name => $self->name, - biotype_group => $self->biotype_group, - so_acc => $self->so_acc, - object_type => $self->object_type, - }; -} - use overload '""' => \&as_string; @@ -245,7 +223,7 @@ use overload '""' => \&as_string; If Biotype object is called this is what is returned to maintain compatibility with legacy biotype() methods in Gene and Transcript objects. Returns : string for the biotype. - Status : Intended for internal use + =cut sub as_string { diff --git a/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm index 6fc73229e2c3d53268617eb7b895e733aef99f74..97ebb4144a1761734d3643d4839d2b64bedeaf9b 100644 --- a/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm @@ -30,19 +30,20 @@ limitations under the License. =head1 NAME -Bio::EnsEMBL::DBSQL::BiotypeAdaptor - Encapsulates all generic access -to database meta information + Bio::EnsEMBL::DBSQL::BiotypeAdaptor - An adaptor which performs database + interaction relating to the storage and retrieval of Biotypes =head1 SYNOPSIS - my $meta_container = $db_adaptor->get_MetaContainer(); - - my @mapping_info = - @{ $meta_container->list_value_by_key('assembly.mapping') }; + my $biotype = $db_adaptor->fetch_by_name_object_type('protein_coding', 'gene'); =head1 DESCRIPTION - An object that encapsulates access to db meta data + This adaptor provides a means to retrieve and store information related + to Biotypes. Primarily this involves the retrieval or storage of + Bio::EnsEMBL::Biotype objects from a database. + + See Bio::EnsEMBL::Biotype for details of the Biotype class. =head1 METHODS @@ -66,8 +67,6 @@ use base qw(Bio::EnsEMBL::DBSQL::BaseAdaptor); Returns the names, aliases of the tables to use for queries. Returntype : list of listrefs of strings Exceptions : none - Caller : internal - Status : Stable =cut @@ -85,8 +84,6 @@ sub _tables { Returns a list of columns to use for queries. Returntype : list of strings Exceptions : none - Caller : internal - Status : Stable =cut @@ -102,10 +99,8 @@ sub _columns { Example : none Description: PROTECTED implementation of abstract superclass method. responsible for the creation of ProteinFeatures - Returntype : listref of Bio::EnsEMBL::Biotype + Returntype : listref of Bio::EnsEMBL::Biotype objects Exceptions : none - Caller : internal - Status : At Risk =cut @@ -149,8 +144,6 @@ sub _objs_from_sth { created with the provided name and object_type to be returned. Returntype : Bio::EnsEMBL::Biotype Exceptions : none - Caller : general - Status : Stable =cut @@ -179,10 +172,8 @@ sub fetch_by_name_object_type { The object_type of the biotypes to retrieve (gene or transcript). Example : $biotypes = $biotype_adaptor->fetch_all_by_object_type('gene'); Description: Retrieves an array reference of biotype objects from the database. - Returntype : listref of Bio::EnsEMBL::Biotype objects or undef + Returntype : listref of Bio::EnsEMBL::Biotype objects or empty list Exceptions : none - Caller : general - Status : Stable =cut