Commit bbc30a4e authored by Andy Yates's avatar Andy Yates
Browse files

[ENSCORESW-261]. Edits to allow for easier regulation adaptor creation. Grab...

[ENSCORESW-261]. Edits to allow for easier regulation adaptor creation. Grab the species name from the DB if it wasn't given to the adaptor and make sure we avoid returning the coord system core adaptor if the group was funcgen
parent fcfae510
...@@ -943,7 +943,7 @@ sub add_adaptor { ...@@ -943,7 +943,7 @@ sub add_adaptor {
} }
if ( !defined( $registry_register{_TYPE}{ lc($type) }{$species} ) ) { if ( !defined( $registry_register{_TYPE}{ lc($type) }{$species} ) ) {
$registry_register{_TYPE}{ lc($type) }{$species} = [$type]; $registry_register{_TYPE}{ lc($type) }{$species} = [$adap];
} else { } else {
push( @{ $registry_register{_TYPE}{ lc($type) }{$species} }, push( @{ $registry_register{_TYPE}{ lc($type) }{$species} },
$adap ); $adap );
...@@ -990,7 +990,7 @@ sub get_adaptor { ...@@ -990,7 +990,7 @@ sub get_adaptor {
'assemblymapper' => 1, 'assemblymapper' => 1,
'karyotypeband' => 1, 'karyotypeband' => 1,
'repeatfeature' => 1, 'repeatfeature' => 1,
'coordsystem' => 1, 'coordsystem' => ((lc($group) ne 'funcgen') ? 1 : undef),
'assemblyexceptionfeature' => 1 'assemblyexceptionfeature' => 1
); );
......
...@@ -54,6 +54,7 @@ use Bio::EnsEMBL::Utils::Exception qw(warning throw deprecate stack_trace_dump) ...@@ -54,6 +54,7 @@ use Bio::EnsEMBL::Utils::Exception qw(warning throw deprecate stack_trace_dump)
sub gen_load { sub gen_load {
my ($dba) = @_; my ($dba) = @_;
my $pre_hook;
my $config_sub; my $config_sub;
# At some point we hope to set the group in the DBadaptor, hence this # At some point we hope to set the group in the DBadaptor, hence this
...@@ -106,6 +107,7 @@ sub gen_load { ...@@ -106,6 +107,7 @@ sub gen_load {
if ( !defined( $dba->group() ) ) { if ( !defined( $dba->group() ) ) {
$dba->group('funcgen'); $dba->group('funcgen');
} }
$pre_hook = \&Bio::EnsEMBL::Utils::ConfigRegistry::pre_funcgen_hook;
$config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_funcgen; $config_sub = \&Bio::EnsEMBL::Utils::ConfigRegistry::load_funcgen;
} elsif ( $dba->isa('Bio::Ensembl::DBSQL::OntologyTermAdaptor') ) { } elsif ( $dba->isa('Bio::Ensembl::DBSQL::OntologyTermAdaptor') ) {
if ( !defined( $dba->group() ) ) { if ( !defined( $dba->group() ) ) {
...@@ -138,6 +140,9 @@ sub gen_load { ...@@ -138,6 +140,9 @@ sub gen_load {
\&Bio::EnsEMBL::Utils::ConfigRegistry::load_and_attach_dnadb_to_core; \&Bio::EnsEMBL::Utils::ConfigRegistry::load_and_attach_dnadb_to_core;
# throw("Unknown DBAdaptor type $dba\n"); # throw("Unknown DBAdaptor type $dba\n");
} }
#Run the pre-hook if one was defined
$pre_hook->($dba) if $pre_hook;
# return if the connection and species, group are the same # return if the connection and species, group are the same
...@@ -326,6 +331,22 @@ sub add_alias { ...@@ -326,6 +331,22 @@ sub add_alias {
} }
} }
# WARNING: "CONVENIENCE METHOD" for retriving the species name when one was
# not set. Regulation DB requirement
sub pre_funcgen_hook {
my ($dba) = @_;
if(! $dba->species() ) {
warn "Setting name";
my $name = $dba->dbc()->sql_helper()->execute_single_result(
-SQL => 'select meta_value from meta where meta_key =?',
-PARAMS => ['species.production_name'],
);
$dba->dbc()->disconnect_if_idle();
$dba->species($name);
}
return;
}
# #
# overwrite/load new types. Done this way to enable no changes to CVS for # 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 # external users. External users should add there own "GROUPS" in the file
......
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