Bio::EnsEMBL::Utils
ConfigRegistry
Toolbar
Summary
Bio::EnsEMBL::Utils::ConfigRegistry;
Package variables
Privates (from "my" definitions)
$reg = "Bio::EnsEMBL::Registry"
Included modules
Synopsis
Bio::EnsEMBL::Utils::ConfigRegistry->load_core($dba);
Description
The ConfigRegistry will "Register" a set of adaptors based on the type
of database that is being loaded.
Methods
add_alias | No description | Code |
find_unique_species | No description | Code |
gen_load | No description | Code |
load_SNP | No description | Code |
load_adaptors | No description | Code |
load_and_attach_dnadb_to_core | No description | Code |
load_compara | No description | Code |
load_estgene | No description | Code |
load_funcgen | No description | Code |
load_haplotype | No description | Code |
load_hive | No description | Code |
load_lite | No description | Code |
load_ontology | No description | Code |
load_otherfeatures | No description | Code |
load_pipeline | No description | Code |
load_variation | No description | Code |
load_vega | No description | Code |
Methods description
None available.
Methods code
sub find_unique_species
{ my ( $species, $group ) = @_;
$reg->add_alias( $species, $species );
my $i = 0;
my $free = 0;
while ( !$free ) {
if ( $i == 0 ) {
if ( !defined( $reg->get_DBAdaptor( $species, $group ) ) ) {
$free = 1;
$i = "";
} else {
$i = 1;
}
} else {
$reg->add_alias( $species . $i, $species . $i );
if ( !defined( $reg->get_DBAdaptor( $species . $i, $group ) ) ) {
$free = 1;
} else {
$i++;
}
}
}
$species .= $i;
return ($species);
}
} |
sub gen_load
{ my ($dba) = @_;
my $config_sub;
if($dba->isa('Bio::EnsEMBL::Compara::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('compara');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_compara;
}
elsif($dba->isa('Bio::EnsEMBL::Lite::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('lite');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_lite;
}
elsif($dba->isa('Bio::EnsEMBL::External::BlastAdaptor')){
if(!defined($dba->group())){
$dba->group('blast');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_blast;
}
elsif($dba->isa('Bio::EnsEMBL::ExternalData::SNPSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('SNP');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_SNP;
}
elsif($dba->isa('Bio::EnsEMBL::Pipeline::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('pipeline');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_pipeline;
}
elsif($dba->isa('Bio::EnsEMBL::Hive::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('hive');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_hive;
}
elsif($dba->isa('Bio::EnsEMBL::ExternalData::Haplotype::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('haplotype');
}
$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::Funcgen::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('funcgen');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_funcgen;
}
elsif ( $dba->isa('Bio::Ensembl::DBSQL::OntologyTermAdaptor') ) {
if ( !defined( $dba->group() ) ) {
$dba->group('ontology');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_ontology;
}
elsif($dba->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')){
if(!defined($dba->group())){
$dba->group('core');
}
if($dba->group eq "estgene"){
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_estgene;
}
elsif($dba->group eq "otherfeatures"){
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_otherfeatures;
}
elsif($dba->group eq "vega"){
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_vega;
}
else{
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_core;
}
}
else{
if(!defined($dba->group())){
$dba->group('none_standard');
}
$config_sub =\& Bio::EnsEMBL::Utils::ConfigRegistry::load_and_attach_dnadb_to_core;
}
if(defined($dba->species)){
my $db_reg = $reg->get_DBAdaptor($dba->species,$dba->group);
if(defined($db_reg)){
if($dba->dbc->equals($db_reg->dbc)){
return $db_reg;
}
else{
warn "WARN: Species and group same for two seperate databases\nModify species name for one of these\n";
$dba->species(find_unique_species($dba->species,$dba->group));
}
}
}
else{ my @db_reg = @{$reg->get_all_DBAdaptors_by_connection($dba->dbc)};
foreach my $db_adaptor (@db_reg){
if($db_adaptor->group eq $dba->group){ return $db_adaptor;
}
}
$dba->species(find_unique_species("DEFAULT",$dba->group));
if($dba->species ne "DEFAULT"){
warn "WARN: For multiple species use species attribute in DBAdaptor->new\n"
}
}
Bio::EnsEMBL::Registry->add_DBAdaptor($dba->species(), $dba->group(), $dba);
&{$config_sub}($dba);
return $dba; } |
sub load_SNP
{ load_adaptors(@_) } |
sub load_adaptors
{ my ($dba) = @_;
my %pairs = %{ $dba->get_available_adaptors() };
while ( my ( $key, $value ) = each(%pairs) ) {
Bio::EnsEMBL::Registry->add_adaptor( $dba->species(), $dba->group(),
$key, $value );
} } |
sub load_and_attach_dnadb_to_core
{ my ($dba) = @_;
load_adaptors($dba);
$reg->add_DNAAdaptor( $dba->species(), $dba->group(), $dba->species(),
'core' ); } |
sub load_compara
{ load_adaptors(@_) } |
sub load_estgene
{ load_and_attach_dnadb_to_core(@_) } |
sub load_funcgen
{ load_and_attach_dnadb_to_core(@_) } |
sub load_haplotype
{ load_adaptors(@_) } |
sub load_hive
{ load_adaptors(@_) } |
sub load_lite
{ load_adaptors(@_) } |
sub load_ontology
{ load_adaptors(@_) } |
sub load_otherfeatures
{ load_and_attach_dnadb_to_core(@_) } |
sub load_pipeline
{ load_adaptors(@_) } |
sub load_variation
{ load_and_attach_dnadb_to_core(@_) } |
sub load_vega
{ load_and_attach_dnadb_to_core(@_) } |
General documentation
Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
/info/about/code_licence.html
load_core, load_otherfeatures, load_vega, load_compara, load_pipeline, load_SNP, load_lite | Top |
Arg [1] : DBAdaptor with DBConnection alredy attached
Returntype : DBAdaptor;
Exceptions : none