Skip to content

Commit

Permalink
Improve --registry and --db_version (#1588)
Browse files Browse the repository at this point in the history
* Allow relative registry and warn when registry file is not found

* Warn when selected --db_version is not in any database names
  • Loading branch information
nuno-agostinho authored Feb 9, 2024
1 parent e25c7bf commit ea3ea38
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions modules/Bio/EnsEMBL/VEP/BaseVEP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use Bio::EnsEMBL::VEP::Utils qw(get_time);
use Bio::EnsEMBL::Slice;
use Bio::EnsEMBL::CoordSystem;
use Bio::EnsEMBL::VEP::Stats;
use File::Spec;
use FileHandle;


Expand Down Expand Up @@ -259,6 +260,8 @@ sub registry {

# load DB options from registry file if given
if(my $registry_file = $self->param('registry')) {
$registry_file = File::Spec->rel2abs($registry_file);
throw("ERROR: Registry file $registry_file not found") unless -e $registry_file;
$self->status_msg("Loading DB self from registry file ", $registry_file) if $self->param('verbose');

$reg->load_all(
Expand All @@ -279,16 +282,25 @@ sub registry {
}
}

my $host = $self->param('host');
my $user = $self->param('user');
my $port = $self->param('port');
my $db_version = $self->param('db_version');
$reg->load_registry_from_db(
-host => $self->param('host'),
-user => $self->param('user'),
-host => $host,
-user => $user,
-pass => $self->param('password'),
-port => $self->param('port'),
-db_version => $self->param('db_version'),
-db_version => $db_version,
-species => $species,
-verbose => $self->param('verbose'),
-no_cache => $self->param('no_slice_cache'),
);

my @db_names = map { $_->dbc->dbname } @{ $reg->get_all_DBAdaptors };
my $hostname = ($user eq 'anonymous' ? '' : $user . '@') . "$host:$port";
$self->warning_msg("No database names in $hostname contain version $db_version")
unless grep { /$db_version/ } @db_names;
}

eval { $reg->set_reconnect_when_lost() };
Expand Down Expand Up @@ -336,7 +348,7 @@ sub get_adaptor {
my $ad;

if($self->param('database') || ($self->param('cache') && !$self->param('offline'))) {
$ad = $self->registry->get_adaptor($self->species, $group, $type)
$ad = $self->registry->get_adaptor($self->species, $group, $type);
}

$ad ||= $self->_get_fake_adaptor($group, $type);
Expand Down

0 comments on commit ea3ea38

Please sign in to comment.