diff --git a/modules/Bio/EnsEMBL/DBSQL/AssemblyMapperAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/AssemblyMapperAdaptor.pm index 4d0ae2849308547ab0187fd11e5e0935f70793ce..1771ebd7eeb386fe9a15f8b85f09d8031cffbc0e 100644 --- a/modules/Bio/EnsEMBL/DBSQL/AssemblyMapperAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/AssemblyMapperAdaptor.pm @@ -129,7 +129,7 @@ sub register_region{ $self->throw("$assmapper is not a Bio::EnsEMBL::AssemblyMapper") unless $assmapper->isa("Bio::EnsEMBL::AssemblyMapper"); - my $chr = $self->db->get_ChromosomeAdaptor()->fetch_by_name( $chr_name ); + my $chr = $self->db->get_ChromosomeAdaptor()->fetch_by_chr_name( $chr_name ); my $chr_id = $chr->dbID(); my $max_assembly_contig = $self->db()->get_MetaContainer->get_max_assembly_contig(); @@ -142,7 +142,7 @@ sub register_region{ ass.chr_start, ass.chr_end from - assembly ass, + assembly ass where ass.chromosome_id = $chr_id and ? <= ass.chr_end and diff --git a/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm index 707f5cc978c58492e59af72ef41e07883a6ccb93..5d10d61fcaf4b95eae270cad5cd14e9acfabc844 100755 --- a/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm @@ -1124,7 +1124,8 @@ sub set_adaptor() { Arg [1] : List of names of feature adaptors to get. If no adaptor names are given, all the defined adaptors are returned. Example : $db->get_GenericFeature("SomeFeature", "SomeOtherFeature") Description: Returns a hash containing the named feature adaptors (or all feature adaptors). - Returntype : Hash containing the named feature adaptors (or all feature adaptors). + Returntype : reference to a Hash containing the named + feature adaptors (or all feature adaptors). Exceptions : If any of the the named generic feature adaptors do not exist. Caller : external @@ -1132,22 +1133,22 @@ sub set_adaptor() { sub get_GenericFeatureAdaptors() { - my ($self, @names) = @_; + my ($self, @names) = @_; - my %adaptors = {}; + my %adaptors = (); - if (!@names) { - %adaptors = %{$self->{'generic_feature_adaptors'}}; - } else { - foreach my $name (@names) { - if (!exists($self->{'generic_feature_adaptors'}->{$name})) { - $self->throw("No generic feature adaptor has been defined for $name" ); - } - %adaptors->{$name} = $self->{'generic_feature_adaptors'}->{$name}; - } - } + if (!@names) { + %adaptors = %{$self->{'generic_feature_adaptors'}}; + } else { + foreach my $name (@names) { + if (!exists($self->{'generic_feature_adaptors'}->{$name})) { + $self->throw("No generic feature adaptor has been defined for $name" ); + } + $adaptors{$name} = $self->{'generic_feature_adaptors'}->{$name}; + } + } - return %adaptors; + return \%adaptors; } diff --git a/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm index 90e533b33de031253295436c736de7363738db01..1c9aabbb1ca4faa3d0a6ff749350e85fa1f2df4f 100644 --- a/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm @@ -70,6 +70,8 @@ sub fetch_by_RawContig_start_end_strand { my ( $self, $contig, $start, $end, $strand, $compressed ) = @_; my $sth; + $compressed ||= 0; + if( $start < 1 ) { $self->throw( "Wrong parameters" ); } diff --git a/modules/Bio/EnsEMBL/Slice.pm b/modules/Bio/EnsEMBL/Slice.pm index e2955fc30860da3e083c98b93e3c0fc8645639f4..9d938c9f0f23c02099f60926204da1f85a6a269a 100644 --- a/modules/Bio/EnsEMBL/Slice.pm +++ b/modules/Bio/EnsEMBL/Slice.pm @@ -1496,25 +1496,25 @@ sub get_generic_features() { my ($self, @names) = @_; - my $db = $self->adaptor()->db(); + my $db = $self->adaptor()->db(); - my %features = {}; # this will hold the results + my %features = (); # this will hold the results - # get the adaptors for each feature - my %adaptors = $db->get_GenericFeatureAdaptors(@names); + # get the adaptors for each feature + my %adaptors = %{$db->get_GenericFeatureAdaptors(@names)}; - foreach my $adaptor_name (keys(%adaptors)) { + foreach my $adaptor_name (keys(%adaptors)) { - my $adaptor_obj = %adaptors->{$adaptor_name}; - # get the features and add them to the hash - my $features_ref = $adaptor_obj->fetch_all_by_Slice($self); - # add each feature to the hash to be returned - foreach my $feature (@$features_ref) { - %features->{$adaptor_name} = $feature; - } - } - - return %features; + my $adaptor_obj = %adaptors->{$adaptor_name}; + # get the features and add them to the hash + my $features_ref = $adaptor_obj->fetch_all_by_Slice($self); + # add each feature to the hash to be returned + foreach my $feature (@$features_ref) { + $features{$adaptor_name} = $feature; + } + } + + return \%features; } diff --git a/modules/t/canonicalDBAdaptor.t b/modules/t/canonicalDBAdaptor.t index 8e6980cb457dbd15da65d5a6a604e0000ae420cf..fb41b1080e71b9d1530106d1f52c50ca617b4c46 100644 --- a/modules/t/canonicalDBAdaptor.t +++ b/modules/t/canonicalDBAdaptor.t @@ -119,11 +119,11 @@ ok($db->add_GenericFeatureAdaptor("Simple", $sfa)); # Check get-ing the above # by name ... -my %generic_adaptors = $db->get_GenericFeatureAdaptors("Simple", "Repeat"); +my %generic_adaptors = %{$db->get_GenericFeatureAdaptors("Simple", "Repeat")}; ok(%generic_adaptors); # no arg should return all -%generic_adaptors = $db->get_GenericFeatureAdaptors(); +%generic_adaptors = %{$db->get_GenericFeatureAdaptors()}; my $size = keys(%generic_adaptors); ok($size == 2); @@ -135,5 +135,5 @@ ok($@); my $slice = $db->get_SliceAdaptor()->fetch_by_chr_start_end('X', 1, 10000); ok($slice); -my %features = $slice->get_generic_features(); -ok(%features); +my %features = %{$slice->get_generic_features()}; +ok(!%features);