[Bioperl-l] UCSC database backend
Sean Davis
sdavis2 at mail.nih.gov
Wed Aug 9 13:10:15 UTC 2006
I have put together a variation of the database backend. It is based on
DBIx::Abstract and exposes a bit more of the SQL and DBI. Since UCSC uses
cross-database queries, it might be a better fit for the problem than an
ORM. It is pretty simple, but I don't know that we need much more here.
The harder problem, as I mentioned earlier, is to determine what to return,
not how to return it. I am showing only a couple of the DBIx::Abstract
methods here; there are a number of others for fetching data. In
particular, pretty much any of the fetch_* are available.
Here is the basic POD:
NAME
Bio::DB::UCSC::DB - database abstraction for UCSC
SYNOPSIS
use Bio::DB::UCSC::DB;
# By default, connect to MySQL server at UCSC, hg18 database
my $db = Bio::DB::UCSC::DB->new();
if ($db->select('*','refGene')->rows) {
while (my $data = $db->fetchrow_hashref) {
....
}
}
#get table database descriptions from hgcentral database
my $db_descriptions = $db->db_descriptions(); #arrayref of
hashrefs
#get full listing of tables (and attributes)
my $dbi_table_info = $db->dbi_table_info(); #arrayref of hashrefs
#get full column information for the "tissue" table
my $dbi_column_info = $db->dbi_column_info('tissue'); #arrayref of
hashrefs
#get table descriptions from UCSC tableDescriptions table
#Still needs a bit of cleanup, but....
my $table_descriptions = $db->table_descriptions(); #arrayref of
hashrefs
DESCRIPTION
This module provides some database abstraction via DBIx::Abstract.
The
connection parameters are currently passed directly to
DBIx::Abstract->connect(). All the methods of DBIx::Abstract are
available, with the addition of a ->dbh() method to get at the DBI
database handle and the database introspection methods noted above.
TODO
A fair bit of work on the connection end. In particular, I will
proba-
bly make a "Bio::DB::SQL" class that encapsulates some methods for
working with SQL databases and some kind of abstraction for
connection
information, making it easier to switch from local to remote versions
of a database.
See Also
L<DBIx::Abstract>,L<DBI>
Author
Sean Davis <sdavis2 at mail.nih.gov>
More information about the Bioperl-l
mailing list