NAME
TFBS::DB::JASPAR2 - interface to MySQL relational database of pattern matrices
SYNOPSIS
- •
-
creating a database object by connecting to the existing JASPAR2-type database
my $db = TFBS::DB::JASPAR2->connect("dbi:mysql:JASPAR2:myhost","myusername","mypassword");
- •
-
retrieving a TFBS::Matrix::* object from the database
# retrieving a PFM by IDmy $pfm = $db->get_Matrix_by_ID('M0079','PFM');#retrieving a PWM by namemy $pwm = $db->get_Matrix_by_name('NF-kappaB', 'PWM');
- •
-
retrieving a set of matrices as a TFBS::MatrixSet object according to various criteria
# retrieving a set of PWMs from a list of IDs:my @IDlist = ('M0019', 'M0045', 'M0073', 'M0101');my $matrixset = $db->get_MatrixSet(-IDs => \@IDlist,-matrixtype => "PWM");# retrieving a set of ICMs from a list of names:my @namelist = ('p50', 'p53', 'HNF-1'. 'GATA-1', 'GATA-2', 'GATA-3');my $matrixset = $db->get_MatrixSet(-names => \@namelist,-matrixtype => "ICM");# retrieving a set of all PFMs in the database# derived from human genes:my $matrixset = $db->get_MatrixSet(-species => ['Homo sapiens'],-matrixtype => "PFM");
- •
-
creating a new JASPAR2-type database named MYJASPAR2:
my $db = TFBS::DB::JASPAR2->create("dbi:mysql:MYJASPAR2:myhost","myusername","mypassword");
- •
-
storing a matrix in the database (currently only PFMs):
#let $pfm is a TFBS::Matrix::PFM object$db->store_Matrix($pfm);
DESCRIPTION
TFBS::DB::JASPAR2 is a read/write database interface module that retrieves and stores TFBS::Matrix::* and TFBS::MatrixSet objects in a relational database.
JASPAR2 DATA MODEL
JASPAR2 is working name for a relational database model used for storing transcriptional factor pattern matrices in a MySQL database. It was initially designed to store matrices for the JASPAR database of high quality eukaryotic transcription factor specificity profiles by Albin Sandelin and Wyeth W. Wasserman. Besides the profile matrix itself, this data model stores profile ID (unique), name, structural class, basic taxonomic and bibliographic information as well as some additional optional tags.
Due to its data model, which precedeed the design of the module, TFBS::DB::JASPAR2 cannot store arbitrary tags for a matrix.
The supported tags are
'acc' # (accession number;
# originally for transcription factor protein seq)
'seqdb' # sequence database where 'acc' comes from
'medline' # PubMed ID
'species' # Species name
'sysgroup'
'total_ic' # total information content - redundant, present
# for historical "medline" => ($self->_get_medline($ID) or ""),
"species" => ($self->_get_species($ID) or ""),
"sysgroup"=> ($self->_get_sysgroup($ID) or ""),
"type" => ($self->_get_type($ID) or ""),
"seqdb" => ($self->_get_seqdb($ID) or ""),
"acc" => ($self->_get_acc($ID) or ""),
"total_ic"=
----------------------- ADVANCED ---------------------------------
For the developers and the curious, here is the JASPAR2 data model:
CREATE TABLE matrix_data (ID varchar(16) DEFAULT '' NOT NULL,pos_ID varchar(24) DEFAULT '' NOT NULL,base enum('A','C','G','T'),position tinyint(3) unsigned,raw int(3) unsigned,info float(7,5) unsigned, -- calculatedpwm float(7,5) unsigned, -- calculatednormalized float(7,5) unsigned,PRIMARY KEY (pos_ID),KEY id_index (ID));CREATE TABLE matrix_info (ID varchar(16) DEFAULT '' NOT NULL,name varchar(15) DEFAULT '' NOT NULL,type varchar(8) DEFAULT '' NOT NULL,class varchar(20),phylum varchar (32), -- maps to 'sysgroup' taglitt varchar(40), -- not used by this modulemedline int(12),information varchar(20), -- not used by this moduleiterations varchar(6),width int(2), -- calculatedconsensus varchar(25), -- calculatedIC float(6,4), -- maps to 'total_ic' tagsites int(3) unsigned, -- not used by this modulePRIMARY KEY (ID))CREATE TABLE matrix_seqs (ID varchar(16) DEFAULT '' NOT NULL,internal varchar(8) DEFAULT '' NOT NULL,seq_db varchar(15) NOT NULL,seq varchar(10) NOT NULL,PRIMARY KEY (ID, seq_db, seq))CREATE TABLE matrix_species (ID varchar(16) DEFAULT '' NOT NULL,internal varchar(8) DEFAULT '' NOT NULL,species varchar(24) NOT NULL,PRIMARY KEY (ID, species))
It is our best intention to hide the details of this data model, which we are using on a daily basis in our work, from most TFBS users, simply because for historical reasons some table column names are confusing at best. Most users should only know the methods to store the data and which tags are supported.
-------------------------------------------------------------------------
FEEDBACK
Please send bug reports and other comments to the author.
AUTHOR - Boris Lenhard
Boris Lenhard <[email protected]>
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are preceded with an underscore.
new
Title : newUsage : DEPRECATED - for backward compatibility onlyUse connect() or create() instead
connect
Title : connectUsage : my $db =TFBS::DB::JASPAR2->connect("dbi:mysql:DATABASENAME:HOSTNAME","USERNAME","PASSWORD");Function: connects to the existing JASPAR2-type database andreturns a database object that interfaces the databaseReturns : a TFBS::DB::JASPAR2 objectArgs : a standard database connection triplet("dbi:mysql:DATABASENAME:HOSTNAME", "USERNAME", "PASSWORD")In place of DATABASENAME, HOSTNAME, USERNAME and PASSWORD,use the actual values. PASSWORD and USERNAME might beoptional, depending on the user access permissions forthe database server.
create
Title : createUsage : my $newdb =TFBS::DB::JASPAR2->create("dbi:mysql:NEWDATABASENAME:HOSTNAME","USERNAME","PASSWORD");Function: connects to the database server, creates a new JASPAR2-type database and returns a databaseobject that interfaces the databaseReturns : a TFBS::DB::JASPAR2 objectArgs : a standard database connection triplet("dbi:mysql:NEWDATABASENAME:HOSTNAME", "USERNAME", "PASSWORD")In place of NEWDATABASENAME, HOSTNAME, USERNAME andPASSWORD use the actual values. PASSWORD and USERNAMEmight be optional, depending on the users access permissionsfor the database server.
dbh
Title : dbhUsage : my $dbh = $db->dbh();$dbh->do("UPDATE matrix_data SET name='ADD1' WHERE NAME='SREBP2'");Function: returns the DBI database handle of the MySQL databaseinterfaced by $db; THIS IS USED FOR WRITING NEW METHODSFOR DIRECT RELATIONAL DATABASE MANIPULATION - if youhave write access AND do not know what you are doing,you can severely corrupt the dataFor documentation about database handle methods, see L<DBI>Returns : the database (DBI) handle of the MySQL JASPAR2-typerelational database associated with the TFBS::DB::JASPAR2objectArgs : none
get_Matrix_by_ID
Title : get_Matrix_by_IDUsage : my $pfm = $db->get_Matrix_by_ID('M00034', 'PFM');Function: fetches matrix data under the given ID from thedatabase and returns a TFBS::Matrix::* objectReturns : a TFBS::Matrix::* object; the exact type of theobject depending on the second argument (allowedvalues are 'PFM', 'ICM', and 'PWM'); returns undef ifmatrix with the given ID is not foundArgs : (Matrix_ID, Matrix_type)Matrix_ID is a string; Matrix_type is one of thefollowing: 'PFM' (raw position frequency matrix),'ICM' (information content matrix) or 'PWM' (positionweight matrix)If Matrix_type is omitted, a PWM is retrieved by default.
get_Matrix_by_name
Title : get_Matrix_by_nameUsage : my $pfm = $db->get_Matrix_by_name('HNF-1', 'PWM');Function: fetches matrix data under the given name from thedatabase and returns a TFBS::Matrix::* objectReturns : a TFBS::Matrix::* object; the exact type of the objectdepending on the second argument (allowed values are'PFM', 'ICM', and 'PWM')Args : (Matrix_name, Matrix_type)Matrix_name is a string; Matrix_type is one of thefollowing:'PFM' (raw position frequency matrix),'ICM' (information content matrix) or'PWM' (position weight matrix)If Matrix_type is omitted, a PWM is retrieved by default.Warning : According to the current JASPAR2 data model, name isnot necessarily a unique identifier. In the case wherethere are several matrices with the same name in thedatabase, the function fetches the first one and printsa warning on STDERR. You have been warned.
get_MatrixSet
Title : get_MatrixSetUsage : my $matrixset = $db->get_MatrixSet(%args);Function: fetches matrix data under for all matrices in the databasematching criteria defined by the named argumentsand returns a TFBS::MatrixSet objectReturns : a TFBS::MatrixSet objectArgs : This method accepts named arguments:-IDs # a reference to an array of IDs (strings)-names # a reference to an array of# transcription factor names (string)-classes # a reference to an array of# structural class names (strings)-species # a reference to an array of# Latin species names (strings)-sysgroups # a reference to an array of# higher taxonomic categories (strings)-matrixtype # a string, 'PFM', 'ICM' or 'PWM'-min_ic # float, minimum total information content# of the matrix
The five arguments that expect list references are used in database query formulation: elements within lists are combined with 'OR' operators, and the lists of different types with 'AND'. For example,
my $matrixset = $db->(-classes => ['TRP_CLUSTER', 'FORKHEAD'],-species => ['Homo sapiens', 'Mus musculus'],-matrixtype => 'PWM');
gives a set of PWMs whose (structural clas is 'TRP_CLUSTER' OR 'FORKHEAD') AND (the species they are derived from is 'Homo sapiens' OR 'Mus musculus').
The -min_ic filter is applied after the query in the sense that the matrices profiles with total information content less than specified are not included in the set.
store_Matrix
Title : store_MatrixUsage : $db->store_Matrix($pfm);Function: Stores the contents of a TFBS::Matrix::DB object in the databaseReturns : 0 on success; $@ contents on failure(this is too C-like and may change in future versions)Args : (PFM_object)A TFBS::Matrix::PFM objectComment : this is an experimental method that is not 100% bulletproof;use at your own risk
store_MatrixSet
Title : store_MatrixSetUsage : $db->store_Matrix($matrixset);Function: Stores the TFBS::DB::PFM object that are part of aTFBS::MatrixSet object into the databaseReturns : 0 on success; $@ contents on failure(this is too C-like and may change in future versions)Args : (MatrixSet_object)A TFBS::MatrixSet objectComment : THIS METHOD IS NOT YET IMPLEMENTED
delete_Matrix_having_ID
Title : delete_Matrix_having_IDUsage : $db->delete_Matrix_with_ID('M00045');Function: Deletes the matrix having the given ID from the databaseReturns : 0 on success; $@ contents on failure(this is too C-like and may change in future versions)Args : (ID)A stringComment : Yeah, yeah, 'delete_Matrix_having_ID' is a stupid namefor a method, but at least it should be obviuos what it does.