Skip to content
Snippets Groups Projects
Commit 76b7ff0a authored by Arne Stabenau's avatar Arne Stabenau
Browse files

minor changes, formatting

parent d154c61e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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;
}
......
......@@ -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" );
}
......
......@@ -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;
}
......
......@@ -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);
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