Skip to content
Snippets Groups Projects
Commit a032c47c authored by Graham McVicker's avatar Graham McVicker
Browse files

max feature length can be overridden, allows optimization for misc feature retrieval

parent 71ca02a8
No related branches found
No related tags found
No related merge requests found
......@@ -492,7 +492,7 @@ sub _slice_fetch {
if($feat_cs->equals($slice_cs)) {
# no mapping is required if this is the same coord system
my $max_len =
my $max_len = $self->_max_feature_length() ||
$mcc->fetch_max_length_by_CoordSystem_feature_type($feat_cs,$tab_name);
my $constraint = $orig_constraint;
......@@ -552,7 +552,7 @@ sub _slice_fetch {
} else {
# do multiple split queries using start / end constraints
my $max_len =
my $max_len = $self->_max_feature_length() ||
$mcc->fetch_max_length_by_CoordSystem_feature_type($feat_cs,
$tab_name);
my $len = @coords;
......@@ -1044,6 +1044,21 @@ sub _objs_from_sth {
}
#
# Internal function. Allows the max feature length which is normally
# retrieved from the meta_coord table to be overridden. This allows
# for some significant optimizations to be put in when it is known
# that requested features will not be over a certain size.
#
sub _max_feature_length {
my $self = shift;
return $self->{'_max_feature_length'} = shift if(@_);
return $self->{'_max_feature_length'};
}
=head1 DEPRECATED METHODS
=cut
......
......@@ -87,8 +87,10 @@ sub fetch_all_by_Slice_and_set_code {
my $msa = $self->db->get_MiscSetAdaptor();
my @sets = ();
my $max_len = 0;
foreach my $set_code (@_) {
my $set = $msa->fetch_by_code($set_code);
$max_len = $set->longest_feature() if($set->longest_feature > $max_len);
if(!$set) { warning("No misc_set with code [$set_code] exists") }
else { push @sets, $set->dbID; }
}
......@@ -100,7 +102,14 @@ sub fetch_all_by_Slice_and_set_code {
} else {
return [];
}
return $self->fetch_all_by_Slice_constraint($slice, $constraint);
$self->_max_feature_length($max_len);
my $results = $self->fetch_all_by_Slice_constraint($slice, $constraint);
$self->_max_feature_length(undef);
return $results;
}
......
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