Chado API

  1. 2.x tripal_core/api/tripal_core.chado_general.api.inc tripal_chado_api
  2. 1.x tripal_core/api/tripal_core_chado.api.inc tripal_chado_api

@file The Tripal Core API

This file provides the API needed for all other Tripal and Tripal dependent modules.

Provides an application programming interface (API) to manage data withing the Chado database. This includes functions for selecting, inserting, updating and deleting records in Chado tables. The functions will ensure proper integrity contraints are met for inserts and updates.

Also, a set of functions is provided for creating template variables. First, is the tripal_core_generate_chado_vars which is used to select one ore more records from a table and return an array with foreign key relationships fully populated. For example, if selecting a feature, the organism_id and type_id would be present in the returned array as a nested array with their respective foreign keys also nested. The only fields that are not included are text fields (which may be very large) or many-to-many foreign key relationships. However, these fields and relationships can be expanded using the tripal_core_expand_chado_vars.

When a row from a chado table is selected using these two functions, it provides a way for users who want to cutomize Drupal template files to access all data associate with a specific record.

Finally, the property tables in Chado generally follow the same format. Therefore there is a set of functions for inserting, updating and deleting properties for any table. This provides quick lookup of properties (provided the CV term is known).

Parent topics

File

tripal_core/api/tripal_core_chado.api.inc, line 6
The Tripal Core API

Functions

Namesort descending Location Description
chado_get_id_for_node tripal_core/api/tripal_core_chado.api.inc Get chado id for a node. E.g, if you want to get 'analysis_id' from the 'analysis' table for a synced 'chado_analysis' node, use: $analysis_id = chado_get_id_for_node ('analysis', $node) Likewise, $organism_id =…
chado_get_node_id tripal_core/api/tripal_core_chado.api.inc Get node id for a chado feature/organism/analysis. E.g, if you want to get the node id for an analysis, use: $nid = chado_get_node_id ('analysis', $analysis_id) Likewise, $nid = chado_get_node_id ('organism', $organism_id) $nid =…
chado_pager_query tripal_core/api/tripal_core_chado.api.inc Use this function instead of pager_query() when selecting a subset of records from a Chado table.
chado_query tripal_core/api/tripal_core_chado.api.inc Use this function instead of db_query() to avoid switching databases when making query to the chado database
chado_query_range tripal_core/api/tripal_core_chado.api.inc Use this function instead of db_query_range().
tripal_core_chado_delete tripal_core/api/tripal_core_chado.api.inc Provides a generic function for deleting a record(s) from any chado table
tripal_core_chado_get_foreign_key tripal_core/api/tripal_core_chado.api.inc Gets the value of a foreign key relationship
tripal_core_chado_insert tripal_core/api/tripal_core_chado.api.inc Provides a generic routine for inserting into any Chado table
tripal_core_chado_select tripal_core/api/tripal_core_chado.api.inc Provides a generic routine for selecting data from a Chado table
tripal_core_chado_update tripal_core/api/tripal_core_chado.api.inc Provides a generic routine for updating into any Chado table
tripal_core_delete_property tripal_core/api/tripal_core_chado.api.inc Deletes a property for a given base table record using the property name
tripal_core_delete_property_by_id tripal_core/api/tripal_core_chado.api.inc Deletes a property using the property ID
tripal_core_exclude_field_from_feature_by_default tripal_core/api/tripal_core_chado.api.inc Implements hook_exclude_field_from_<tablename>_by_default()
tripal_core_exclude_type_by_default tripal_core/api/tripal_core_chado.api.inc Implements hook_exclude_type_by_default()
tripal_core_expand_chado_vars tripal_core/api/tripal_core_chado.api.inc Retrieves fields/tables/nodes that were excluded by default from a variable and adds them
tripal_core_generate_chado_var tripal_core/api/tripal_core_chado.api.inc Generates an object containing the full details of a record(s) in chado.
tripal_core_get_property tripal_core/api/tripal_core_chado.api.inc Retrieve a property for a given base table record
tripal_core_insert_property tripal_core/api/tripal_core_chado.api.inc Insert a property for a given base table. By default if the property already exists a new property is added with the next available rank. If $update_if_present argument is specified then the record will be updated if it exists rather than adding a…
tripal_core_is_chado_installed tripal_core/api/tripal_core_chado.api.inc Check whether chado is installed (either in the same or a different database)
tripal_core_is_chado_local tripal_core/api/tripal_core_chado.api.inc Check whether chado is installed local to the Drupal database in its own Chado schema.
tripal_core_schema_exists tripal_core/api/tripal_core_chado.api.inc Check that any given schema exists
tripal_core_update_property tripal_core/api/tripal_core_chado.api.inc Update a property for a given base table record and property name. This function should be used only if one record of the property will be present. If the property name can have multiple entries (with increasing rank) then use the function named…
tripal_core_update_property_by_id tripal_core/api/tripal_core_chado.api.inc Update a property for a given base table record. This function should be used if multiple records of the same property will be present. Also, use this function to change the property name of an existing property.
tripal_db_get_search_path tripal_core/api/tripal_core_chado.api.inc Gets the current search_path for PostgreSQL
tripal_db_set_active tripal_core/api/tripal_core_chado.api.inc Set the Tripal Database
tripal_db_set_chado_search_path tripal_core/api/tripal_core_chado.api.inc Set the chado search_path for PostgreSQL
tripal_db_set_default_search_path tripal_core/api/tripal_core_chado.api.inc Set the default search_path for PostgreSQL
tripal_get_max_chado_rank tripal_core/api/tripal_core_chado.api.inc Purpose: Get max rank for a given set of criteria This function was developed with the many property tables in chado in mind