Commit 29b0c52f authored by Alessandro Vullo's avatar Alessandro Vullo
Browse files

Storable gets a new_fast implementation which transfers to all its descendants.

This means that CoordSystem, DensityType, Map::Marker, Map::Ditag, Map::Qtl,
MiscSet, OntologyTerm and SeqRegionSynonym have now a fast constructor available.

Accordingly, new_fast is removed from Analysis, Feature, DataFile, DBEntry, RepeatConsensus,
Translation and UnmappedObject together with the import of weaken and isweak from
Scalar::Util.
parent 8d084737
...@@ -62,7 +62,6 @@ use Bio::EnsEMBL::Storable; ...@@ -62,7 +62,6 @@ use Bio::EnsEMBL::Storable;
use Bio::EnsEMBL::Utils::Exception qw(throw); use Bio::EnsEMBL::Utils::Exception qw(throw);
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Scalar::Util qw/isweak weaken/;
@ISA = qw(Bio::EnsEMBL::Storable); @ISA = qw(Bio::EnsEMBL::Storable);
...@@ -148,23 +147,6 @@ sub new { ...@@ -148,23 +147,6 @@ sub new {
return $self; # success - we hope! return $self; # success - we hope!
} }
=head2 new_fast
Arg [1] : HashRef $hashref
Value to bless
Description: Bless a hash into this object type
Exceptions : none
Returntype : Bio::EnsEMBL::Analysis
Caller : general, subclass constructors
=cut
sub new_fast {
my ($class, $hashref) = @_;
my $self = bless $hashref, ref($class) || $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 db =head2 db
......
...@@ -135,7 +135,6 @@ package Bio::EnsEMBL::BaseAlignFeature; ...@@ -135,7 +135,6 @@ package Bio::EnsEMBL::BaseAlignFeature;
use Bio::EnsEMBL::FeaturePair; use Bio::EnsEMBL::FeaturePair;
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Scalar::Util qw(weaken isweak);
use vars qw(@ISA); use vars qw(@ISA);
use strict; use strict;
......
...@@ -43,33 +43,9 @@ use Bio::Annotation::DBLink; ...@@ -43,33 +43,9 @@ use Bio::Annotation::DBLink;
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Exception qw(deprecate); use Bio::EnsEMBL::Utils::Exception qw(deprecate);
use Scalar::Util qw(weaken isweak);
our @ISA = qw(Bio::EnsEMBL::Storable Bio::Annotation::DBLink); our @ISA = qw(Bio::EnsEMBL::Storable Bio::Annotation::DBLink);
=head2 new_fast
Arg [1] : Hashref $hashref - hash reference to bless as new DBEntry object
Description: A very quick constructor that requires internal knowledge of
the class. This is used in speed critical sections of the code
where many objects need to be created quickly.
Returntype : Bio::EnsEMBL::DBEntry
Exceptions : none
Caller : general
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 new =head2 new
Args [...] : list of named parameters Args [...] : list of named parameters
......
...@@ -11,7 +11,6 @@ use Bio::EnsEMBL::Utils::Exception qw/throw warning/; ...@@ -11,7 +11,6 @@ use Bio::EnsEMBL::Utils::Exception qw/throw warning/;
use Bio::EnsEMBL::Utils::Scalar qw/:assert/; use Bio::EnsEMBL::Utils::Scalar qw/:assert/;
use Bio::EnsEMBL::Utils::URI qw/is_uri/; use Bio::EnsEMBL::Utils::URI qw/is_uri/;
use File::Spec; use File::Spec;
use Scalar::Util qw(weaken isweak);
=head2 new =head2 new
...@@ -48,24 +47,6 @@ sub new { ...@@ -48,24 +47,6 @@ sub new {
return $self; return $self;
} }
=head2 new_fast
Arg [1] : hashref to be blessed
Description: Construct a new Bio::EnsEMBL::Feature using the hashref.
Exceptions : none
Returntype : Bio::EnsEMBL::Feature
Caller : general, subclass constructors
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 get_ExternalAdaptor =head2 get_ExternalAdaptor
...@@ -306,4 +287,4 @@ sub file_type { ...@@ -306,4 +287,4 @@ sub file_type {
# #
#} #}
1; 1;
\ No newline at end of file
...@@ -144,42 +144,6 @@ sub new { ...@@ -144,42 +144,6 @@ sub new {
} }
# =head2 new_fast
# Arg [1] : Bio::EnsEMBL::Slice $slice
# Arg [2] : int $start
# Arg [3] : int $end
# Arg [4] : int $strand (1 or -1)
# Example : none
# Description: create an Exon object
# Returntype : Bio::EnsEMBL::Exon
# Exceptions : throws if end < start
# Caller : general
# Status : Stable
# =cut
# sub new_fast {
# my ($class, $slice, $start, $end, $strand) = @_;
# my $self = bless {}, $class;
# # Swap start and end if they're in the wrong order
# # We assume that the strand is correct and keep the input value.
# if ($start > $end) {
# throw( "End smaller than start not allowed" );
# }
# $self->start ($start);
# $self->end ($end);
# $self->strand($strand);
# $self->slice($slice);
# return $self;
# }
=head2 end_phase =head2 end_phase
Arg [1] : (optional) int $end_phase Arg [1] : (optional) int $end_phase
......
...@@ -75,7 +75,7 @@ use Bio::EnsEMBL::Slice; ...@@ -75,7 +75,7 @@ use Bio::EnsEMBL::Slice;
use Bio::EnsEMBL::StrainSlice; use Bio::EnsEMBL::StrainSlice;
use vars qw(@ISA); use vars qw(@ISA);
use Scalar::Util qw(weaken isweak); use Scalar::Util qw(weaken);
@ISA = qw(Bio::EnsEMBL::Storable); @ISA = qw(Bio::EnsEMBL::Storable);
...@@ -161,26 +161,6 @@ sub new { ...@@ -161,26 +161,6 @@ sub new {
} }
=head2 new_fast
Arg [1] : hashref to be blessed
Description: Construct a new Bio::EnsEMBL::Feature using the hashref.
Exceptions : none
Returntype : Bio::EnsEMBL::Feature
Caller : general, subclass constructors
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 start =head2 start
Arg [1] : (optional) int $start Arg [1] : (optional) int $start
......
...@@ -110,7 +110,6 @@ use warnings; ...@@ -110,7 +110,6 @@ use warnings;
use Bio::EnsEMBL::Feature; use Bio::EnsEMBL::Feature;
use Bio::EnsEMBL::Utils::Exception qw(throw); use Bio::EnsEMBL::Utils::Exception qw(throw);
use Scalar::Util qw(weaken isweak);
use vars qw(@ISA); use vars qw(@ISA);
......
...@@ -24,7 +24,6 @@ use strict; ...@@ -24,7 +24,6 @@ use strict;
use Bio::EnsEMBL::Storable; use Bio::EnsEMBL::Storable;
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Scalar::Util qw(weaken isweak);
use vars qw(@ISA); use vars qw(@ISA);
@ISA = qw(Bio::EnsEMBL::Storable); @ISA = qw(Bio::EnsEMBL::Storable);
...@@ -79,27 +78,6 @@ sub new { ...@@ -79,27 +78,6 @@ sub new {
} }
=head2 new_fast
Arg [1] : hashref to bless as a new RepeatConsensus
Description: Creates a new Bio::EnsEMBL::RepeatConsensus object
Returntype : Bio::EnsEMBL::RepeatConsensus
Exceptions : none
Caller : internal
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 name =head2 name
Arg [1] : string $name (optional) Arg [1] : string $name (optional)
......
...@@ -46,7 +46,7 @@ package Bio::EnsEMBL::Storable; ...@@ -46,7 +46,7 @@ package Bio::EnsEMBL::Storable;
use Bio::EnsEMBL::Utils::Exception qw(throw warning); use Bio::EnsEMBL::Utils::Exception qw(throw warning);
use Bio::EnsEMBL::Utils::Argument qw(rearrange); use Bio::EnsEMBL::Utils::Argument qw(rearrange);
use Bio::EnsEMBL::Utils::Scalar qw(assert_ref); use Bio::EnsEMBL::Utils::Scalar qw(assert_ref);
use Scalar::Util qw(weaken); use Scalar::Util qw(weaken isweak);
=head2 new =head2 new
...@@ -77,6 +77,28 @@ sub new { ...@@ -77,6 +77,28 @@ sub new {
return $self; return $self;
} }
=head2 new_fast
Arg [1] : hashref to be blessed
Description: Construct a new Bio::EnsEMBL::Storable object using the hashref.
This is a very quick constructor that requires internal knowledge
of the class. This is used in speed critical sections of the code
where many objects need to be created quickly.
Exceptions : none
Returntype : Instance of Bio::EnsEMBL::Storable subclass
Caller : general, subclass constructors
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 dbID =head2 dbID
......
...@@ -52,11 +52,10 @@ package Bio::EnsEMBL::Translation; ...@@ -52,11 +52,10 @@ package Bio::EnsEMBL::Translation;
use vars qw($AUTOLOAD @ISA); use vars qw($AUTOLOAD @ISA);
use strict; use strict;
use Scalar::Util qw(weaken isweak);
use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning ); use Bio::EnsEMBL::Utils::Exception qw( deprecate throw warning );
use Bio::EnsEMBL::Utils::Argument qw( rearrange ); use Bio::EnsEMBL::Utils::Argument qw( rearrange );
use Bio::EnsEMBL::Utils::Scalar qw( assert_ref ); use Bio::EnsEMBL::Utils::Scalar qw( assert_ref );
use Scalar::Util qw(weaken);
use Bio::EnsEMBL::Storable; use Bio::EnsEMBL::Storable;
...@@ -123,25 +122,7 @@ sub new { ...@@ -123,25 +122,7 @@ sub new {
return $self; return $self;
} }
=head2 new_fast
Arg [1] : hashref to be blessed
Description: Construct a new Bio::EnsEMBL::Translation using the hashref.
Exceptions : none
Returntype : Bio::EnsEMBL::Translation
Caller : general, subclass constructors
Status : Stable
=cut
sub new_fast {
my $class = shift;
my $hashref = shift;
my $self = bless $hashref, $class;
weaken($self->{adaptor}) if ( ! isweak($self->{adaptor}) );
return $self;
}
=head2 transcript =head2 transcript
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment