Bio-EnsEMBL
view release on metacpan or search on metacpan
lib/Bio/EnsEMBL/DBSQL/BaseAlignFeatureAdaptor.pm view on Meta::CPAN
Name of the external DB to which the align features
should be restricted.
Arg [3] : (optional) string $logic_name
The logic name of the type of features to obtain.
Example : @feats = @{
$adaptor->fetch_all_by_Slice_and_external_db( $slice,
'EMBL' ) };
Description: Returns a listref of features created from the
database which are on the Slice $slice and associated
with external DB $external_db_name. If logic name
is defined, only features with an analysis of type
$logic_name will be returned.
Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures
in Slice coordinates
Exceptions : thrown if $external_db_name is not defined or if
the subclass does not return a table alias for the
external_db table from _tables()
Caller : general
Status : At Risk
=cut
sub fetch_all_by_Slice_and_external_db {
my ( $self, $slice, $external_db_name, $logic_name ) = @_;
if ( !defined($external_db_name) ) {
throw("Need name of external DB to restrict to");
}
my @join_tables = $self->_tables();
my $edb_alias;
foreach my $join_table (@join_tables) {
my ( $table, $table_alias ) = @{$join_table};
if ( $table eq 'external_db' ) {
$edb_alias = $table_alias;
last;
}
}
if ( !defined($edb_alias) ) {
throw("Can not find alias for external_db table");
}
my $constraint = sprintf( "%s.db_name = %s",
$edb_alias,
$self->dbc()->db_handle()
->quote( $external_db_name, SQL_VARCHAR )
);
return
$self->fetch_all_by_Slice_constraint( $slice, $constraint,
$logic_name );
} ## end sub fetch_all_by_Slice_and_external_db
=head2 fetch_all_by_Slice_and_pid
Arg [1] : Bio::EnsEMBL::Slice $slice
The slice from which to obtain align features.
Arg [2] : (optional) float $pid
A lower bound for the percentage identity of features
to obtain.
Arg [3] : (optional) string $logic_name
The logic name of the type of features to obtain.
Example : @feats =
@{ $adaptor->fetch_all_by_Slice_and_pid( $slice, 50.0 ) };
Description: Returns a listref of features created from the
database which are on the Slice $slice and with a
percentage identity greater than $pid. If logic name
is defined, only features with an analysis of type
$logic_name will be returned.
Returntype : listref of Bio::EnsEMBL::BaseAlignFeatures
in Slice coordinates
Exceptions : none
Caller : general
Status : Stable
=cut
sub fetch_all_by_Slice_and_pid {
my ( $self, $slice, $pid, $logic_name ) = @_;
# #get the primary table alias
# my @tabs = $self->_tables;
# my $alias = $tabs[0]->[1];
# if(defined $pid) {
# $constraint = "${alias}.perc_ident > $pid";
# }
my $constraint;
if ( defined($pid) ) {
$constraint = sprintf( "perc_ident > %s",
$self->dbc()->db_handle()
->quote( $pid, SQL_FLOAT ) );
}
return
$self->fetch_all_by_Slice_constraint( $slice, $constraint,
$logic_name );
}
=head2 fetch_all_by_hit_name
Arg [1] : string $hit_name
The hit_name of the features to obtain
Arg [2] : (optional) string $logic_name
The analysis logic name of the type of features to
obtain.
Example : @feats =
@{ $adaptor->fetch_all_by_hit_name( 'AK078491.1',
'vertrna' ); }
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
Status : Stable
=cut
sub fetch_all_by_hit_name {
my ( $self, $hit_name, $logic_name ) = @_;
if ( !defined($hit_name) ) {
throw("hit_name argument is required");
( run in 0.562 second using v1.01-cache-2.11-cpan-39bf76dae61 )