Tripal
|
Functions | |
chado_get_db ($identifiers, $options=[]) | |
chado_get_db_select_options () | |
chado_get_dbxref ($identifiers, $options=[]) | |
chado_get_dbxref_url ($dbxref) | |
chado_insert_db ($values, $options=[]) | |
chado_insert_dbxref ($values) | |
chado_associate_dbxref ($basetable, $record_id, $dbxref, $options=[]) | |
chado_autocomplete_dbxref ($db_id, $string='') | |
External databases can be used to indicate the source for a variety of data. The most common use is with controlled vocabularies (CV). Chado expects that every CV have an external database record, where the database name must be the short name of the CV. In other cases, records such as features, stocks, libraries, etc., can also be present in remote databases and these associations can be made through dbxref linker tables. The API functions provided here provide tools to easily work with external databases.
chado_associate_dbxref | ( | $basetable, | |
$record_id, | |||
$dbxref, | |||
$options = [] |
|||
) |
Add a record to a database reference linking table (ie: feature_dbxref).
$basetable | The base table for which the dbxref should be associated. Thus to associate a dbxref with a feature the basetable=feature and dbxref_id is added to the feature_dbxref table. |
$record_id | The primary key of the basetable to associate the dbxref with. This should be in integer. |
$dbxref | An associative array describing the dbxref. Valid keys include: 'accession' => the accession for the dbxref, 'db_name' => the name of the database the dbxref belongs to. 'db_id' => the primary key of the database the dbxref belongs to. |
$options | An associative array of options. Valid keys include:
|
chado_autocomplete_dbxref | ( | $db_id, | |
$string = '' |
|||
) |
This function is intended to be used in autocomplete forms for searching for accession that begin with the provided string.
$db_id | The DB ID in which to search for the term. |
$string | The string to search for. |
chado_get_db | ( | $identifiers, | |
$options = [] |
|||
) |
Retrieves a chado db variable.
Example Usage:
The above code selects the SOFP db and returns the following object:
$identifier | An array with the key stating what the identifier is. Supported keys (only on of the following unique keys is required):
|
$options | An array of options. Supported keys include:
|
NOTE: the $identifier parameter can really be any array similar to $values passed into chado_select_record(). It should fully specify the db record to be returned.
chado_get_db_select_options | ( | ) |
Create an options array to be used in a form element which provides a list of all chado dbs.
chado_get_dbxref | ( | $identifiers, | |
$options = [] |
|||
) |
Retrieves a chado database reference variable.
Example Usage:
The above code selects the synonym database reference and returns the following object:
$identifier | An array apropriate for use with the chado_generate_var for uniquely identifying a dbxref record. Alternatively, there are also some specially handled keys. They are:
|
$options | An array of options. Supported keys include:
|
NOTE: the $identifier parameter can really be any array similar to $values passed into chado_select_record(). It should fully specify the dbxref record to be returned.
chado_get_dbxref_url | ( | $dbxref | ) |
Generates a URL for the controlled vocabulary term.
If the URL and URL prefix are provided for the database record of a cvterm then a URL can be created for the term. By default, the db.name and dbxref.accession are concatenated and appended to the end of the db.urlprefix. But Tripal supports the use of {db} and {accession} tokens when if present in the db.urlprefix string will be replaced with the db.name and dbxref.accession respectively.
$dbxref | A dbxref object as created by the chado_generate_var() function. |
chado_insert_db | ( | $values, | |
$options = [] |
|||
) |
Adds a new database to the Chado DB table and returns the DB object.
$values | An associative array of the values of the db (those to be inserted):
|
$options | Optional. An associative array of options that can include:
|
chado_insert_dbxref | ( | $values | ) |
Add a database reference.
$values | An associative array of the values to be inserted including:
|