TFBS::DB::JASPAR(3pm)

πŸ’– NAME πŸ’–

TFBS::DB::JASPAR β€” your girl's interface to a MySQL relational database of pattern matrices. Current status: experimental πŸ‘€ (yes bestie, experimental, we love a work in progress)

Ok so real talk: TFBS::DB::JASPAR(3pm) is the module you want when you need to talk to that database, and I'm about to walk you through every single thing it does. Periodt. 🫢


✨ SYNOPSIS ✨

Sit down, hydrate, and let's go through the whole vibe, one use case at a time πŸ’…

  • creating a database object by connecting to the existing JASPAR6-type database πŸ”Œ
my $db = TFBS::DB::JASPAR6->connect("dbi:mysql:JASPAR6:myhost",
                "myusername",
                "mypassword");
  • retrieving a TFBS::Matrix::* object from the database 🌸
# retrieving a PFM by ID
my $pfm = $db->get_Matrix_by_ID('M0079','PFM');

#retrieving a PWM by name
my $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:
 @namelist = ('p50', 'p53', 'HNF-1'. 'GATA-1', 'GATA-2', 'GATA-3');
my $matrixset = $db->get_MatrixSet(-names => \@namelist,
                   -matrixtype => "ICM");
  • creating a new JASPAR6-type database named MYJASPAR6 πŸŽ€
my $db = TFBS::DB::JASPAR4->create("dbi:mysql:MYJASPAR6: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::JASPAR is a read/write database interface module, bestie. It retrieves and stores TFBS::Matrix::* and TFBS::MatrixSet objects inside a relational database. The way it's structured is nearly identical to the JASPAR2 and JASPAR4 interface β€” like, twins basically β€” even though the underlying data model under the hood is a whole different girl. πŸ’…


🧬 JASPAR6 DATA MODEL 🧬

JASPAR6 is the working name for a relational database model used to store transcriptional factor pattern matrices in a MySQL database. It was originally designed (JASPAR2) to store matrices for the JASPAR database of high quality eukaryotic transcription factor specificity profiles by Albin Sandelin and Wyeth W. Wasserman. 🫢

And it doesn't just hold the profile matrix itself β€” this data model also stores the profile ID (unique, no duplicates allowed, she's one of a kind πŸ’…), the name, the structural class, basic taxonomic and bibliographic information, plus some additional and custom tags. So organized. So iconic.

Here goes a more thorough description on tables and IDs (that's the plan anyway πŸ‘€)


🌟 ADVANCED 🌟

For the developers and the curious, here is the JASPAR6 data model:

MISSING TEXT HEER ON HOW IT WORKS

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. Most users should only need to know the methods to store the data and which tags are supported. Like, you don't need to know how the sausage gets made, you just need to eat. 😌


πŸ“¬ FEEDBACK πŸ“¬

Please send bug reports and other comments to the author. They want to hear from you fr fr πŸ™ˆ


πŸ‘‘ AUTHOR - Boris Lenhard πŸ‘‘

Boris Lenhard <Boris.Lenhard@cgb.ki.se>

πŸ¦‹ APPENDIX πŸ¦‹

okay bestie, this is the part where we go method by method through every single thing this object can do. every detail, no skips. internal methods get a little underscore in front of their name, that's the secret handshake πŸ’…


✨ new ✨

  • Title: new
  • Usage: DEPRECATED β€” for backward compatibility only. pls use connect() or create() instead, this one is giving legacy energy 🫢

πŸŽ€ connect πŸŽ€

  • Title: connect
  • Usage:
my $db =
    TFBS::DB::JASPAR6->connect("dbi:mysql:DATABASENAME:HOSTNAME",
                        "USERNAME",
                        "PASSWORD");
  • Function: connects to the existing JASPAR6-type database and hands you back a database object that interfaces the database ✨
  • Returns: a TFBS::DB::JASPAR6 object
  • Args: a standard database connection triplet ("dbi:mysql:DATABASENAME:HOSTNAME", "USERNAME", "PASSWORD"). In place of DATABASENAME, HOSTNAME, USERNAME and PASSWORD, use the actual values, bestie. PASSWORD and USERNAME might be optional, depending on the user's access permissions for the database server πŸ’–

🌸 dbh 🌸

  • Title: dbh
  • Usage:
my $dbh = $db->dbh();
    $dbh->do("UPDATE matrix_data SET name='ADD1' WHERE NAME='SREBP2'");
  • Function: returns the DBI database handle of the MySQL database interfaced by $db; THIS IS USED FOR WRITING NEW METHODS FOR DIRECT RELATIONAL DATABASE MANIPULATION β€” and listen, if you have write access AND do not know what you are doing, you can severely corrupt the data 😭 so like. be careful. For documentation about database handle methods, see L<DBI>
  • Returns: the database (DBI) handle of the MySQL JASPAR2-type relational database associated with the TFBS::DB::JASPAR2 object
  • Args: none

πŸ’œ store_Matrix πŸ’œ

  • Title: store_Matrix
  • Usage: $db->store_Matrix($matrixobject);
  • Function: Stores the contents of a TFBS::Matrix::DB object in the database
  • Returns: 0 on success; $@ contents on failure (this is too C-like and may change in future versions, ngl πŸ’€)
  • Args: (PFM_object) β€” a TFBS::Matrix::PFM, FBS::Matrix::PWM or FBS::Matrix::ICM object. PFM objects are recommended to use, as they are eaily converted to other formats
# might have to give version and collection here
  • Comment: this is an experimental method that is not 100% bulletproof; use at your own risk πŸ™ˆ
⚠️ for real though, it says experimental and not 100% bulletproof. that is a vibe check warning, bestie.

πŸ‘‘ get_Matrix_by_ID πŸ‘‘

  • Title: get_Matrix_by_ID
  • Usage: my $pfm = $db->get_Matrix_by_ID('M00034', 'PFM');
  • Function: fetches matrix data under the given ID from the database and returns a TFBS::Matrix::* object
  • Returns: a TFBS::Matrix::* object; the exact type of the object depending on what form the matrix is stored in the database (PFM is default)
  • Args: (Matrix_ID) β€” Matrix_ID id is a string which refers to the stable JASPAR ID (usually something like "MA0001") with or without version numbers. "MA0001" will give the latest version on MA0001, while "MA0001.2" will give the second version, if existing. Warnings will be given for non-existing matrices 🫢

πŸ¦‹ get_Matrix_by_name πŸ¦‹

  • Title: get_Matrix_by_name
  • Usage: my $pfm = $db->get_Matrix_by_name('HNF-1');
  • Function: fetches matrix data under the given name from the database and returns a TFBS::Matrix::* object
  • Returns: a TFBS::Matrix::* object; the exact type of the object depending on what form the matrix object was stored in the database (default PFM)
  • Args: (Matrix_name)
Warning: According to the current JASPAR6 data model, name is not necessarily a unique identifier. Also, names change over time. In the case where there are several matrices with the same name in the database, the function fetches the first one and prints a warning on STDERR. You've been warned. 😭 Some matrices have multiple versions. The function will return the latest version. For specific versions, use get_Matrix_by_ID($ID.$version)

⭐ get_MatrixSet ⭐

  • Title: get_MatrixSet
  • Usage: my $matrixset = $db->get_MatrixSet(%args);
  • Function: fetches matrix data for all matrices in the database matching criteria defined by the named arguments, and returns a TFBS::MatrixSet object
  • Returns: a TFBS::MatrixSet object
  • Args: This method accepts named arguments, corresponding to arbitrary tags, and also some utility functions. Note that this is different from JASPAR2 and to some extent JASPAR4. As any tag is supported for database storage, any tag can be used for information retrieval. Additionally, arguments as 'name', 'class', 'collection' can be used (even though they are not tags). Per default, only the last version of the matrix is given. The only way to get older matrices out of this is to use an array of IDs with actual versions like MA0001.1, or set the argument -all_versions=>1, in which case you get all versions for each stable ID πŸ’…

Examples include:

Fundamental matrix features

  • -all β€” gives absolutely all matrix entry, regardless of versin and collection. Only useful for backup situations and sanity checks. Takes precedence over everything else
  • -ID β€” a reference to an array of stable IDs (strings), with or without version, as above. tyically something like "MA0001.2". Takes precedence over everything salve -all
  • -name β€” a reference to an array of transcription factor names (string). Will only take latest version. NOT a preferred way to access since names change over time
  • -collection β€” a string corresponding to a JASPAR collection. Per default CORE
  • -all_versions β€” gives all matrix versions that fit with rest of criteria, including obsolete ones. Is off per default.
# Typical usage is in combiation with a stable IDs withou versions to get all versinos of a particular matrix

Typical tag queries:

These can be either a string or a reference to an array of strings. If it is an arrau it will be interpreted as as an "or"s statement.

  • -class β€” a reference to an array of structural class names (strings)
  • -species β€” a reference to an array of NCBI Taxonomy IDs (integers)
  • -taxgroup β€” a reference to an array of higher taxonomic categories (string)

Computed features of the matrices

  • -min_ic β€” float, minimum total information content of the matrix.
  • -matrixtype β€” string describing type of matrix to retrieve. If left out, the format will revert to the database format, which is PFM.

The 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->(-class => ['TRP_CLUSTER', 'FORKHEAD'],
          -species => ['Homo sapiens', 'Mus musculus'],
          );

gives a set of TFBS::Matrix::PFM objects (given that the matrix models are stored as such) whose (structural clas is 'TRP_CLUSTER' OR 'FORKHEAD') AND (the species they are derived from is 'Homo sapiens' OR 'Mus musculus'). ✨

As above, unless IDs with version numbers are used, only one matrix per stable ID wil be returned: the matrix with the highest version number.

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. so like, post-query glow-up filter πŸŽ€

πŸ’… delete_Matrix_having_ID πŸ’…

  • Title: delete_Matrix_having_ID
  • Usage: $db->delete_Matrix_with_ID('M00045.1');
  • Function: Deletes the matrix having the given ID from the database
  • Returns: 0 on success; $@ contents on failure (this is too C-ike and may change in future versions)
  • Args: (ID) β€” a string. Has to be a matrix ID with version suffix in JASPAR6.
  • Comment: Yeah, yeah, 'delete_Matrix_having_ID' is a stupid name for a method, but at least it should be obviuos what it does. 😭 she's doing her best

🌈 get_TFFM_by_ID 🌈

  • Title: get_TFFM_by_ID
  • Usage: my $tffm = $db->get_TFFM_by_ID('TFFM0001');
  • Function: fetches TFFM data under the given ID from the database and returns a TFBS::TFFM object.
  • Returns: a TFBS::TFFM object
  • Args: TFFM ID β€” TFFM_ID id is a string which refers to the stable JASPAR TFFM ID (usually something like "TFFM0001") with or without version numbers. "TFFM0001" will give the latest version on TFFM0001, while "TFFM0001.2" will give the second version, if existing. Warnings will be given for non-existing TFFMs 🫢

🧚 get_TFFM_by_matrix_ID 🧚

  • Title: get_TFFM_by_matrix_ID
  • Usage: my $tffm = $db->get_TFFM_by_matrix_ID('MA0001.1');
  • Function: fetches TFFM data under related to the given matrix ID from the database and returns a TFBS::TFFM object.
  • Returns: a TFBS::TFFM object
  • Args: Matrix ID β€” Matrix ID id is a string which refers to the stable JASPAR matrix ID (usually something like "MA0148.3"). Note that this should be a fully qualified matrix ID (with version) as the TFFM is related to a specific version of a matrix. If no matrix version is given, the latest version of the matrix is retrieved and the corresponding TFFM for that matrix version is retrieved (could be no TFFM). In general only a few matrices have associated TFFMs so in many cases no TFFM will be retrieved. In these cases we return undef. πŸ’€ (not an error, just a shrug)

πŸ’– get_TFFM_by_name πŸ’–

  • Title: get_TFFM_by_name
  • Usage: my $tffm = $db->get_TFFM_by_name('HNF-1');
  • Function: fetches TFFM data under the given name from the database and returns a TFBS::TFFM object
  • Returns: a TFBS::TFFM object
  • Args: A TFFM name β€” the name of the transcription factor for which this TFFM was modelled. This is the same as the name of the matrix used to train the TFFM.
Warning: According to the current JASPAR data model, name is not necessarily a unique identifier. Also, names change over time. In the case where there are several TFFMs with the same name in the database, the function fetches the first one and prints a warning on STDERR. You've been warned. 😭 Some matrices have multiple versions. The function will return the latest version. For specific versions, use get_TFFM_by_ID($ID.$version)

and that's the whole page, bestie, every last method accounted for, no details left behind πŸ’…βœ¨

this was TFBS::DB::JASPAR(3pm) from the User Contributed Perl Documentation, built for perl v5.42.3 and dated 2026-08-21 β€” go forth and query responsibly, and pls back up your database before you go touching dbh 🫢🌸

πŸ“¦ where this page comes from