ensembl-hive  2.7.0
Bio::EnsEMBL::Utils::EasyArgv Class Reference

Public Member Functions

protected _debug_print ()
 
public get_ens_db_from_argv ()
 
protected _debug_print ()
 

Detailed Description

Synopsis

my $db = get_ens_db_from_argv; # this method is exported.
use Getopt::Long;
my $others;
&GetOptions( 'others=s' => \$others );

Description

This is a lazy but easy way to get the db-related arguments. All you
need to do is to invoke get_ens_db_from_argv before using standard
Getopt. The below options will be absorbed and removed from \@ARGV.

db_file, host, db_host, dbhost, user, db_user, dbuser, pass, db_pass,
dbpass, dbname, db_name.

Now you can take advantage of Perl's do method to execute a file as perl
script and get returned the last line of it. For your most accessed db
setting, you can have a file named, say, ensdb_homo_core_18.perlobj,
with the content like

  use strict;    # The ceiling line

  use Bio::EnsEMBL::DBSQL::DBAdaptor;

  my $db = Bio::EnsEMBL::DBSQL::DBAdaptor->new(
    -host   => 'ensembldb.ensembl.org',
    -user   => 'anonymous',
    -dbname => 'homo_sapiens_core_18_34'
  );

  $db;           # The floor line

In the your command line, you just need to write like 

  perl my_script.pl -db_file ensdb_homo_core_18.perlobj

rather than the verbose

  -host ensembldb.ensembl.org -user anonymous \
  -dbname homo_sapiens_core_18_34

Definition at line 55 of file EasyArgv.pm.

Member Function Documentation

◆ _debug_print() [1/2]

protected Bio::EnsEMBL::Utils::EasyArgv::_debug_print ( )

Undocumented method

Code:
click to view

Undocumented method

Code:
click to view

◆ _debug_print() [2/2]

protected Bio::EnsEMBL::Utils::EasyArgv::_debug_print ( )

◆ get_ens_db_from_argv()

public Bio::EnsEMBL::Utils::EasyArgv::get_ens_db_from_argv ( )

Undocumented method

Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::Utils::EasyArgv
Definition: EasyArgv.pm:55
Bio::EnsEMBL::Utils::EasyArgv::get_ens_db_from_argv
public get_ens_db_from_argv()
Bio::EnsEMBL::Utils::EasyArgv::_debug_print
protected _debug_print()