ensembl-hive  2.7.0
Xref::DB Class Reference

Public Member Functions

protected Schema _init_db ()
 
protected Undef _guess_config ()
 
protected HashRef _init_config ()
 
protected DBI _validate_config ()
 
public DBI dbh ()
 
public create_db_row ()
 
public populate_metadata ()
 
protected Hashref _load_xref_config ()
 
protected Hashref _mangle_source_block ()
 

Detailed Description

Synopsis

my $db = Xref::DB->new(
config => {
host => 'db.com',
port => 3306,
user => 'me',
pass => 'Go on then',
driver => 'mysql',
db => 'name_for_db',
create => 1, # Deploys the schema to the DB for first use
}
);
$db = Xref::DB->new(
config_file => 'db.conf' # config options in Config::General format
);
my $dbh = $db->dbh; # $dbh is a DBI database handle borrowed for direct SQL
$dbh->prepare('DROP TABLE dependent_xref');
$db->create_db_row('Xref',{
xref_id => 1,
accession => 'YAY',
description => 'Sample new Xref',
source_id => 1,
...
});

Definition at line 40 of file DB.pm.

Member Function Documentation

◆ _guess_config()

protected Undef Xref::DB::_guess_config ( )
  Description: Don't want production use to guess at least at the moment.
               This mainly exists so TestDB can override and replace with a
               useful default
  Return type: undef
  Caller     : internal
 
Code:
click to view

◆ _init_config()

protected HashRef Xref::DB::_init_config ( )
  Arg [1]    : HashRef of configuation parameters (driver, db, host, port, user, pass)
  Description: Initialisae the loading of the configuration file.
  Return type: HashRef - $self->config
  Caller     : internal
 
Code:
click to view

◆ _init_db()

protected Schema Xref::DB::_init_db ( )
  Arg [1]    : HashRef of configuation parameters (driver, db, host, port, user, pass)
  Description: Initialise the core database.
  Return type: schema
  Caller     : internal
 
Code:
click to view

◆ _load_xref_config()

protected Hashref Xref::DB::_load_xref_config ( )
Arg [1]    : path to xref_config.ini
Description: Load the config file and sanity-check to ensure content is
             properly formatted for loading.
             FIXME: make parsing into a parser? Better yet switch to a format
             which can express this grammar correctly without micro-formatting
Returntype : Hashref config, as returned by Config::IniFiles
 
Code:
click to view

◆ _mangle_source_block()

protected Hashref Xref::DB::_mangle_source_block ( )
Arg 1      : String - section header, the name for the section that identifies
                      the section we need to extract values from
Arg 2      : Hashref - config file content, the output of _load_xref_config()
Description: Takes a single source record from xref_config.ini and creates a
             hashref. Some arguments are massaged to get them into the schema
             easily
Returntype : Hashref of a single source's properties
Caller     : Internal
 
Code:
click to view

◆ _validate_config()

protected DBI Xref::DB::_validate_config ( )
  Arg [1]    : HashRef of configuation parameters (driver, db, host, port, user, pass)
  Description: Configuration file parameter validation
  Return type: DBI database handle
  Caller     : internal
 
Code:
click to view

◆ create_db_row()

public Xref::DB::create_db_row ( )
  Arg [1]    : model
  Arg [2]    : arguments : These should be key-value pairs matching the rows in
                           the table
  Description: Shortcut for creating things on the fly
  Return type:
  Caller     : internal
 
Code:
click to view

◆ dbh()

public DBI Xref::DB::dbh ( )
  Description: Shortcut for accessing a database handle directly. I get the
               impression we might be doing this a lot.
  Return type: DBI database handle
  Caller     : internal
 
Code:
click to view

◆ populate_metadata()

public Xref::DB::populate_metadata ( )
  Arg [1]    : Config file path, normally xref_config.ini
  Description: Loads species and source information into the schema from the
               supplied file in Config::IniFiles format
  Caller     : User
 
Code:
click to view

The documentation for this class was generated from the following file:
map
public map()
Xref::Schema
Definition: ChecksumXref.pm:3
Xref::DB::_mangle_source_block
protected Hashref _mangle_source_block()
accession
public accession()
Xref::DB
Definition: DB.pm:40
Xref::DB::_validate_config
protected DBI _validate_config()
Xref::DB::populate_metadata
public populate_metadata()
Xref::DB::create_db_row
public create_db_row()
Xref::DB::_load_xref_config
protected Hashref _load_xref_config()
Xref::DB::_guess_config
protected Undef _guess_config()
Xref::DB::_init_config
protected HashRef _init_config()
Xref::DB::_init_db
protected Schema _init_db()
Xref::DB::dbh
public DBI dbh()