Commit 1a7d316d authored by Ian Longden's avatar Ian Longden
Browse files

dnadb now holds name core and not the adaptor so that forking and order are not important

parent aa3c78a2
......@@ -382,12 +382,17 @@ sub get_all_DBAdaptors{
=cut
sub add_DNAAdaptor{
my ($class, $species, $group, $adap) = @_;
my ($class, $species, $group, $dnadb_group) = @_;
$species = $class->get_alias($species);
$registry_register{$species}{$group}{'_DNA'} = $adap;
if($dnadb_group->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')){
# print STDERR "AHHH ".caller()."\n";
$registry_register{$species}{$group}{'_DNA'} = $dnadb_group->group();
}
else{
# print STDERR "AHHH MEN ".caller()."\n";
$registry_register{$species}{$group}{'_DNA'} = $dnadb_group;
}
}
=head2 get_DNAAdaptor
......@@ -404,7 +409,12 @@ sub get_DNAAdaptor{
my ($class, $species, $group) = @_;
$species = $class->get_alias($species);
return $registry_register{$species}{$group}{'_DNA'};
my $new_group = $registry_register{$species}{$group}{'_DNA'};
if( defined $new_group ) {
return $class->get_DBAdaptor($species,$new_group);
} else {
return undef;
}
}
#
......@@ -489,11 +499,11 @@ sub add_adaptor{
=cut
sub set_get_via_dnadb_if_set{
my ($class,$species,$type) = @_;
$registry_register{$class->get_alias($species)}{$type}{'DNADB'} = 1;
}
#sub set_get_via_dnadb_if_set{
# my ($class,$species,$type) = @_;
#
# $registry_register{$class->get_alias($species)}{$type}{'DNADB'} = 1;
#}
=head2 get_adaptor
......@@ -508,15 +518,27 @@ sub set_get_via_dnadb_if_set{
sub get_adaptor{
my ($class,$species,$group,$type)= @_;
$species = $class->get_alias($species);
#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();
$species = $class->get_alias($species);
my %dnadb_adaptors = qw(Sequence 1 AssemblyMapper 1 KaryotypeBand 1 RepeatFeature 1 CoordSystem 1 AssemblyExceptionFeature 1 );
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)){
......
......@@ -110,16 +110,19 @@ sub gen_load{
}
elsif($dba->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')){
#vega uses the core DBAdaptor so test if vega is in the dbname
if($dba->dbc->dbname() =~ /vega/){
if(!defined($dba->group())){
$dba->group('vega');
}
if(!defined($dba->group())){
$dba->group('core');
}
if($dba->group eq "estgene"){
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_estgene;
}
elsif($dba->group eq "est"){
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_est;
}
elsif($dba->group eq "vega"){
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_vega;
}
else{
if(!defined($dba->group())){
$dba->group('core');
}
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_core;
}
}
......@@ -195,10 +198,6 @@ sub load_core{
}
foreach my $type (qw(Sequence AssemblyMapper KaryotypeBand RepeatFeature CoordSystem AssemblyExceptionFeature)){
Bio::EnsEMBL::Registry->set_get_via_dnadb_if_set($dba->species,$type);
}
}
......@@ -221,7 +220,6 @@ sub load_SNP{
sub attach_database{
my ($class, $species, $core, $name1) = @_;
print STDERR "attach_databse called ".caller(). "\n";
my $first = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$name1);
my $coredb = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$core);
......@@ -232,7 +230,6 @@ sub attach_database{
sub attach_dna{
my ($class, $species, $main, $attach) = @_;
print STDERR "attach_dna called ".caller(). "\n";
my $no_seq = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$main);
my $seq = Bio::EnsEMBL::Registry->get_DBAdaptor($species,$attach);
......@@ -282,16 +279,14 @@ sub load_estgene{
Bio::EnsEMBL::Registry->add_adaptor($dba->species, $dba->group, $key, $pairs{$key});
}
#if dnadb has been set then for the follwing use it.
foreach my $type (qw(Sequence AssemblyMapper KaryotypeBand RepeatFeature CoordSystem AssemblyExceptionFeature)){
Bio::EnsEMBL::Registry->set_get_via_dnadb_if_set($dba->species,$type);
}
## if the core exists then set this for the dna getting
my $core = $reg->get_DBAdaptor($dba->species,"core");
if(defined($core)){
$reg->add_DNAAdaptor($dba->species,$dba->group,$core);
}
# #if dnadb has been set then for the follwing use it.
# foreach my $type (qw(Sequence AssemblyMapper KaryotypeBand RepeatFeature CoordSystem AssemblyExceptionFeature)){
# Bio::EnsEMBL::Registry->set_get_via_dnadb_if_set($dba->species,$type);
# }
$reg->add_DNAAdaptor($dba->species,$dba->group,"core");
}
......@@ -305,13 +300,13 @@ sub load_est{
}
#if dnadb has been set then for the follwing use it.
foreach my $type (qw(Sequence AssemblyMapper KaryotypeBand RepeatFeature CoordSystem AssemblyExceptionFeature)){
Bio::EnsEMBL::Registry->set_get_via_dnadb_if_set($dba->species,$type);
}
my $core = $reg->get_DBAdaptor($dba->species,"core");
if(defined($core)){
$reg->add_DNAAdaptor($dba->species,$dba->group,$core);
}
# foreach my $type (qw(Sequence AssemblyMapper KaryotypeBand RepeatFeature CoordSystem AssemblyExceptionFeature)){
# Bio::EnsEMBL::Registry->set_get_via_dnadb_if_set($dba->species,$type);
# }
# my $core = $reg->get_DBAdaptor($dba->species,"core");
# if(defined($core)){
$reg->add_DNAAdaptor($dba->species,$dba->group,"core");
# }
}
......@@ -323,10 +318,10 @@ sub load_vega{
foreach my $key (keys %pairs){
Bio::EnsEMBL::Registry->add_adaptor($dba->species, $dba->group, $key, $pairs{$key});
}
my $core = $reg->get_DBAdaptor($dba->species,"core");
if(defined($core)){
$reg->add_DNAAdaptor($dba->species,$dba->group,$core);
}
# my $core = $reg->get_DBAdaptor($dba->species,"core");
# if(defined($core)){
$reg->add_DNAAdaptor($dba->species,$dba->group,"core");
# }
}
......@@ -397,7 +392,6 @@ sub load_pipeline{
sub dnadb_add{
my $class = shift;
my ($dnaspecies, $dnagroup, $species, $group) = @_;
print STDERR "dnadb_add called ".caller(). "\n";
my $dnadb = Bio::EnsEMBL::Registry->get_DBAdaptor($dnaspecies, $dnagroup);
my $featdb = Bio::EnsEMBL::Registry->get_DBAdaptor($species, $group);
......
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