Skip to content
Snippets Groups Projects
Commit e2143b19 authored by Ensembl Account's avatar Ensembl Account
Browse files

fetch_attributes only needs to come from SNP if possible

parent a032c47c
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,43 @@ use vars ('@ISA', '$AUTOLOAD');
@ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
=head2 fetch_attributes_only
Arg [1] : int refsnp_id
Arg [2] : (optional) string source
Example : none
Description: Retrieves a snp objcet from the SNP database but does not
populate the location information. This is necessary given
the current state of the snp database because location
information has to be retrieved differently for different
species!
Returntype : Bio::EnsEMBL::SNP
Exceptions : none
Caller : snpview
=cut
sub fetch_attributes_only{
my ( $self, @args ) = @_;
my $lite_db = Bio::EnsEMBL::Registry->get_db($self->db(),'lite');
my $snp_db = Bio::EnsEMBL::Registry->get_db($self->db(),'SNP');
if( defined $snp_db ) {
my $snp_adaptor = $snp_db->get_SNPAdaptor();
return $snp_adaptor->fetch_attributes_only( @args );
}
if( defined $lite_db ) {
my $snp_adaptor = $lite_db->get_SNPAdaptor();
return $snp_adaptor->fetch_attributes_only( @args );
}
}
=head2 AUTOLOAD
......@@ -63,26 +100,25 @@ sub AUTOLOAD {
#strip out fully qualified method name
$method =~ s/.*:://;
my $lite_db = Bio::EnsEMBL::Registry->get_db($self->db(),'lite');
my $snp_db = Bio::EnsEMBL::Registry->get_db($self->db(),'SNP');
#
# First try the primary adaptor
#
if( defined $lite_db ) {
my $snp_adaptor = $lite_db->get_SNPAdaptor();
if($snp_adaptor->can($method)) {
return $snp_adaptor->$method(@args);
}
}
my $snp_adaptor = $snp_db->get_SNPAdaptor();
if($snp_adaptor->can($method)) {
return $snp_adaptor->$method(@args);
if( defined $snp_db ) {
my $snp_adaptor = $snp_db->get_SNPAdaptor();
if($snp_adaptor->can($method)) {
return $snp_adaptor->$method(@args);
}
}
throw("The requested method $method could not be found in lite or snp" );
}
......
......@@ -32,7 +32,7 @@ use Bio::EnsEMBL::Utils::Exception qw(warning stack_trace_dump);
use DBD::mysql;
use DBI;
# use Time::HiRes qw(time);
use Time::HiRes qw(time);
@ISA = qw(DBI::st);
......@@ -76,32 +76,32 @@ sub sql {
#
# uncomment this for printing out handy debug information (every query)
#
# sub execute {
# my $self = shift;
sub execute {
my $self = shift;
# my $sql = $self->sql();
my $sql = $self->sql();
# my @chrs = split(//, $sql);
my @chrs = split(//, $sql);
# my $j = 0;
# for(my $i =0; $i < @chrs; $i++) {
# $chrs[$i] = $_[$j++] if($chrs[$i] eq '?' && defined($_[$j]));
# }
my $j = 0;
for(my $i =0; $i < @chrs; $i++) {
$chrs[$i] = $_[$j++] if($chrs[$i] eq '?' && defined($_[$j]));
}
# my $str = join('', @chrs);
my $str = join('', @chrs);
# my $time = time;
# print STDERR "\nSQL:\n$str\n\n";
my $time = time;
print STDERR "\nSQL:\n$str\n\n";
# # print STDERR stack_trace_dump(), "\n";
# print STDERR stack_trace_dump(), "\n";
# my $res = $self->SUPER::execute(@_);
# $time = time - $time;
# print STDERR "DONE ($time)\n";
my $res = $self->SUPER::execute(@_);
$time = time - $time;
print STDERR "DONE ($time)\n";
# return $res;
# }
return $res;
}
sub DESTROY {
......
......@@ -202,7 +202,7 @@ sub fetch_all_by_Slice_transcript_ids {
return $snps;
}
sub fetch_attributes_only{
sub fetch_attributes_only_lite{
my $self = shift;
my $refsnp_id = shift;
......
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