Skip to content
Snippets Groups Projects
Commit c2be78de authored by Andy Yates's avatar Andy Yates
Browse files

Adding a registry version to CliHelper

parent c4132fd9
No related branches found
No related tags found
No related merge requests found
......@@ -82,6 +82,7 @@ use Carp;
use Data::Dumper;
use Getopt::Long qw(:config auto_version no_ignore_case);
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::DBSQL::DBConnection;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
......@@ -251,4 +252,35 @@ sub get_dbas_for_opts {
}
return $dbas;
}
=head2 load_registry_for_opts
Arg [1] : Hash of options (e.g. parsed from command line options by process_args())
Arg [2] : Optional prefix to use when parsing e.g. dna or master
Description : Loads a Registry from the given options hash. If a C<registry>
option is given then the code will call C<load_all>. Otherwise
we use the database parameters given to call
C<load_registry_from_db()>.
Returntype : Integer of the number of DBAdaptors loaded
Status : Under development
=cut
sub load_registry_for_opts {
my ($self, $opts, $prefix) = @_;
$prefix ||= q{};
if($opts->{registry}) {
my $location = $opts->{registry};
return Bio::EnsEMBL::Registry->load_all($location);
}
my ( $host, $port, $user, $pass ) = map { $prefix . $_ } qw(host port user pass);
my %args = (
-HOST => $opts->{$host},
-PORT => $opts->{$port},
-USER => $opts->{$user},
);
$args{-PASS} = $opts->{$pass};
return Bio::EnsEMBL::Registry->load_registry_from_db(%args);
}
1;
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