Tripal 0.3b
Core Module Chado API

Functions

 tripal_core_chado_insert ($table, $values)
 tripal_core_chado_delete ($table, $match)
 tripal_core_chado_update ($table, $match, $values)
 tripal_core_chado_select ($table, $columns, $values, $options=null)
 tripal_core_chado_get_foreign_key ($table_desc, $field, $values, $options=null)
 tripal_core_generate_chado_var ($table, $values, $base_options=array())
 tripal_core_expand_chado_vars ($object, $type, $to_expand, $table_options=array())
 tripal_core_exclude_type_by_default ()
 tripal_core_exclude_field_from_feature_by_default ()
 tripal_core_get_property ($basetable, $record_id, $property, $cv_name)
 tripal_core_insert_property ($basetable, $record_id, $property, $cv_name, $value, $update_if_present=0)
 tripal_core_update_property ($basetable, $record_id, $property, $cv_name, $value, $insert_if_missing=0)
 tripal_core_delete_property ($basetable, $record_id, $property, $cv_name)
 tripal_db_set_active ($dbname)
 tripal_get_max_chado_rank ($tablename, $where_options)
 tripal_core_is_chado_installed ()

Detailed Description

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).


Function Documentation

tripal_core_chado_delete ( table,
match 
)

Provides a generic function for deleting a record(s) from any chado table

Use this function to delete a record(s) in any Chado table. The first argument specifies the table to delete from and the second is an array of values to match for locating the record(s) to be deleted. The arrays are mutli-dimensional such that foreign key lookup values can be specified.

Parameters:
$tableThe name of the chado table for inserting
$matchAn associative array containing the values for locating a record to update.
Returns:
On success this function returns TRUE. On failure, it returns FALSE.

Example usage:

   $umatch = array(
     'organism_id' => array(
         'genus' => 'Citrus',
         'species' => 'sinensis',
      ),
     'uniquename' => 'orange1.1g000034m.g7',
     'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'gene',
         'is_obsolete' => 0
      ),
   );
   $uvalues = array(
      'name' => 'orange1.1g000034m.g',
      'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'mRNA',
         'is_obsolete' => 0
      ),
   );
   $result = tripal_core_chado_update('feature',$umatch,$uvalues);

The above code species that a feature with a given uniquename, organism_id, and type_id (the unique constraint for the feature table) will be deleted. The organism_id is specified as a nested array that uses the organism_id foreign key constraint to lookup the specified values to find the exact organism_id. The same nested struture is also used for specifying the values to update. The function will find all records that match the columns specified and delete them.

Definition at line 266 of file tripal_core.api.inc.

References tripal_core_chado_get_foreign_key(), and tripal_db_set_active().

Referenced by chado_organism_delete(), and tripal_core_delete_property().

tripal_core_chado_get_foreign_key ( table_desc,
field,
values,
options = null 
)

Gets the value of a foreign key relationship

This function is used by tripal_core_chado_select, tripal_core_chado_insert, and tripal_core_chado_update to iterate through the associate array of values that gets passed to each of those routines. The values array is nested where foreign key contraints are used to specify a value that. See documentation for any of those functions for further information.

Parameters:
$table_descA table description for the table with the foreign key relationship to be identified generated by hook_chado_<table name>_schema()
$fieldThe field in the table that is the foreign key.
$valuesAn associative array containing the values
$optionsAn associative array of additional options where the key is the option and the value is the value of that option. These options are passed on to tripal_core_chado_select.

Additional Options Include:

  • case_insensitive_columns An array of columns to do a case insensitive search on.
  • regex_columns An array of columns where the value passed in should be treated as a regular expression
Returns:
A string containg the results of the foreign key lookup, or FALSE if failed.

Example usage:

   $values = array(
     'genus' => 'Citrus',
     'species' => 'sinensis',
   );
   $value = tripal_core_chado_get_foreign_key('feature','organism_id',$values);

The above code selects a record from the feature table using the three fields that uniquely identify a feature. The $columns array simply lists the columns to select. The $values array is nested such that the organism is identified by way of the organism_id foreign key constraint by specifying the genus and species. The cvterm is also specified using its foreign key and the cv_id for the cvterm is nested as well.

Definition at line 696 of file tripal_core.api.inc.

References tripal_core_chado_select().

Referenced by tripal_core_chado_delete(), tripal_core_chado_insert(), tripal_core_chado_select(), and tripal_core_chado_update().

tripal_core_chado_insert ( table,
values 
)

Provides a generic routine for inserting into any Chado table

Use this function to insert a record into any Chado table. The first argument specifies the table for inserting and the second is an array of values to be inserted. The array is mutli-dimensional such that foreign key lookup values can be specified.

Parameters:
$tableThe name of the chado table for inserting
$valuesAn associative array containing the values for inserting.
Returns:
On success this function returns TRUE. On failure, it returns FALSE.

Example usage:

   $values =  array(
     'organism_id' => array(
         'genus' => 'Citrus',
         'species' => 'sinensis',
      ),
     'name' => 'orange1.1g000034m.g',
     'uniquename' => 'orange1.1g000034m.g',
     'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'gene',
         'is_obsolete' => 0
      ),
   );
   $result = tripal_core_chado_insert('feature',$values);

The above code inserts a record into the feature table. The $values array is nested such that the organism is selected by way of the organism_id foreign key constraint by specifying the genus and species. The cvterm is also specified using its foreign key and the cv_id for the cvterm is nested as well.

Definition at line 111 of file tripal_core.api.inc.

References tripal_core_chado_get_foreign_key(), tripal_core_chado_select(), and tripal_db_set_active().

Referenced by chado_analysis_insert(), chado_feature_insert(), chado_library_insert(), chado_organism_insert(), chado_stock_insert(), chado_stock_update(), tripal_core_insert_property(), tripal_core_load_gff3_dbxref(), tripal_core_load_gff3_feature(), tripal_core_load_gff3_ontology(), and tripal_cv_add_cvterm_form_submit().

tripal_core_chado_select ( table,
columns,
values,
options = null 
)

Provides a generic routine for selecting data from a Chado table

Use this function to perform a simple select from any Chado table.

Parameters:
$tableThe name of the chado table for inserting
$columnsAn array of column names
$valuesAn associative array containing the values for filtering the results. In the case where multiple values for the same time are to be selected an additional entry for the field should appear for each value
$optionsAn associative array of additional options where the key is the option and the value is the value of that option.

Additional Options Include:

  • has_record Set this argument to 'true' to have this function return a numeric value for the number of recrods rather than the array of records. this can be useful in 'if' statements to check the presence of particula records.
  • return_sql Set this to 'true' to have this function return an array where the first element is the sql that would have been run and the second is an array of arguments.
  • case_insensitive_columns An array of columns to do a case insensitive search on.
  • regex_columns An array of columns where the value passed in should be treated as a regular expression
  • order_by An associative array containing the column names of the table as keys and the type of sort (i.e. ASC, DESC) as the values. The results in the query will be sorted by the key values in the direction listed by the value
Returns:
A database query result resource, FALSE if the query was not executed correctly, or the number of records in the dataset if $has_record is set.

Example usage:

   $columns = array('feature_id','name');
   $values =  array(
     'organism_id' => array(
         'genus' => 'Citrus',
         'species' => array('sinensis','clementina'),
      ),
     'uniquename' => 'orange1.1g000034m.g',
     'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'gene',
         'is_obsolete' => 0
      ),
   );
   $result = tripal_core_chado_select('feature',$columns,$values);

The above code selects a record from the feature table using the three fields that uniquely identify a feature. The $columns array simply lists the columns to select. The $values array is nested such that the organism is identified by way of the organism_id foreign key constraint by specifying the genus and species. The cvterm is also specified using its foreign key and the cv_id for the cvterm is nested as well. In the example above, two different species are allowed to match

Definition at line 522 of file tripal_core.api.inc.

References $args, tripal_core_chado_get_foreign_key(), and tripal_db_set_active().

Referenced by chado_analysis_insert(), chado_feature_insert(), chado_feature_update(), chado_library_insert(), chado_library_update(), chado_organism_validate(), chado_stock_insert(), chado_stock_update(), views_handler_filter_chado_select_cvterm_name::init(), tripal_analysis_validate(), tripal_core_chado_get_foreign_key(), tripal_core_chado_insert(), tripal_core_expand_chado_vars(), tripal_core_generate_chado_var(), tripal_core_load_gff3(), tripal_core_load_gff3_dbxref(), tripal_core_load_gff3_feature(), tripal_core_load_gff3_ontology(), tripal_cv_add_cvterm_form(), tripal_cv_add_cvterm_form_submit(), tripal_cv_get_cv(), tripal_cv_get_cvterm(), tripal_db_get_db(), tripal_db_get_dbxref(), tripal_feature_job_describe_args(), tripal_feature_set_urls(), tripal_stock_get_stock_by_name_identifier(), tripal_stock_get_stocks(), tripal_stock_get_stocks_by_stockprop(), views_handler_filter_organism_common_name::value_form(), and views_handler_filter_chado_select_string::value_form().

tripal_core_chado_update ( table,
match,
values 
)

Provides a generic routine for updating into any Chado table

Use this function to update a record in any Chado table. The first argument specifies the table for inserting, the second is an array of values to matched for locating the record for updating, and the third argument give the values to update. The arrays are mutli-dimensional such that foreign key lookup values can be specified.

Parameters:
$tableThe name of the chado table for inserting
$matchAn associative array containing the values for locating a record to update.
$valuesAn associative array containing the values for updating.
Returns:
On success this function returns TRUE. On failure, it returns FALSE.

Example usage:

   $umatch = array(
     'organism_id' => array(
         'genus' => 'Citrus',
         'species' => 'sinensis',
      ),
     'uniquename' => 'orange1.1g000034m.g7',
     'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'gene',
         'is_obsolete' => 0
      ),
   );
   $uvalues = array(
      'name' => 'orange1.1g000034m.g',
      'type_id' => array (
         'cv_id' => array (
            'name' => 'sequence',
         ),
         'name' => 'mRNA',
         'is_obsolete' => 0
      ),
   );
   $result = tripal_core_chado_update('feature',$umatch,$uvalues);

The above code species that a feature with a given uniquename, organism_id, and type_id (the unique constraint for the feature table) will be updated. The organism_id is specified as a nested array that uses the organism_id foreign key constraint to lookup the specified values to find the exact organism_id. The same nested struture is also used for specifying the values to update. The function will find the record that matches the columns specified and update the record with the avlues in the $uvalues array.

Definition at line 373 of file tripal_core.api.inc.

References tripal_core_chado_get_foreign_key(), and tripal_db_set_active().

Referenced by chado_feature_update(), chado_library_update(), chado_organism_update(), chado_stock_update(), tripal_core_load_gff3(), and tripal_core_update_property().

tripal_core_delete_property ( basetable,
record_id,
property,
cv_name 
)

Deletes a property for a given basetable record

Parameters:
$basetableThe base table for which the property should be deleted. Thus to deleted a property for a feature the basetable=feature and property is deleted from featureprop
$record_idThe primary key of the basetable to delete a property for. This should be in integer.
$propertyThe cvterm name describing the type of property to be deleted
$cv_nameThe name of the cv that the above cvterm is part of

Note: The property to be deleted is select via theu nique combination of $record_id and $property

Returns:
Return True on Delete and False otherwise

Definition at line 1489 of file tripal_core.api.inc.

References tripal_core_chado_delete().

Referenced by tripal_analysis_delete_property(), and tripal_library_delete_property().

tripal_core_exclude_field_from_feature_by_default ( )

Implements hook_exclude_field_from_<tablename>_by_default()

This hooks allows fields from a specified table that match a specified criteria to be excluded by default from any table when tripal_core_generate_chado_var() is called. Keep in mind that if fields are excluded by default they can always be expanded at a later date using tripal_core_expand_chado_vars().

Criteria are php strings that evaluate to either TRUE or FALSE. These strings are evaluated using drupal_eval() which suppresses syntax errors and throws watchdog entries of type php. There are also watchdog entries of type tripal_core stating the exact criteria evaluated. Criteria can contain the following tokens:

  • >field_name< Replaced by the name of the field to be excluded
  • >field_value< Replaced by the value of the field in the current record Also keep in mind that if your criteria doesn't contain the >field_value< token then it will be evaluated before the query is executed and if the field is excluded it won't be included in the query.
Returns:
An array of type => criteria where the type is excluded if the criteria evaluates to TRUE

Definition at line 1268 of file tripal_core.api.inc.

tripal_core_exclude_type_by_default ( )

Implements hook_exclude_type_by_default()

This hooks allows fields of a specified type that match a specified criteria to be excluded by default from any table when tripal_core_generate_chado_var() is called. Keep in mind that if fields are excluded by default they can always be expanded at a later date using tripal_core_expand_chado_vars().

Criteria are php strings that evaluate to either TRUE or FALSE. These strings are evaluated using drupal_eval() which suppresses syntax errors and throws watchdog entries of type php. There are also watchdog entries of type tripal_core stating the exact criteria evaluated. Criteria can contain the following tokens:

  • >field_name< Replaced by the name of the field to be excluded
  • >field_value< Replaced by the value of the field in the current record Also keep in mind that if your criteria doesn't contain the >field_value< token then it will be evaluated before the query is executed and if the field is excluded it won't be included in the query.
Returns:
An array of type => criteria where the type is excluded if the criteria evaluates to TRUE

Definition at line 1239 of file tripal_core.api.inc.

tripal_core_expand_chado_vars ( object,
type,
to_expand,
table_options = array() 
)

Retrieves fields/tables/nodes that were excluded by default from a variable and adds them

This function exists to allow tripal_core_generate_chado_var() to excldue some fields/tables/nodes from the default form of a variable without making it extremely difficult for the tripal admin to get at these variables if he/she wants them.

Parameters:
$objectThis must be an object generated using tripal_core_generate_chado_var()
$typeMust be one of 'field', 'table', 'node'. Indicates what is being expanded.
$to_expandThe name of the field/table/node to be expanded
$table_optionsAn array containing options for the base table. For example, an option of 'order_by' may be used to sort results in the base table if more than one are returned. The options must be compatible with the options accepted by the tripal_core_chado_select() function.
Returns:
A chado object supplemented with the field/table/node requested to be expanded

Example Usage:

      // Get a chado object to be expanded
      $values = array(
        'name' => 'Medtr4g030710'
      );
      $features = tripal_core_generate_chado_var('feature', $values);
      
      // Expand the organism node
      $feature = tripal_core_expand_chado_vars($feature, 'node', 'organism');
      
      // Expand the feature.residues field
      $feature = tripal_core_expand_chado_vars($feature, 'field', 'feature.residues');
      
      // Expand the feature properties (featureprop table)
      $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureprop');

Definition at line 1032 of file tripal_core.api.inc.

References tripal_core_chado_select().

Referenced by chado_analysis_form(), chado_feature_form(), chado_organism_form(), chado_organism_load(), chado_stock_form(), tripal_core_get_property(), tripal_genetic_get_genotypes_by_feature_id(), tripal_stock_edit_ALL_db_references_form(), tripal_stock_edit_ALL_properties_form(), and tripal_stock_edit_ALL_relationships_form().

tripal_core_generate_chado_var ( table,
values,
base_options = array() 
)

Generates an object containing the full details of a record(s) in chado.

This differs from the objects returned by tripal_core_chado_select in so far as all foreign key relationships have been followed meaning you have more complete details. Thus this function should be used whenever you need a full variable and tripal_core_chado_select should be used if you only case about a few columns.

Parameters:
$tableThe name of the base table to generate a variable for
$valuesA select values array that selects the records you want from the base table (this has the same form as tripal_core_chado_select)
$base_optionsAn array containing options for the base table. For example, an option of 'order_by' may be used to sort results in the base table if more than one are returned. The options must be compatible with the options accepted by the tripal_core_chado_select() function.
Returns:
Either an object (if only one record was selected from the base table) or an array of objects (if more than one record was selected from the base table).

Example Usage:

      $values = array(
        'name' => 'Medtr4g030710'
      );
      $features = tripal_core_generate_chado_var('feature', $values);

This will return an object if there is only one feature with the name Medtr4g030710 or it will return an array of feature objects if more than one feature has that name.

Note to Module Designers: Fields can be excluded by default from these objects by implementing one of the following hooks:

  • hook_exclude_field_from_tablename_by_default (where tablename is the name of the table): This hook allows you to add fields to be excluded on a per table basis. Simply implement this hook to return an array of fields to be excluded. For example:
              mymodule_exclude_field_from_feature_by_default() {
                return array('residues' => TRUE);
              }
    
    will ensure that feature.residues is ecluded from a feature object by default.
  • hook_exclude_type_by_default: This hook allows you to exclude fields from all tables that are of a given postgresql field type. Simply implement this hook to return an array of postgresql types mapped to criteria. Then all fields of that type where the criteria supplied returns TRUE will be excluded from any table. Tokens available in criteria are >field_value< and >field_name< . For example:
              mymodule_exclude_type_by_default() {
                return array('text' => 'length(&gt;field_value&lt; ) > 50');
              }
    
    will exclude all text fields with a length > 50. Thus if $feature.residues is longer than 50 * it will be excluded, otherwise it will be added.

Definition at line 804 of file tripal_core.api.inc.

References tripal_core_chado_select().

Referenced by chado_analysis_load(), chado_feature_load(), chado_library_load(), chado_organism_load(), chado_stock_load(), tripal_core_get_property(), and tripal_genetic_get_genotypes_by_feature_id().

tripal_core_get_property ( basetable,
record_id,
property,
cv_name 
)

Retrieve a property for a given base table record

Parameters:
$basetableThe base table for which the property should be retrieved. Thus to retrieve a property for a feature the basetable=feature and property is retrieved from featureprop
$record_idThe primary key of the basetable to retrieve properties for. This should be in integer.
$propertyThe cvterm name describing the type of properties to be retrieved
$cv_nameThe name of the cv that the above cvterm is part of
Returns:
A chado variable with the specified properties expanded

Definition at line 1333 of file tripal_core.api.inc.

References tripal_core_expand_chado_vars(), and tripal_core_generate_chado_var().

Referenced by tripal_analysis_get_property(), tripal_core_insert_property(), tripal_core_update_property(), and tripal_library_get_property().

tripal_core_insert_property ( basetable,
record_id,
property,
cv_name,
value,
update_if_present = 0 
)

Insert a property for a given basetable record

Parameters:
$basetableThe base table for which the property should be inserted. Thus to insert a property for a feature the basetable=feature and property is inserted into featureprop
$record_idThe primary key of the basetable to insert a property for. This should be in integer.
$propertyThe cvterm name describing the type of properties to be inserted
$cv_nameThe name of the cv that the above cvterm is part of
$valueThe value of the property to be inserted (can be empty)
$update_if_presentA boolean indicating whether an existing record should be updated or an error thrown
Returns:
Return True on Insert/Update and False otherwise

Definition at line 1376 of file tripal_core.api.inc.

References tripal_core_chado_insert(), tripal_core_get_property(), and tripal_core_update_property().

Referenced by tripal_analysis_insert_property(), tripal_core_update_property(), and tripal_library_insert_property().

tripal_core_is_chado_installed ( )
Parameters:
$dbnameThe name of the database to switch to as indicated in settings.php Should be either default or chado
Returns:
The name of the previously set database

Definition at line 212 of file tripal_core.module.

Referenced by tripal_core_init().

tripal_core_update_property ( basetable,
record_id,
property,
cv_name,
value,
insert_if_missing = 0 
)

Update a property for a given basetable record

Parameters:
$basetableThe base table for which the property should be updated. Thus to update a property for a feature the basetable=feature and property is updated in featureprop
$record_idThe primary key of the basetable to update a property for. This should be in integer.
$propertyThe cvterm name describing the type of property to be updated
$cv_nameThe name of the cv that the above cvterm is part of
$valueThe value of the property to be inserted (can be empty)
$insert_if_missingA boolean indicating whether a record should be inserted if one doesn't exist to update

Note: The property to be updated is select via theu nique combination of $record_id and $property and then it is updated with the supplied value

Returns:
Return True on Update/Insert and False otherwise

Definition at line 1434 of file tripal_core.api.inc.

References tripal_core_chado_update(), tripal_core_get_property(), and tripal_core_insert_property().

Referenced by tripal_analysis_update_property(), tripal_core_insert_property(), and tripal_library_update_property().

tripal_db_set_active ( dbname)

Set the Tripal Database

The tripal_db_set_active function is used to prevent namespace collisions when chado and drupal are installed in the same database but in different schemas. It is also used for backwards compatibility with older versions of tripal or in cases where chado is located outside of the Drupal database.

Definition at line 1560 of file tripal_core.api.inc.

Referenced by chado_analysis_delete(), chado_analysis_insert(), chado_analysis_update(), chado_feature_add_gbaccession(), chado_feature_add_synonyms(), chado_feature_delete(), chado_feature_form(), chado_feature_validate(), chado_library_delete(), chado_library_form(), chado_library_validate(), chado_library_view(), chado_organism_delete(), chado_stock_delete(), chado_stock_validate(), get_chado_analyses(), get_chado_libraries(), get_chado_organisms(), get_max_chado_rank(), get_tripal_analysis_admin_form_reindex_set(), get_tripal_analysis_admin_form_sync_set(), get_tripal_analysis_admin_form_taxonomy_set(), get_tripal_feature_admin_form_sync_set(), get_tripal_library_admin_form_reindex_set(), get_tripal_library_admin_form_sync_set(), get_tripal_library_admin_form_taxonomy_set(), get_tripal_organism_admin_form_reindex_set(), get_tripal_organism_admin_form_sync_set(), get_tripal_organism_admin_form_taxonomy_set(), views_handler_filter_chado_select_cvterm_name::init(), views_handler_filter_chado_boolean::init(), views_handler_argument_stockprop_id::options_form(), organism_get_synced(), views_handler_field_chado_relationship_all::pre_render(), views_handler_field_chado_count::pre_render(), theme_tripal_library_node_libraries(), theme_tripal_library_search_index(), tripal_add_cvterms(), tripal_add_db(), tripal_add_mview(), tripal_analyses_cleanup(), tripal_analysis_admin_validate(), tripal_analysis_install(), tripal_analysis_sync_analyses(), tripal_core_chado_delete(), tripal_core_chado_insert(), tripal_core_chado_select(), tripal_core_chado_update(), tripal_core_get_chado_tables(), tripal_core_gff3_load_form(), tripal_core_init(), tripal_core_load_gff3(), tripal_cv_add_form_submit(), tripal_cv_count_chart(), tripal_cv_cvterm_edit(), tripal_cv_cvterm_info(), tripal_cv_cvtermpath_form(), tripal_cv_cvtermpath_form_validate(), tripal_cv_edit_form(), tripal_cv_edit_form_submit(), tripal_cv_get_cv_by_id(), tripal_cv_get_cv_by_name(), tripal_cv_get_cv_id(), tripal_cv_get_cv_options(), tripal_cv_get_cvterm_by_name(), tripal_cv_get_cvterm_options(), tripal_cv_get_term_children(), tripal_cv_init_tree(), tripal_cv_install(), tripal_cv_list_form(), tripal_cv_load_obo_v1_2(), tripal_cv_obo_loader_done(), tripal_cv_select_form(), tripal_cv_update_cvtermpath(), tripal_db_form(), tripal_db_form_submit(), tripal_db_get_db_by_db_id(), tripal_db_get_db_by_name(), tripal_db_get_db_options(), tripal_db_get_dbxref_by_accession(), tripal_db_select_form(), tripal_feature_add_ONE_dbreference_form_submit(), tripal_feature_add_ONE_dbreference_form_validate(), tripal_feature_add_ONE_property_form_submit(), tripal_feature_add_ONE_property_form_validate(), tripal_feature_add_ONE_relationship_form_validate(), tripal_feature_aggregator_form(), tripal_feature_aggregator_form_submit(), tripal_feature_aggregator_form_validate(), tripal_feature_aggregator_select_form(), tripal_feature_delete_db_reference(), tripal_feature_delete_property(), tripal_feature_edit_ALL_relationships_form_validate(), tripal_feature_fasta_load_form(), tripal_feature_fasta_loader_insert_feature(), tripal_feature_get_aggregate_types(), tripal_feature_load_featureloc_sequences(), tripal_feature_load_featurelocs(), tripal_feature_load_organism(), tripal_feature_load_organism_feature_browser(), tripal_feature_load_organism_feature_counts(), tripal_feature_load_properties(), tripal_feature_load_references(), tripal_feature_load_relationships(), tripal_feature_load_synonyms(), tripal_feature_set_taxonomy(), tripal_feature_sync_feature(), tripal_feature_sync_features(), tripal_feature_update_db_reference(), tripal_feature_update_property(), tripal_features_cleanup(), tripal_get_max_chado_rank(), tripal_library_admin_validate(), tripal_library_feature_set_taxonomy(), tripal_library_install(), tripal_library_reindex_features(), tripal_library_sync_libraries(), tripal_library_taxonify_features(), tripal_mviews_action(), tripal_organism_admin_validate(), tripal_organism_get_organism_options(), tripal_organism_get_synced(), tripal_organism_reindex_features(), tripal_organism_sync_organisms(), tripal_organism_taxonify_features(), tripal_search_file(), tripal_stock_add_ONE_dbreference_form_submit(), tripal_stock_add_ONE_dbreference_form_validate(), tripal_stock_add_ONE_property_form_submit(), tripal_stock_add_ONE_property_form_validate(), tripal_stock_add_ONE_relationship_form_submit(), tripal_stock_add_ONE_relationship_form_validate(), tripal_stock_delete_db_reference(), tripal_stock_delete_property(), tripal_stock_delete_relationship(), tripal_stock_edit_ALL_relationships_form_validate(), tripal_stock_is_obsolete_form_submit(), tripal_stock_sync_stock_set(), tripal_stock_update_db_reference(), tripal_stock_update_property(), tripal_stock_update_relationship(), tripal_stock_views_pre_render(), tripal_update_mview(), views_handler_filter_stockprop_id::types_form(), and views_handler_filter_stockprop_id::value_form().

tripal_get_max_chado_rank ( tablename,
where_options 
)

Purpose: Get max rank for a given set of criteria This function was developed with the many property tables in chado in mind

Parameters:
$tablenameThe name of the chado table you want to select the max rank from this table must contain a rank column of type integer
$where_optionswhere options should include the id and type for that table to correctly group a set of records together where the only difference are the value and rank
  array(
     <column_name> => array(
        'type' => <type of column: INT/STRING>,
       'value' => <the value you want to filter on>,
      'exact' => <if TRUE use =; if FALSE use ~>,
    )
  )
Returns:
the maximum rank

Definition at line 1622 of file tripal_core.api.inc.

References tripal_db_set_active().

 All Classes Files Functions Variables