diff --git a/modules/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm index 46da872448c57387580bdc36559b672e9d6c9807..87b8dcfbd7d9525932cabb7280830075ff707f62 100644 --- a/modules/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm @@ -81,6 +81,41 @@ sub fetch_all_by_Slice_and_pid { } +=head2 fetch_all_by_hit_name + + Arg [1] : string $hit_name + the hit_name of the features to obtain + Arg [3] : (optional) string $logic_name + the analysis logic name of the type of features to obtain + Example : @feats = $adaptor->fetch_all_by_hit_name($name, $logic_name); + Description: Returns a listref of features created from the database + which correspond to the given hit_name. If logic name + is defined, only features with an analysis of type + $logic_name will be returned. + Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures + Exceptions : thrown if hit_name is not defined + Caller : general + +=cut + +sub fetch_all_by_hit_name{ + my( $self, $hit_name, $logic_name ) = @_; + throw("hit_name argument is required") if(! $hit_name); + + #construct a constraint like 't1.hit_name = "123"' + my @tabs = $self->_tables; + my ($name, $syn) = @{$tabs[0]}; + my $constraint = ( "${syn}.hit_name = '$hit_name'" ); + + if( $logic_name ){ + # Add the $logic_name constraint + $constraint = $self->_logic_name_to_constraint($constraint, $logic_name); + } + return $self->generic_fetch($constraint); +} + + + =head2 fetch_all_by_RawContig_and_pid Description: DEPRECATED use fetch_all_by_Slice_and_pid instead