Commit 19ab0154 authored by Ian Longden's avatar Ian Longden
Browse files

backwards compatibillity fix

parent e1538de3
......@@ -681,7 +681,7 @@ sub dnadb {
if(@_) {
my $arg = shift;
$reg->add_DNAAdaptor($self->species(),$self->group(),$arg->group());
$reg->add_DNAAdaptor($self->species(),$self->group(),$arg->species(),$arg->group());
}
# return $self->{'dnadb'} || $self;
......
......@@ -159,47 +159,6 @@ sub load_all{
}
}
#=head2 check_if_already_there
#
# Arg [DBNAME] : string
# The name of the database to check for.
# Arg [HOST] : (optional) string
# The domain name of the database host to check for
# Arg [PORT] : int
# The port to check for when connecting to the database
# Arg [DRIVER] : (optional) string
# The type of database driver to check for
#
# Description: Check to see if the database is already stored.
# Returntype : 0 if not found else the species and group.
# Exceptions : none
#
#
#=cut
#sub check_if_already_there{
# my ($class) = shift;
#
# my ($dbname,$host,$driver,$port,$species, $group ) =
# rearrange([qw(DBNAME HOST DRIVER PORT SPECIES GROUP)], @_);
#
# if(defined($registry_register{'_DBA'})){
# foreach my $db (@{$registry_register{'_DBA'}}){
# my $dbc= $db->db();
# if($dbc->host() eq $host and $dbc->dbname() eq $dbname
# and $dbc->driver() eq $driver and $dbc->port() eq $port){
# if(defined($species) and defined($group) and
# $db->species eq $species and $db->group eq $group){
# return ($db->species(),$db->group());
# }
# }
# }
# }
# return 0;
#}
#
# add ons.
#
......@@ -382,16 +341,15 @@ sub get_all_DBAdaptors{
=cut
sub add_DNAAdaptor{
my ($class, $species, $group, $dnadb_group) = @_;
my ($class, $species, $group, $dnadb_species, $dnadb_group) = @_;
$species = $class->get_alias($species);
if($dnadb_group->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')){
# print STDERR "AHHH ".caller()."\n";
$registry_register{$species}{$group}{'_DNA'} = $dnadb_group->group();
deprecated("");
}
else{
# print STDERR "AHHH MEN ".caller()."\n";
$registry_register{$species}{$group}{'_DNA'} = $dnadb_group;
$registry_register{$species}{$group}{'_DNA2'} = $dnadb_species;
}
}
......@@ -410,8 +368,9 @@ sub get_DNAAdaptor{
$species = $class->get_alias($species);
my $new_group = $registry_register{$species}{$group}{'_DNA'};
my $new_species = $registry_register{$species}{$group}{'_DNA2'};
if( defined $new_group ) {
return $class->get_DBAdaptor($species,$new_group);
return $class->get_DBAdaptor($new_species,$new_group);
} else {
return undef;
}
......@@ -525,25 +484,12 @@ sub get_adaptor{
my $dnadb_group = $registry_register{$species}{$group}{_DNA};
if( defined($dnadb_group) && defined($dnadb_adaptors{$type}) ) {
# print STDERR "new### $group $dnadb_group \n";
$group = $dnadb_group;
}
# else{
# if (defined($dnadb_adaptors{$type}) ) {
# print STDERR "old### $species $group $type no dnadb \n";
# }
# }
#throw in a check to see if we should get the dnadb one and not the normal
# if(defined($registry_register{$species}{$type}{'DNADB'}) && $class->get_DNAAdaptor($species,$group)){
# my $dna = $class->get_DNAAdaptor($species,$group);
# $species = $dna->species();
# $group = $dna->group();
# }
my $ret = $registry_register{$species}{$group}{$type};
if(!defined($ret)){
return undef;
# throw("COULD NOT FIND ADAPTOR species=$species\tgroup=$group\ttype=$type\n");
}
if(!ref($ret)){ # not instantiated yet
my $dba = $registry_register{$species}{$group}{'_DB'};
......
......@@ -52,6 +52,15 @@ use Bio::EnsEMBL::Utils::Exception qw(warning throw deprecate stack_trace_dump)
=cut
#
# 1) core. no need to add dnadb
# 2) not core add dnadb
# 3)
#
sub gen_load{
my ($dba) = @_;
my $config_sub;
......@@ -102,6 +111,9 @@ sub gen_load{
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_haplotype;
}
elsif($dba->isa('Bio::EnsEMBL::Variation::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('variation');
}
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_variation;
}
elsif($dba->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')){
......@@ -203,7 +215,7 @@ sub load_and_attach_dnadb_to_core{
load_adaptors($dba);
$reg->add_DNAAdaptor($dba->species,$dba->group,"core");
$reg->add_DNAAdaptor($dba->species,$dba->group,$dba->species,"core");
}
# those that do not need to attach to core:-#
......@@ -258,62 +270,6 @@ sub load_vega{
#special cases;-
sub load_blast{
my ($dba) = @_;
}
sub add_blast_link{
my ($class, $species, $group) = @_;
my $dba =undef;
my $blast = undef;
print STDERR " add_blast_link called\n";
if($dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $group)){
}
else{
throw("Cannot find $species $group in the registry\n");
}
if($blast = Bio::EnsEMBL::Registry->get_adaptor("NONE", "blast", "Blast")){
$dba->add_db_adaptor("Blast",$blast);
}
else{
throw("Sorry no Blast database has been set up to link to.\n");
}
}
sub load_go{
my ($class, $dba) = @_;
# shouldnt go into the registry ... sorry
}
#sub dnadb_add{
# my $class = shift;
# my ($dnaspecies, $dnagroup, $species, $group) = @_;
#
# print STDERR "dnadb_add CALLED\n";
#
# my $dnadb = Bio::EnsEMBL::Registry->get_DBAdaptor($dnaspecies, $dnagroup);
# my $featdb = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $group);
#
# $featdb->dnadb($dnadb);
#}
#
#
sub add_alias{
my ($class, @args) = @_;
my ($species, $aliases) = rearrange([qw(SPECIES ALIAS)],@args);
......@@ -328,40 +284,6 @@ sub add_alias{
}
}
#
#
#sub get_alias{
# my ($class, $key) = @_;
# return Bio::EnsEMBL::Registry->get_alias($key);
#}
#
#
#
#sub attach_database{
# my ($class, $species, $core, $name1) = @_;
#
#
# print STDERR " attach_databse called\n";
#
# my $first = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$name1);
# my $coredb = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$core);
#
# Bio::EnsEMBL::Registry->add_db($coredb,$name1, $first);
#
#}
#
#sub attach_dna{
# my ($class, $species, $main, $attach) = @_;
# print STDERR " attach_dna called\n";
#
# my $no_seq = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$main);
# my $seq = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$attach);
#
# Bio::EnsEMBL::Registry->add_DNAAdaptor($species,$no_seq->group,$attach);
#}
#
# overwrite/load new types. Done this way to enable no changes to CVS for
# external users. External users should add there own "GROUPS" in the file
......@@ -369,6 +291,5 @@ sub add_alias{
#
eval{ require Bio::EnsEMBL::Utils::User_defined_load };
#if ($@){ print STDERR "No user defined loads\n"; }
1;
Markdown is supported
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