diff --git a/modules/Bio/EnsEMBL/Biotype.pm b/modules/Bio/EnsEMBL/Biotype.pm index 11b7c5e104d6c903c03414791de8ec2994894b66..9adef5a13ceccc1ae597aeb68fdc6dbd3497516d 100644 --- a/modules/Bio/EnsEMBL/Biotype.pm +++ b/modules/Bio/EnsEMBL/Biotype.pm @@ -64,6 +64,7 @@ use Bio::EnsEMBL::Storable; use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning); use Bio::EnsEMBL::Utils::Scalar qw(check_ref assert_ref); use Bio::EnsEMBL::Utils::Argument qw(rearrange); +use Scalar::Util qw(weaken isweak); use base qw(Bio::EnsEMBL::Storable); @@ -115,6 +116,25 @@ sub new { return $self; } +=head2 new_fast + + Arg [1] : hashref to be blessed + Description: Construct a new Bio::EnsEMBL::Biotype using the hashref. + Exceptions : none + Returntype : Bio::EnsEMBL::Biotype + +=cut + + +sub new_fast { + my ( $class, $hashref ) = @_; + + my $self = bless $hashref, $class; + weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) ); + + return $self; +} + =head2 name Arg [1] : (optional) string $name diff --git a/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm index 97ebb4144a1761734d3643d4839d2b64bedeaf9b..d1956332a6aaf99f6ba0faa7e456a560951ee4cf 100644 --- a/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/BiotypeAdaptor.pm @@ -115,16 +115,16 @@ sub _objs_from_sth { while($sth->fetch()) { push( @biotypes, - my $feat = Bio::EnsEMBL::Biotype->new( - -BIOTYPE_ID => $dbID, - -NAME => $name, - -OBJECT_TYPE => $object_type, - -DB_TYPE => $db_type, - -ATTRIB_TYPE_ID => $attrib_type_id, - -DESCRIPTION => $description, - -BIOTYPE_GROUP => $biotype_group, - -SO_ACC => $so_acc, - ) + my $feat = Bio::EnsEMBL::Biotype->new_fast( { + 'dbID' => $dbID, + 'name' => $name, + 'object_type' => $object_type, + 'db_type' => $db_type, + 'attrib_type_id' => $attrib_type_id, + 'description' => $description, + 'biotype_group' => $biotype_group, + 'so_acc' => $so_acc, + } ) ); }