Browse Source

Converted old API functions to new functions

Stephen Ficklin 11 năm trước cách đây
mục cha
commit
c1b87f555b
72 tập tin đã thay đổi với 801 bổ sung800 xóa
  1. 4 4
      tripal_analysis/api/tripal_analysis.api.inc
  2. 3 3
      tripal_analysis/api/tripal_analysis.schema.api.inc
  3. 19 19
      tripal_analysis/includes/tripal_analysis.chado_node.inc
  4. 1 1
      tripal_analysis/includes/tripal_analysis_privacy.inc
  5. 1 1
      tripal_analysis/tripal_analysis.install
  6. 7 7
      tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc
  7. 17 17
      tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
  8. 2 2
      tripal_bulk_loader/tripal_bulk_loader.drush.inc
  9. 1 1
      tripal_bulk_loader/tripal_bulk_loader.module
  10. 9 9
      tripal_contact/api/tripal_contact.api.inc
  11. 24 24
      tripal_contact/includes/tripal_contact.chado_node.inc
  12. 1 1
      tripal_contact/theme/tripal_contact.theme.inc
  13. 2 2
      tripal_contact/tripal_contact.install
  14. 15 14
      tripal_core/api/tripal_core.files.api.inc
  15. 50 50
      tripal_cv/api/tripal_cv.api.inc
  16. 3 3
      tripal_cv/api/tripal_cv.schema.api.inc
  17. 5 5
      tripal_cv/includes/cv_form.inc
  18. 13 13
      tripal_cv/includes/cvterm_form.inc
  19. 26 26
      tripal_cv/includes/obo_loader.inc
  20. 0 0
      tripal_cv/theme/tripal_cv_help.tpl.php
  21. 1 1
      tripal_cv/tripal_cv.install
  22. 8 8
      tripal_cv/tripal_cv.module
  23. 22 22
      tripal_db/api/tripal_db.api.inc
  24. 5 5
      tripal_db/includes/tripal_db.admin.inc
  25. 0 0
      tripal_db/theme/tripal_db_help.tpl.php
  26. 0 1
      tripal_db/tripal_db.info
  27. 1 1
      tripal_db/tripal_db.install
  28. 8 8
      tripal_db/tripal_db.module
  29. 22 22
      tripal_example/includes/tripal_example.chado_node.inc
  30. 38 38
      tripal_feature/api/tripal_feature.api.inc
  31. 3 3
      tripal_feature/api/tripal_feature.schema.api.inc
  32. 1 1
      tripal_feature/includes/tripal_feature.admin.inc
  33. 32 32
      tripal_feature/includes/tripal_feature.chado_node.inc
  34. 4 4
      tripal_feature/includes/tripal_feature.delete.inc
  35. 46 46
      tripal_feature/includes/tripal_feature.fasta_loader.inc
  36. 121 121
      tripal_feature/includes/tripal_feature.gff_loader.inc
  37. 5 5
      tripal_feature/theme/tripal_feature.theme.inc
  38. 1 1
      tripal_feature/tripal_feature.install
  39. 11 11
      tripal_feature/tripal_feature.module
  40. 8 8
      tripal_featuremap/api/tripal_featuremap.api.inc
  41. 24 24
      tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  42. 4 4
      tripal_featuremap/tripal_featuremap.install
  43. 4 4
      tripal_library/api/tripal_library.api.inc
  44. 18 18
      tripal_library/includes/tripal_library.chado_node.inc
  45. 3 3
      tripal_library/tripal_library.install
  46. 1 1
      tripal_natural_diversity/tripal_natural_diversity.install
  47. 1 1
      tripal_organism/api/tripal_organism.api.inc
  48. 2 2
      tripal_organism/includes/tripal_organism.admin.inc
  49. 22 21
      tripal_organism/includes/tripal_organism.chado_node.inc
  50. 2 2
      tripal_organism/tripal_organism.install
  51. 1 1
      tripal_organism/tripal_organism.module
  52. 4 4
      tripal_project/api/tripal_project.api.inc
  53. 18 18
      tripal_project/includes/tripal_project.chado_node.inc
  54. 1 1
      tripal_project/theme/tripal_project.theme.inc
  55. 2 2
      tripal_project/tripal_project.install
  56. 42 42
      tripal_pub/api/tripal_pub.api.inc
  57. 4 4
      tripal_pub/includes/importers/tripal_pub.PMID.inc
  58. 32 32
      tripal_pub/includes/tripal_pub.chado_node.inc
  59. 3 3
      tripal_pub/includes/tripal_pub.pub_importers.inc
  60. 3 3
      tripal_pub/includes/tripal_pub.pub_search.inc
  61. 1 1
      tripal_pub/theme/tripal_pub.theme.inc
  62. 2 2
      tripal_pub/tripal_pub.install
  63. 8 8
      tripal_stock/api/tripal_stock.api.inc
  64. 28 28
      tripal_stock/includes/tripal_stock.chado_node.inc
  65. 12 12
      tripal_stock/includes/tripal_stock.sync_stocks.inc
  66. 1 1
      tripal_stock/tripal_stock.install
  67. 1 1
      tripal_stock/tripal_stock.module
  68. 6 6
      tripal_views/api/tripal_views.api.inc
  69. 6 6
      tripal_views/includes/tripal_views_integration.inc
  70. 1 1
      tripal_views/tripal_views.install
  71. 2 2
      tripal_views/tripal_views.views.inc
  72. 2 2
      tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

+ 4 - 4
tripal_analysis/api/tripal_analysis.api.inc

@@ -61,7 +61,7 @@ function tripal_analysis_api_unregister_child($modulename) {
  * @ingroup tripal_analysis_api
  */
 function tripal_analysis_api_get_property($analysis_id, $property, $cvname = 'tripal') {
-  return tripal_core_get_property('analysis', $analysis_id, $property, $cvname);
+  return chado_get_property('analysis', $analysis_id, $property, $cvname);
 }
 
 /**
@@ -84,7 +84,7 @@ function tripal_analysis_api_get_property($analysis_id, $property, $cvname = 'tr
  * @ingroup tripal_analysis_api
  */
 function tripal_analysis_api_insert_property($analysis_id, $property, $value, $update_if_present = 0, $cvname = 'tripal') {
-    return tripal_core_insert_property('analysis', $analysis_id, $property, $cvname, $value, $update_if_present);
+    return chado_insert_property('analysis', $analysis_id, $property, $cvname, $value, $update_if_present);
 }
 
 /**
@@ -110,7 +110,7 @@ function tripal_analysis_api_insert_property($analysis_id, $property, $value, $u
  * @ingroup tripal_analysis_api
  */
 function tripal_analysis_api_update_property($analysis_id, $property, $value, $insert_if_missing = 0, $cvname = 'tripal') {
-  return tripal_core_update_property('analysis', $analysis_id, $property, $cvname, $value, $insert_if_missing);
+  return chado_update_property('analysis', $analysis_id, $property, $cvname, $value, $insert_if_missing);
 }
 
 /**
@@ -132,7 +132,7 @@ function tripal_analysis_api_update_property($analysis_id, $property, $value, $i
  * @ingroup tripal_analysis_api
  */
 function tripal_analysis_api_delete_property($analysis_id, $property, $cvname = 'tripal') {
-  return tripal_core_delete_property('analysis', $analysis_id, $property, $cvname);
+  return chado_delete_property('analysis', $analysis_id, $property, $cvname);
 }
 
 /**

+ 3 - 3
tripal_analysis/api/tripal_analysis.schema.api.inc

@@ -3,9 +3,9 @@
 /**
  * Implements hook_chado_schema_v1_11_analysisfeatureprop()
  * Purpose: To describe the structure of 'analysisfeatureprop' to tripal
- * @see tripal_core_chado_insert()
- * @see tripal_core_chado_update()
- * @see tripal_core_chado_select()
+ * @see chado_insert_record()
+ * @see chado_update_record()
+ * @see chado_select_record()
  *
  * @return
  *    An array describing the 'analysisfeatureprop' table

+ 19 - 19
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -74,7 +74,7 @@ function chado_analysis_form($node, &$form_state) {
   // if we are editing an existing node then the analysis is already part of the node
   if (property_exists($node, 'analysis')) {
     $analysis = $node->analysis;
-    $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');
+    $analysis = chado_expand_var($analysis, 'field', 'analysis.description');
     $analysis_id = $analysis->analysis_id;
 
     // get form defaults
@@ -241,7 +241,7 @@ function chado_analysis_form($node, &$form_state) {
     'fieldset_title' => 'Properties',
     'additional_instructions' => $instructions
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   return $form;
 }
@@ -292,13 +292,13 @@ function tripal_analysis_validate($node, $form, &$form_state) {
 
     // get the existing node
     $values = array('analysis_id' => $node->analysis_id);
-    $result = tripal_core_chado_select('analysis', array('*'), $values);
+    $result = chado_select_record('analysis', array('*'), $values);
     $analysis = $result[0];
 
     // if the name has changed make sure it doesn't conflict with an existing name
     if ($analysis->name != $node->analysisname) {
       $values = array('name' => $node->analysisname);
-      $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
+      $result = chado_select_record('analysis', array('analysis_id'), $values);
       if ($result and count($result) > 0) {
         form_set_error('analysisname', 'Cannot update the analysis with this analysis name. An analysis with this name already exists.');
         return;
@@ -314,7 +314,7 @@ function tripal_analysis_validate($node, $form, &$form_state) {
         'programversion' => $node->programversion,
         'sourcename' => $node->sourcename,
       );
-      $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
+      $result = chado_select_record('analysis', array('analysis_id'), $values);
       if ($result and count($result) > 0) {
         if ($analysis->program != $node->program) {
           $field = 'program';
@@ -338,7 +338,7 @@ function tripal_analysis_validate($node, $form, &$form_state) {
       'programversion' => $node->programversion,
       'sourcename' => $node->sourcename,
     );
-    $analysis = tripal_core_chado_select('analysis', array('analysis_id'), $values);
+    $analysis = chado_select_record('analysis', array('analysis_id'), $values);
     if ($analysis and count($analysis) > 0) {
       form_set_error('program', 'Cannot add the analysis with this program,
         program version and source name. An analysis with these values already exists.');
@@ -349,7 +349,7 @@ function tripal_analysis_validate($node, $form, &$form_state) {
     // for the analysis table but we use the analysis name for the Drupal node
     // title, so it should be unique
     $values = array('name' => $node->analysisname);
-    $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
+    $result = chado_select_record('analysis', array('analysis_id'), $values);
     if ($result and count($result) > 0) {
       form_set_error('analysisname', 'Cannot add the analysis with this analysis name. An analysis with this name already exists.');
       return;
@@ -400,10 +400,10 @@ function chado_analysis_insert($node) {
       'sourceuri'      => $node->sourceuri,
       'timeexecuted'   => $timestamp
     );
-    $analysis = tripal_core_chado_insert('analysis', $values);
+    $analysis = chado_insert_record('analysis', $values);
     if (!$analysis) {
       drupal_set_message(t('Unable to add analysis.', 'warning'));
-      tripal_core_report_error('tripal_analysis', TRIPAL_ERROR, 'Insert analysis: Unable to create analysis where values:%values',
+      tripal_report_error('tripal_analysis', TRIPAL_ERROR, 'Insert analysis: Unable to create analysis where values:%values',
         array('%values' => print_r($values, TRUE)));
       return;
     }
@@ -416,7 +416,7 @@ function chado_analysis_insert($node) {
       'foreignkey_name' => 'analysis_id',
       'foreignkey_value' => $analysis_id
     );
-    chado_node_properties_form_update_properties($node, $details);
+    chado_update_node_form_properties($node, $details);
   }
   else {
     $analysis_id = $node->analysis_id;
@@ -424,7 +424,7 @@ function chado_analysis_insert($node) {
 
   // Make sure the entry for this analysis doesn't already exist in the
   // chado_analysis table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('analysis', $node->nid);
+  $check_org_id = chado_get_id_from_nid('analysis', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -446,7 +446,7 @@ function chado_analysis_insert($node) {
  * @ingroup tripal_analysis
  */
 function chado_analysis_delete($node) {
-  $analysis_id = chado_get_id_for_node('analysis', $node->nid);
+  $analysis_id = chado_get_id_from_nid('analysis', $node->nid);
 
   // if we don't have an analysis id for this node then this isn't a node of
   // type chado_analysis or the entry in the chado_analysis table was lost.
@@ -490,7 +490,7 @@ function chado_analysis_update($node) {
   $timestamp = $month . '/' . $day . '/' . $year;
 
   // update the record in Chado
-  $analysis_id = chado_get_id_for_node('analysis', $node->nid);
+  $analysis_id = chado_get_id_from_nid('analysis', $node->nid);
   $match = array(
     'analysis_id' => $node->analysis_id,
   );
@@ -506,10 +506,10 @@ function chado_analysis_update($node) {
     'timeexecuted'   => $timestamp,
     'analysis_id'    => $analysis_id
   );
-  $status = tripal_core_chado_update('analysis', $match, $values);
+  $status = chado_update_record('analysis', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update analysis.', 'warning'));
-    tripal_core_report_error('tripal_analysis', TRIPAL_ERROR, 'Update analysis: Unable to update analysis where values: %values',
+    tripal_report_error('tripal_analysis', TRIPAL_ERROR, 'Update analysis: Unable to update analysis where values: %values',
     array('%values' => print_r($values, TRUE)));
   }
 
@@ -521,7 +521,7 @@ function chado_analysis_update($node) {
     'foreignkey_name' => 'analysis_id',
     'foreignkey_value' => $analysis_id
   );
-  chado_node_properties_form_update_properties($node, $details);
+  chado_update_node_form_properties($node, $details);
 }
 
 /**
@@ -535,14 +535,14 @@ function chado_analysis_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // find the analysis and add in the details
-    $analysis_id = chado_get_id_for_node('analysis', $nid);
+    $analysis_id = chado_get_id_from_nid('analysis', $nid);
 
     // build the analysis variable
     $values = array('analysis_id' => $analysis_id);
-    $analysis = tripal_core_generate_chado_var('analysis', $values);
+    $analysis = chado_generate_var('analysis', $values);
 
     // add in the description field
-    $analysis = tripal_core_expand_chado_vars($analysis, 'field', 'analysis.description');
+    $analysis = chado_expand_var($analysis, 'field', 'analysis.description');
     $nodes[$nid]->analysis = $analysis;
   }
 }

+ 1 - 1
tripal_analysis/includes/tripal_analysis_privacy.inc

@@ -85,7 +85,7 @@ function tripal_analysis_set_feature_permission($analysis_id, $nid) {
   foreach ($feature_nids AS $fnid) {
     if ($idx_iterations % $interval == 0) {
       $percentage = (int) ($idx_iterations / ($counter + 1) * 100);
-      tripal_job_set_progress($job_id, $percentage);
+      tripal_set_job_progress($job_id, $percentage);
       print $percentage . "% ";
     }
 

+ 1 - 1
tripal_analysis/tripal_analysis.install

@@ -51,7 +51,7 @@ function tripal_analysis_requirements($phase) {
 function tripal_analysis_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_analysis');
+  tripal_create_files_dir('tripal_analysis');
 
   // we may need the analysisfeatureprop table if it doesn't already exist
   tripal_analysis_create_analysisfeatureprop();

+ 7 - 7
tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc

@@ -329,7 +329,7 @@ function tripal_bulk_loader_modify_template_base_form($form, &$form_state = NULL
               // so we need to get it.
               $fk_priority = $form_state['storage']['record2priority'][$field['foreign key']];
               $fk_table = $form_state['storage']['template'][$fk_priority]['table'];
-              $tbl_description = tripal_core_get_chado_table_schema($table_array['table']);
+              $tbl_description = chado_get_schema($table_array['table']);
               foreach ($tbl_description['foreign keys'] as $key_table => $key_array) {
                 foreach ($key_array['columns'] as $left_field => $right_field) {
                   if ($key_table == $fk_table and $left_field == $field['field']) {
@@ -849,7 +849,7 @@ function tripal_bulk_loader_edit_template_record_form($form, $form_state) {
   }
 
   // Tables and default table
-  $tables = tripal_core_get_chado_tables(TRUE);
+  $tables = chado_get_table_names(TRUE);
   if (isset($form_state['values']['chado_table'])) {
     $table = $form_state['values']['chado_table'];
   }
@@ -1135,7 +1135,7 @@ function tripal_bulk_loader_edit_template_record_form_submit($form, &$form_state
     }
     else {
       drupal_set_message(t('Unable to Save Template!'), 'error');
-      tripal_core_report_error('T_bulk_loader',
+      tripal_report_error('T_bulk_loader',
         TRIPAL_ERROR,
         'Unable to save bulk loader template: %template',
         array('%template' => print_r($form_state['storage']['template'], TRUE))
@@ -1529,7 +1529,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
   }
 
   // Chado Tables and default table
-  $tables = tripal_core_get_chado_tables(TRUE);
+  $tables = chado_get_table_names(TRUE);
   if (isset($form_state['values']['chado_table'])) {
     if (!preg_match('/^' . current($tables) . '$/', $form_state['values']['chado_table'])) {
       $table = $form_state['values']['chado_table'];
@@ -1550,7 +1550,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
 
   // Chado fields
   $chado_fields = array();
-  $table_description = tripal_core_get_chado_table_schema($table);
+  $table_description = chado_get_schema($table);
   foreach ($table_description['fields'] as $field_name => $field_array) {
     $chado_fields[$field_name] = $field_name;
   }
@@ -1670,7 +1670,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
         }
       }
       // now add in the remaining fields of the referring record's table.
-      $fk_description = tripal_core_get_chado_table_schema($fk_table);
+      $fk_description = chado_get_schema($fk_table);
       foreach ($fk_description['fields'] as $fk_field_name => $fk_farray) {
         // don't include the FK field it's included above
         if (in_array('Foreign Key', $ref_chado_fields)) {
@@ -2216,7 +2216,7 @@ function tripal_bulk_loader_template_field_form_submit($form, &$form_state) {
     }
     else {
       drupal_set_message(t('Unable to Save Template!'), 'error');
-      tripal_core_report_error('T_bulk_loader',
+      tripal_report_error('T_bulk_loader',
         TRIPAL_ERROR,
         'Unable to save bulk loader template: %template',
         array('%template' => print_r($form_state['storage']['template'], TRUE))

+ 17 - 17
tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc

@@ -86,7 +86,7 @@ function tripal_bulk_loader_add_loader_job_form_submit($form, $form_state) {
     }
   }
   elseif (preg_match('/Re-Submit Job/', $form_state['values']['op'])) {
-    tripal_jobs_rerun($form_state['values']['job_id']);
+    tripal_rerun_job($form_state['values']['job_id']);
     $success = db_update('tripal_bulk_loader')->fields(array(
         'job_status' => 'Submitted to Queue'
       ))->condition('nid',$form_state['values']['nid'])->execute();
@@ -95,7 +95,7 @@ function tripal_bulk_loader_add_loader_job_form_submit($form, $form_state) {
     $success = db_update('tripal_bulk_loader')->fields(array(
         'job_status' => 'Job Cancelled'
       ))->condition('nid',$form_state['values']['nid'])->execute();
-    tripal_jobs_cancel($form_state['values']['job_id']);
+    tripal_cancel_job($form_state['values']['job_id']);
   }
   elseif (preg_match('/Revert/', $form_state['values']['op'])) {
 
@@ -230,7 +230,7 @@ function tripal_bulk_loader_load_data($nid, $job_id) {
         // out what field we're joining on.  For templates created using a
         // previous version it was assumed that the FK field was always the field to join
         if (!array_key_exists('foreign field', $field_array)) {
-          $tbl_description = tripal_core_get_chado_table_schema($record_array['table']);
+          $tbl_description = chado_get_schema($record_array['table']);
           foreach ($tbl_description['foreign keys'] as $key_table => $key_array) {
             if ($key_table == $fk_table) {
               foreach ($key_array['columns'] as $left_field => $right_field) {
@@ -392,7 +392,7 @@ function tripal_bulk_loader_load_data($nid, $job_id) {
         // and had a group percentage of 50% then the job progress would be
         // (2*100 + 50%) / 3 = 250%/3 = 83%
         $job_progress = round(((($group_index - 1) * 100) + $group_progress) / $total_num_groups);
-        tripal_job_set_progress($node->job_id, $job_progress);
+        tripal_set_job_progress($node->job_id, $job_progress);
       }
 
       $data = $default_data;
@@ -503,7 +503,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
   }
 
   // get the table description
-  $table_desc = tripal_core_get_chado_table_schema($table);
+  $table_desc = chado_get_schema($table);
   if (!$table_desc) {
     $msg = "Tripal does not know about the table named '%table'. If this is a custom table,
       please define it first";
@@ -610,7 +610,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
      $table_data['select_if_duplicate'] == 1 or
      $table_data['update_if_duplicate'] == 1) {
     $options = array('is_duplicate' => TRUE, 'print_errors' => TRUE);
-    $duplicate = tripal_core_chado_select($table, array_keys($table_desc['fields']), $values, $options);
+    $duplicate = chado_select_record($table, array_keys($table_desc['fields']), $values, $options);
 
     // if this is a duplicate then substitute the values in the table_data array so
     // that for future records that may depend on this one, they can get the values needed
@@ -662,7 +662,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     else {
       $options = array();
     }
-    // Skip tripal_core_chado_insert() built-in validation?
+    // Skip chado_insert_record() built-in validation?
     if (variable_get('tripal_bulk_loader_skip_validation', FALSE)) {
       $options['skip_validation'] = TRUE;
     }
@@ -697,17 +697,17 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
       }
       if (!empty($match)) {
         // Now we need to check if it already exists via a select
-        $results = tripal_core_chado_select($table, array_keys($table_desc['fields']), $match, array('print_errors' => TRUE));
+        $results = chado_select_record($table, array_keys($table_desc['fields']), $match, array('print_errors' => TRUE));
         // If not then insert
         if (empty($results)) {
           $options['statement_name'] = 'ins_'.$options['statement_name'];
           $options['print_errors'] = TRUE;
-          $record = tripal_core_chado_insert($table, $values, $options);
+          $record = chado_insert_record($table, $values, $options);
         }
         else {
           $options['return_record'] = TRUE;
           $options['print_errors'] = TRUE;
-          $record = tripal_core_chado_update($table, $match, $values, $options);
+          $record = chado_update_record($table, $match, $values, $options);
         }
       }
       else {
@@ -722,7 +722,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     }
     else {
       $options['print_errors'] = TRUE;
-      $record = tripal_core_chado_insert($table, $values, $options);
+      $record = chado_insert_record($table, $values, $options);
     }
 
     // if the insert was not successful
@@ -790,7 +790,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     // get the matches for this select
     $matches = array();
     if (is_array($values) and count($values) > 0) {
-      $matches = tripal_core_chado_select($table, array_keys($table_desc['fields']), $values, array('print_errors' => TRUE));
+      $matches = chado_select_record($table, array_keys($table_desc['fields']), $values, array('print_errors' => TRUE));
     }
     // if the record doesn't exist and it's not optional then generate an error
     if (count($matches) == 0) {
@@ -913,7 +913,7 @@ function tripal_bulk_loader_add_foreignkey_to_values($table_array, $values, $dat
 
       // if the field in the Referral records is in a FK relationship with
       // this field then we can simply keep the value we have
-      $tbl_description = tripal_core_get_chado_table_schema($table_array['table']);
+      $tbl_description = chado_get_schema($table_array['table']);
       if ($tbl_description and
           array_key_exists('foreign keys', $tbl_description) and
           array_key_exists($foreign_table, $tbl_description['foreign keys']) and
@@ -928,7 +928,7 @@ function tripal_bulk_loader_add_foreignkey_to_values($table_array, $values, $dat
       else {
         // if the current value of the referral records is a non-array then this
         // is the primary key, we can use it to select the value we need.
-        $fk_description = tripal_core_get_chado_table_schema($foreign_table);
+        $fk_description = chado_get_schema($foreign_table);
         if (!is_array($foreign_values)) {
           // if we have a value then use it to get the field we need
           if ($foreign_values) {
@@ -936,7 +936,7 @@ function tripal_bulk_loader_add_foreignkey_to_values($table_array, $values, $dat
             $columns = array($foreign_field);
             $options = array('statement_name' => 'pk_' . $foreign_table);
             $options['print_errors'] = TRUE;
-            $record  = tripal_core_chado_select($foreign_table, $columns, $fvalues, $options);
+            $record  = chado_select_record($foreign_table, $columns, $fvalues, $options);
             if ($record) {
               $values[$field] = $record[0]->$foreign_field;
             }
@@ -957,7 +957,7 @@ function tripal_bulk_loader_add_foreignkey_to_values($table_array, $values, $dat
           $columns = array($foreign_field);
           $options = array('statement_name' => 'blk_' . $nid . $priority . $foreign_table);
           $options['print_errors'] = TRUE;
-          $record  = tripal_core_chado_select($foreign_table, $columns, $fvalues, $options);
+          $record  = chado_select_record($foreign_table, $columns, $fvalues, $options);
           if ($record) {
             $values[$field] = $record[0]->$foreign_field;
           }
@@ -1174,7 +1174,7 @@ function tripal_bulk_loader_throw_error($msg, $args, $severity) {
     unset($options['print']);
   }
 
-  tripal_core_report_error(
+  tripal_report_error(
     'tripal_bulk',
     $severity,
     $msg,

+ 2 - 2
tripal_bulk_loader/tripal_bulk_loader.drush.inc

@@ -130,7 +130,7 @@ function drush_tripal_bulk_loader_tripal_loader_view ($nid) {
 function drush_tripal_bulk_loader_tripal_loader_cancel ($nid) {
   $node = node_load($nid);
   db_query("UPDATE {tripal_bulk_loader} SET job_status='%s' WHERE nid=%d", 'Job Cancelled', $node->nid);
-  tripal_jobs_cancel($node->job_id,FALSE);
+  tripal_cancel_job($node->job_id,FALSE);
 }
 
 /**
@@ -146,7 +146,7 @@ function drush_tripal_bulk_loader_tripal_loader_submit ($nid) {
 
   if ($node->job_id) {
     //Re-submit Tripal Job
-    tripal_jobs_rerun($node->job_id);
+    tripal_rerun_job($node->job_id);
     db_query("UPDATE {tripal_bulk_loader} SET job_status='%s' WHERE nid=%d", 'Submitted to Queue', $nid);
   }
   else {

+ 1 - 1
tripal_bulk_loader/tripal_bulk_loader.module

@@ -405,7 +405,7 @@ function tripal_bulk_loader_progess_file_get_progress($job_id, $update_progress
 
       // update the progress of the job
       if ($update_progress AND ($percent != 0 OR $percent != 100)) {
-        tripal_job_set_progress($job_id, round($total_percent, 0));
+        tripal_set_job_progress($job_id, round($total_percent, 0));
       }
     }
   }

+ 9 - 9
tripal_contact/api/tripal_contact.api.inc

@@ -21,7 +21,7 @@
  * @ingroup tripal_contact_api
  */
 function tripal_contact_get_property($contact_id, $property) {
-  return tripal_core_get_property('contact', $contact_id, $property, 'tripal_contact');
+  return chado_get_property('contact', $contact_id, $property, 'tripal_contact');
 }
 
 /**
@@ -42,7 +42,7 @@ function tripal_contact_get_property($contact_id, $property) {
  * @ingroup tripal_contact_api
  */
 function tripal_contact_insert_property($contact_id, $property, $value, $update_if_present = 0) {
-  return tripal_core_insert_property('contact', $contact_id, $property, 'tripal_contact', $value, $update_if_present);
+  return chado_insert_property('contact', $contact_id, $property, 'tripal_contact', $value, $update_if_present);
 }
 
 /**
@@ -66,7 +66,7 @@ function tripal_contact_insert_property($contact_id, $property, $value, $update_
  * @ingroup tripal_contact_api
  */
 function tripal_contact_update_property($contact_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('contact', $contact_id, $property, 'tripal_contact', $value, $insert_if_missing);
+  return chado_update_property('contact', $contact_id, $property, 'tripal_contact', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -85,7 +85,7 @@ function tripal_contact_update_property($contact_id, $property, $value, $insert_
  * @ingroup tripal_contact_api
  */
 function tripal_contact_delete_property($contact_id, $property) {
-  return tripal_core_delete_property('contact', $contact_id, $property, 'tripal_contact');
+  return chado_delete_property('contact', $contact_id, $property, 'tripal_contact');
 }
 
 /**
@@ -115,12 +115,12 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
   // check to see if this contact name already exists.
   $values =  array('name' => $name);
   $options = array('statement_name' => 'sel_contact_na');
-  $contact = tripal_core_chado_select('contact', array('contact_id'), $values, $options);
+  $contact = chado_select_record('contact', array('contact_id'), $values, $options);
 
   if (count($contact) == 0) {
     $cvterm = tripal_cv_get_cvterm_by_name($type, NULL, 'tripal_contact');
     if (!$cvterm) {
-      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, "Cannot find contact type '%type'",
+      tripal_report_error('tripal_contact', TRIPAL_ERROR, "Cannot find contact type '%type'",
         array('%type' => $type));
       return FALSE;
     }
@@ -130,9 +130,9 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
       'type_id' => $cvterm->cvterm_id,
     );
     $options = array('statement_name' => 'ins_contact_nadety');
-    $contact = tripal_core_chado_insert('contact', $values, $options);
+    $contact = chado_insert_record('contact', $values, $options);
     if (!$contact) {
-      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 'Could not add the contact', array());
+      tripal_report_error('tripal_contact', TRIPAL_ERROR, 'Could not add the contact', array());
       return FALSE;
     }
   }
@@ -150,7 +150,7 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
   foreach ($properties as $key => $value) {
     $success = tripal_contact_insert_property($contact['contact_id'], $key,$value, TRUE);
     if (!$success) {
-      tripal_core_report_error('tripal_contact', TRIPAL_ERROR,
+      tripal_report_error('tripal_contact', TRIPAL_ERROR,
         "Could not add the contact property '%prop'", array('%prop' => $key));
       return FALSE;
     }

+ 24 - 24
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -195,17 +195,17 @@ function chado_contact_form(&$node, $form_state) {
     'cv_name' => 'tripal_contact',
     'select_options' => $select_options
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
   // We want to use the contact_relationship_types cv if there are any terms available
   // and if not, to default to the relationship ontology
-  $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'contact_relationship_types'));
+  $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'contact_relationship_types'));
   $cv_id = $cv_result[0]->cv_id;
   $select_options = tripal_cv_get_cvterm_options($cv_id);
   if (empty($select_options)) {
-    $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'relationship'));
+    $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'relationship'));
     $cv_id = $cv_result[0]->cv_id;
     $select_options = tripal_cv_get_cvterm_options($cv_id);
   }
@@ -222,7 +222,7 @@ function chado_contact_form(&$node, $form_state) {
     'select_options' => $select_options
   );
   // Adds the form elements to your current form
-  chado_node_relationships_form($form, $form_state, $details);
+  chado_add_node_form_relationships($form, $form_state, $details);
 
   return $form;
 }
@@ -252,13 +252,13 @@ function chado_contact_validate($node, $form, &$form_state) {
   if (property_exists($node, 'nid')) {
     // get the existing node
     $values = array('contact_id' => $node->contact_id);
-    $result = tripal_core_chado_select('contact', array('*'), $values);
+    $result = chado_select_record('contact', array('*'), $values);
     $contact = $result[0];
 
     // if the name has changed make sure it doesn't conflict with an existing name
     if ($contact->name != $node->contactname) {
       $values = array('name' => $node->contactname);
-      $result = tripal_core_chado_select('contact', array('contact_id'), $values);
+      $result = chado_select_record('contact', array('contact_id'), $values);
       if ($result and count($result) > 0) {
         form_set_error('contactname', 'Cannot update the contact with this contact name. A contact with this name already exists.');
         return;
@@ -271,7 +271,7 @@ function chado_contact_validate($node, $form, &$form_state) {
     $values = array(
       'name' => $node->contactname,
     );
-    $contact = tripal_core_chado_select('contact', array('contact_id'), $values);
+    $contact = chado_select_record('contact', array('contact_id'), $values);
     if ($contact and count($contact) > 0) {
       form_set_error('contactname', 'Cannot add the contact with this name. A contact with these values already exists.');
       return;
@@ -356,10 +356,10 @@ function chado_contact_insert($node) {
       'description'    => '',
       'type_id'        => $node->type_id,
     );
-    $contact = tripal_core_chado_insert('contact', $values);
+    $contact = chado_insert_record('contact', $values);
     if (!$contact) {
       drupal_set_message(t('Unable to add contact.', 'warning'));
-      tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 
+      tripal_report_error('tripal_contact', TRIPAL_ERROR, 
         'Insert contact: Unable to create contact where values: %values',
         array('%values' => print_r($values, TRUE)));
       return;
@@ -367,7 +367,7 @@ function chado_contact_insert($node) {
     $contact_id = $contact['contact_id'];
 
       // Add the description property
-    $properties = chado_node_properties_form_retreive($node);
+    $properties = chado_retrieve_node_form_properties($node);
     $contact_descrip_id = tripal_cv_get_cvterm_by_name('contact_description', NULL, 'tripal_contact');
     $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
@@ -378,14 +378,14 @@ function chado_contact_insert($node) {
       'foreignkey_name' => 'contact_id',
       'foreignkey_value' => $contact_id
     );
-    chado_node_properties_form_update_properties($node, $details, $properties);
+    chado_update_node_form_properties($node, $details, $properties);
 
     // * Relationships Form *
     $details = array(
       'relationship_table' => 'contact_relationship',  // name of the _relationship table
       'foreignkey_value' => $contact_id                // value of the contact_id key
     );
-    chado_node_relationships_form_update_relationships($node, $details);
+    chado_update_node_form_relationships($node, $details);
   }
   else {
     $contact_id = $node->contact_id;
@@ -393,7 +393,7 @@ function chado_contact_insert($node) {
 
   // Make sure the entry for this contact doesn't already exist in the
   // chado_contact table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('contact', $node->nid);
+  $check_org_id = chado_get_id_from_nid('contact', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -422,7 +422,7 @@ function chado_contact_update($node) {
   $node->contactname          = trim($node->contactname);
   $node->description    = trim($node->description);
 
-  $contact_id = chado_get_id_for_node('contact', $node->nid) ;
+  $contact_id = chado_get_id_from_nid('contact', $node->nid) ;
 
   // update the contact record
   $match = array(
@@ -433,16 +433,16 @@ function chado_contact_update($node) {
     'description' => '',
     'type_id' => $node->type_id
   );
-  $status = tripal_core_chado_update('contact', $match, $values);
+  $status = chado_update_record('contact', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating contact", "error");
-    tripal_core_report_error('tripal_contact', TRIPAL_ERROR, 
+    tripal_report_error('tripal_contact', TRIPAL_ERROR, 
       "Error updating contact", array());
     return;
   }
 
   // Add the description property
-  $properties = chado_node_properties_form_retreive($node);
+  $properties = chado_retrieve_node_form_properties($node);
   $contact_descrip_id = tripal_cv_get_cvterm_by_name('contact_description', NULL, 'tripal_contact');
   $properties[$contact_descrip_id->cvterm_id][0] = $node->description;
 
@@ -454,14 +454,14 @@ function chado_contact_update($node) {
     'foreignkey_name' => 'contact_id',
     'foreignkey_value' => $contact_id
   );
-  chado_node_properties_form_update_properties($node, $details, $properties);
+  chado_update_node_form_properties($node, $details, $properties);
 
   // * Relationships Form *
   $details = array(
     'relationship_table' => 'contact_relationship',  // name of the _relationship table
     'foreignkey_value' => $contact_id                // value of the contact_id key
   );
-  chado_node_relationships_form_update_relationships($node, $details);
+  chado_update_node_form_relationships($node, $details);
 }
 
 
@@ -480,11 +480,11 @@ function chado_contact_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // find the contact and add in the details
-    $contact_id = chado_get_id_for_node('contact', $nid);
+    $contact_id = chado_get_id_from_nid('contact', $nid);
 
     // get the contact
     $values = array('contact_id' => $contact_id);
-    $contact = tripal_core_generate_chado_var('contact', $values);
+    $contact = chado_generate_var('contact', $values);
 
     // get the contact description from the contactprop table and replace
     // the contact.description field with this one (we don't use the contact.description
@@ -499,9 +499,9 @@ function chado_contact_load($nodes) {
       'return_array' => 1,
       'include_fk' => array('type_id' => 1),
     );
-    $description = tripal_core_generate_chado_var('contactprop', $values, $options);
+    $description = chado_generate_var('contactprop', $values, $options);
     if (count($description) == 1) {
-      $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');
+      $description = chado_expand_var($description, 'field', 'contactprop.value');
       $contact->description = $description[0]->value;
     }
 
@@ -522,7 +522,7 @@ function chado_contact_load($nodes) {
  */
 function chado_contact_delete(&$node) {
 
-  $contact_id = chado_get_id_for_node('contact', $node->nid);
+  $contact_id = chado_get_id_from_nid('contact', $node->nid);
 
   // if we don't have a contact id for this node then this isn't a node of
   // type chado_contact or the entry in the chado_contact table was lost.

+ 1 - 1
tripal_contact/theme/tripal_contact.theme.inc

@@ -22,7 +22,7 @@ function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
       ),
     ),
   );
-  $contact = tripal_core_expand_chado_vars($contact, 'table', 'contact_relationship', $options);
+  $contact = chado_expand_var($contact, 'table', 'contact_relationship', $options);
 
   // get the subject relationships
   $srelationships = $contact->contact_relationship->subject_id;

+ 2 - 2
tripal_contact/tripal_contact.install

@@ -49,7 +49,7 @@ function tripal_contact_requirements($phase) {
 function tripal_contact_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_contact');
+  tripal_create_files_dir('tripal_contact');
 
   // add the contactprop table to Chado
   tripal_contact_add_custom_tables();
@@ -201,7 +201,7 @@ function tripal_contact_add_custom_tables(){
       ),
     ),
   );
-  tripal_core_create_custom_table('contactprop', $schema, TRUE);
+  chado_create_custom_table('contactprop', $schema, TRUE);
 }
 
 /**

+ 15 - 14
tripal_core/api/tripal_core.files.api.inc

@@ -12,9 +12,8 @@
 /**
  * This function is typically used in the '.install' file for a Tripal module
  * Each module should call this function during installation to create
- * the module data directory which is sites/default/files/tripal/[module_name]
- * for default Drupal settings.  This directory can then be used by the module
- * for storing files.
+ * the module data directory which is sites/default/files/tripal/[module_name].
+ * This directory can then be used by the module for storing files.
  *
  * @param $module_name
  *   the name of the module being installed
@@ -36,21 +35,23 @@ function tripal_create_files_dir($module_name, $path = FALSE) {
       tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
     }
   }
-
-  // make sure the module data directory exists
-  tripal_create_files_dir($module_name);
-
-  // now make sure the sub dir exists
-  $sub_dir = tripal_get_files_dir() . $module_name . $path;
-  if (!file_prepare_directory($sub_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
-    $message = "Cannot create directory $sub_dir. ";
-    drupal_set_message(check_plain(t($message)), 'error');
-    tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
+  else {
+    // make sure the module data directory exists, we make a recursive call
+    // but without the path
+    tripal_create_files_dir($module_name);
+  
+    // now make sure the sub dir exists
+    $sub_dir = tripal_get_files_dir() . $module_name . $path;
+    if (!file_prepare_directory($sub_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
+      $message = "Cannot create directory $sub_dir. ";
+      drupal_set_message(check_plain(t($message)), 'error');
+      tripal_report_error('tripal_core', TRIPAL_ERROR, $message, array());
+    }
   }
 }
 
 /**
- * Each Tripal module has a unique data directory which was creatd using the
+ * Each Tripal module has a unique data directory which was created using the
  * tripal_create_files_dir function during installation.  This function
  * retrieves the directory path.
  *

+ 50 - 50
tripal_cv/api/tripal_cv.api.inc

@@ -54,18 +54,18 @@ function tripal_cv_get_cv($select_values) {
     'name',
     'definition',
   );
-  $results = tripal_core_chado_select('cv', $columns, $select_values);
+  $results = chado_select_record('cv', $columns, $select_values);
   if (sizeof($results) == 1) {
     return $results[0];
   }
   elseif (empty($results)) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING,
+    tripal_report_error('tripal_cv', TRIPAL_WARNING,
       'tripal_cv_get_cv: No cv matches criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
     return FALSE;
   }
   else {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING,
+    tripal_report_error('tripal_cv', TRIPAL_WARNING,
       'tripal_cv_get_cv: 2+ cvs match criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
   }
@@ -103,7 +103,7 @@ function tripal_cv_get_cv($select_values) {
  */
 function tripal_cv_get_cv_by_name($name) {
 
-  $r = tripal_core_chado_select('cv', array('*'), array('name' => $name));
+  $r = chado_select_record('cv', array('*'), array('name' => $name));
 
   return $r[0];
 }
@@ -124,7 +124,7 @@ function tripal_cv_get_cv_by_name($name) {
  */
 function tripal_cv_get_cv_by_id($cv_id) {
 
-  $r = tripal_core_chado_select('cv', array('*'), array('cv_id' => $cv_id));
+  $r = chado_select_record('cv', array('*'), array('cv_id' => $cv_id));
 
   return $r;
 }
@@ -163,7 +163,7 @@ function tripal_cv_get_cv_id($cv_name) {
  */
 function tripal_cv_get_cv_options() {
 
-  $results = tripal_core_chado_select('cv', array('cv_id', 'name'), array());
+  $results = chado_select_record('cv', array('cv_id', 'name'), array());
 
   $options = array();
   foreach ($results as $r) {
@@ -190,7 +190,7 @@ function tripal_cv_get_cvterm_by_id($cvterm_id) {
   }
   $values = array('cvterm_id' => $cvterm_id);
   $options = array('statement_name' => 'sel_cvterm_id');
-  $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+  $r = chado_select_record('cvterm', array('*'), $values, $options);
   if (!$r) {
     return FALSE;
   }
@@ -221,7 +221,7 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
     $options = array(
       'case_insensitive_columns' => array('name')
     );
-    $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+    $r = chado_select_record('cvterm', array('*'), $values, $options);
   }
   elseif ($cv_name) {
     $values = array(
@@ -231,19 +231,19 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
       ),
     );
     $options = array('case_insensitive_columns' => array('name'));
-    $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+    $r = chado_select_record('cvterm', array('*'), $values, $options);
   }
   else {
     $values = array('name' => $name);
     $options = array('case_insensitive_columns' => array('name'));
-    $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+    $r = chado_select_record('cvterm', array('*'), $values, $options);
   }
 
   if (!$r) {
     return FALSE;
   }
   if (count($r) > 1) {
-    tripal_core_report_error('tripal_cv', TRIPAL_ERROR, 
+    tripal_report_error('tripal_cv', TRIPAL_ERROR, 
       "Cannot find a unique term for the term '%name' in the vocabulary '%cv'. Multiple entries exist for this name",
       array('%name' => $name, '%cv' => $cv_name ? $cv_name : $cv_id));
     return FALSE;
@@ -288,7 +288,7 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
     'statement_name' => $statement,
     'case_insensitive_columns' => array('name')
   );
-  $synonym = tripal_core_chado_select('cvtermsynonym', array('cvterm_id'), $values, $options);
+  $synonym = chado_select_record('cvtermsynonym', array('cvterm_id'), $values, $options);
 
   // if the synonym doens't exist or more than one record is returned then return false
   if (count($synonym) == 0) {
@@ -301,7 +301,7 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
   // get the cvterm
   $values = array('cvterm_id' => $synonym[0]->cvterm_id);
   $options = array('statement_name' => 'sel_cvterm_id');
-  $cvterm = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+  $cvterm = chado_select_record('cvterm', array('*'), $values, $options);
   return $cvterm[0];
 }
 /**
@@ -320,10 +320,10 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
 function tripal_cv_get_cvterm_options($cv_id = 0) {
 
   if ($cv_id > 0) {
-    $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
+    $results = chado_select_record('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
   }
   else {
-    $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array());
+    $results = chado_select_record('cvterm', array('cvterm_id', 'name'), array());
   }
 
   $options = array();
@@ -358,16 +358,16 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
 
   print "\nUpdating cvtermpath for $cv->name...\n";
 
-  $previous = tripal_db_set_active('chado');
+  $previous = chado_set_active('chado');
   try {
     $sql = "SELECT * FROM fill_cvtermpath(:name)";
     db_query($sql, array(':name' => $cv->name));
-    tripal_db_set_active($previous);
+    chado_set_active($previous);
   }
   catch (Exception $e) {
-    tripal_db_set_active($previous);
+    chado_set_active($previous);
     $error = $e->getMessage();
-    tripal_core_report_error('tripal_cv', TRIPAL_ERROR, "Could not fill cvtermpath table: @error", array('@error' => $error));
+    tripal_report_error('tripal_cv', TRIPAL_ERROR, "Could not fill cvtermpath table: @error", array('@error' => $error));
     return FALSE;
   }
 
@@ -399,27 +399,27 @@ function tripal_cv_add_cv($name, $definition) {
   // see if the CV (default-namespace) exists already in the database
   $sel_values = array('name' => $name);
   $sel_options = array('statement_name' => 'sel_cv_na');
-  $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
+  $results = chado_select_record('cv', array('*'), $sel_values, $sel_options);
 
   // if it does not exists then add it
   if (count($results) == 0) {
     $ins_options = array('statement_name' => 'ins_cv_nade');
-    $success = tripal_core_chado_insert('cv', $ins_values, $ins_options);
+    $success = chado_insert_record('cv', $ins_values, $ins_options);
     if (!$success) {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to create the CV record", NULL);
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to create the CV record", NULL);
       return FALSE;
     }
-    $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
+    $results = chado_select_record('cv', array('*'), $sel_values, $sel_options);
   }
   // if it already exists then do an update
   else {
     $upd_options = array('statement_name' => 'upd_cv_nade');
-    $success = tripal_core_chado_update('cv', $sel_values, $ins_values, $upd_options);
+    $success = chado_update_record('cv', $sel_values, $ins_values, $upd_options);
     if (!$success) {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the CV record", NULL);
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the CV record", NULL);
       return FALSE;
     }
-    $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
+    $results = chado_select_record('cv', array('*'), $sel_values, $sel_options);
   }
 
   // return the cv object
@@ -505,7 +505,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     }
   }
   if (!$name and !$id) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find cvterm without 'id' or 'name'", NULL);
+    tripal_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find cvterm without 'id' or 'name'", NULL);
     return 0;
   }
   if (!$id) {
@@ -524,11 +524,11 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
 
   // check that we have a database name, give a different message if it's a relationship
   if ($is_relationship and !$dbname) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "A database name is not provided for this relationship term: $id", NULL);
+    tripal_report_error('tripal_cv', TRIPAL_WARNING, "A database name is not provided for this relationship term: $id", NULL);
     return 0;
   }
   if (!$is_relationship and !$dbname) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "A database identifier is missing from the term: $id", NULL);
+    tripal_report_error('tripal_cv', TRIPAL_WARNING, "A database identifier is missing from the term: $id", NULL);
     return 0;
   }
 
@@ -538,7 +538,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $cv = tripal_cv_add_cv($cvname, '');
   }
   if (!$cv) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find namespace '$cvname' when adding/updating $id", NULL);
+    tripal_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find namespace '$cvname' when adding/updating $id", NULL);
     return 0;
   }
 
@@ -563,7 +563,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $db = tripal_db_add_db($dbname);
   }
   if (!$db) {
-    tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find database '$dbname' in Chado.", NULL);
+    tripal_report_error('tripal_cv', TRIPAL_WARNING, "Cannot find database '$dbname' in Chado.", NULL);
     return 0;
   }
 
@@ -577,7 +577,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     ),
   );
   $options = array('statement_name' => 'sel_cvterm_c1');
-  $result = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+  $result = chado_select_record('cvterm', array('*'), $values, $options);
 
   // if the constraint is met then let's check it to see if
   // the database name matches the one we have been provided
@@ -587,13 +587,13 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // get the dbxref record
     $values = array('dbxref_id' => $cvterm->dbxref_id);
     $options = array('statement_name' => 'sel_dbxref_id');
-    $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
+    $result = chado_select_record('dbxref', array('*'), $values, $options);
     $dbxref = $result[0];
 
     // get the db
     $values = array('db_id' => $dbxref->db_id);
     $options = array('statement_name' => 'sel_db_id');
-    $result = tripal_core_chado_select('db', array('*'), $values, $options);
+    $result = chado_select_record('db', array('*'), $values, $options);
     $db_check = $result[0];
 
     // the database name for this existing term does not match that of the
@@ -608,7 +608,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         'accession' => $accession,
       );
       $options = array('statement_name' => 'sel_dbxref_idac');
-      $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
+      $result = chado_select_record('dbxref', array('*'), $values, $options);
 
       // if we already have a good dbxref then we want to update our cvterm
       // to use this dbxref
@@ -617,9 +617,9 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         $match = array('cvterm_id' => $cvterm->cvterm_id);
         $values = array('dbxref_id' => $dbxref->dbxref_id);
         $options = array('statement_name' => 'upd_cvterm_db');
-        $success = tripal_core_chado_update('cvterm', $match, $values, $options);
+        $success = chado_update_record('cvterm', $match, $values, $options);
         if (!$success) {
-          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to correct the dbxref id for the cvterm " .
+          tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to correct the dbxref id for the cvterm " .
             "'$name' (id: $accession), for database $dbname", NULL);
           return 0;
         }
@@ -629,7 +629,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       else {
         $match = array('cvterm_id' => $cvterm->cvterm_id);
         $options = array('statement_name' => 'del_cvterm_cv');
-        tripal_core_chado_delete('cvterm', $match, $options);
+        chado_delete_record('cvterm', $match, $options);
       }
     }
 
@@ -642,7 +642,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       // get/add the dbxref fort his term
       $dbxref_new =  tripal_db_add_dbxref($db->db_id, $accession);
       if (!$dbxref_new) {
-        tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
+        tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
           "$name (id: $accession), for database $dbname", NULL);
         return 0;
       }
@@ -654,7 +654,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         'is_for_definition' => 1,
       );
       $options = array('statement_name' => 'sel_cvtermdbxref_cvdbis');
-      $result = tripal_core_chado_select('cvterm_dbxref', array('*'), $values, $options);
+      $result = chado_select_record('cvterm_dbxref', array('*'), $values, $options);
 
       // if the cvterm_dbxref record does not exists then add it
       if (count($result)==0) {
@@ -662,9 +662,9 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
           'statement_name' => 'ins_cvtermdbxref_cvdbis',
           'return_record' => FALSE,
         );
-        $success = tripal_core_chado_insert('cvterm_dbxref', $values, $options);
+        $success = chado_insert_record('cvterm_dbxref', $values, $options);
         if (!$success) {
-          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the cvterm_dbxref record for a " .
+          tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the cvterm_dbxref record for a " .
             "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL);
           return 0;
         }
@@ -687,7 +687,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // check to see if the dbxref exists if not, add it
     $dbxref =  tripal_db_add_dbxref($db->db_id, $accession);
     if (!$dbxref) {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to find or insert the dbxref record for cvterm, " .
         "$name (id: $accession), for database $dbname", NULL);
       return 0;
     }
@@ -696,7 +696,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // this is the second constraint in the cvterm table
     $values = array('dbxref_id' => $dbxref->dbxref_id);
     $options = array('statement_name' => 'sel_cvterm_db');
-    $check = tripal_core_chado_select('cvterm', array('cvterm_id'), $values, $options);
+    $check = chado_select_record('cvterm', array('cvterm_id'), $values, $options);
     if (count($check) == 0) {
       // now add the cvterm
       $ins_values = array(
@@ -708,21 +708,21 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         'is_relationshiptype'  => $is_relationship,
       );
       $ins_options = array('statement_name' => 'ins_cvterm_all');
-      $success = tripal_core_chado_insert('cvterm', $ins_values, $ins_options);
+      $success = chado_insert_record('cvterm', $ins_values, $ins_options);
       if (!$success) {
         if (!$is_relationship) {
-          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the term: $name ($dbname)", NULL);
+          tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the term: $name ($dbname)", NULL);
           return 0;
         }
         else {
-          tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the relationship term: $name (cv: " . $cvname . " db: $dbname)", NULL);
+          tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the relationship term: $name (cv: " . $cvname . " db: $dbname)", NULL);
           return 0;
         }
       }
     }
     // this dbxref already exists in the cvterm table
     else {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "The dbxref already exists for another cvterm record: $name (cv: " . $cvname . " db: $dbname)", NULL);
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "The dbxref already exists for another cvterm record: $name (cv: " . $cvname . " db: $dbname)", NULL);
       return 0;
     }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));
@@ -738,9 +738,9 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       'is_relationshiptype' => $is_relationship,
     );
     $upd_options = array('statement_name' => 'upd_cvterm_nadeisis');
-    $success = tripal_core_chado_update('cvterm', $match, $upd_values, $upd_options);
+    $success = chado_update_record('cvterm', $match, $upd_values, $upd_options);
     if (!$success) {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the term: $name", NULL);
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to update the term: $name", NULL);
       return 0;
     }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));

+ 3 - 3
tripal_cv/api/tripal_cv.schema.api.inc

@@ -3,9 +3,9 @@
 /**
  * Implements hook_chado_schema_v1_2_tripal_obo_temp()
  * Purpose: To describe the structure of 'tripal_obo_temp' to tripal
- * @see tripal_core_chado_insert()
- * @see tripal_core_chado_update()
- * @see tripal_core_chado_select()
+ * @see chado_insert_record()
+ * @see chado_update_record()
+ * @see chado_select_record()
  *
  * @return
  *    An array describing the 'tripal_obo_temp' table

+ 5 - 5
tripal_cv/includes/cv_form.inc

@@ -102,7 +102,7 @@ function tripal_cv_add_cv_form_fields(&$form, $form_state, $cv_id = NULL) {
 
   if ($cv_id) {
     $values = array('cv_id' => $cv_id);
-    $result = tripal_core_chado_select('cv', array('*'), $values);
+    $result = chado_select_record('cv', array('*'), $values);
     $cv = $result[0];
     $default_name = $cv->name;
     $default_desc = $cv->definition;
@@ -169,7 +169,7 @@ function tripal_cv_form_fields_validate($form, &$form_state) {
 
   // make sure the cv name is unique
   $values = array('name' => $name);
-  $results = tripal_core_chado_select('cv', array('cv_id'), $values);
+  $results = chado_select_record('cv', array('cv_id'), $values);
   if (count($results) > 0 and $results[0]->cv_id != $cv_id) {
     form_set_error('name', 'The vocabulary name must be unique');
   }
@@ -188,7 +188,7 @@ function tripal_cv_cv_add_form_submit($form, &$form_state) {
     'name' => $name,
     'definition' => $desc,
   );
-  $success = tripal_core_chado_insert('cv', $values);
+  $success = chado_insert_record('cv', $values);
   if ($success) {
     drupal_set_message(t("Controlled vocabulary added"));
   }
@@ -213,7 +213,7 @@ function tripal_cv_cv_edit_form_submit($form, &$form_state) {
   );
   if (strcmp($op, 'Update')==0) {
     $match = array('cv_id' => $cv_id);
-    $success = tripal_core_chado_update('cv', $match, $values);
+    $success = chado_update_record('cv', $match, $values);
     if ($success) {
       drupal_set_message(t("Controlled vocabulary updated"));
     }
@@ -223,7 +223,7 @@ function tripal_cv_cv_edit_form_submit($form, &$form_state) {
   }
   if (strcmp($op, 'Delete')==0) {
     $match = array('cv_id' => $cv_id);
-    $success = tripal_core_chado_delete('cv', $match);
+    $success = chado_delete_record('cv', $match);
     if ($success) {
       drupal_set_message(t("Controlled vocabulary deleted"));
     }

+ 13 - 13
tripal_cv/includes/cvterm_form.inc

@@ -181,7 +181,7 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
   // get default values
   if ($cvterm_name) {
     $values = array('cv_id' => $cv_id, 'name' => $cvterm_name);
-    $cvterm = tripal_core_generate_chado_var('cvterm', $values);
+    $cvterm = chado_generate_var('cvterm', $values);
     $name = $cvterm->name;
     $definition = $cvterm->definition;
     $is_relationship = $cvterm->is_relationshiptype;
@@ -227,7 +227,7 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
   $values = array();
   $columns = array('db_id', 'name');
   $options = array('order_by' => array('name' => 'ASC'));
-  $results = tripal_core_chado_select('db', $columns, $values, $options);
+  $results = chado_select_record('db', $columns, $values, $options);
   $dbs = array();
   $dbs[] = '';
   foreach ($results as $db) {
@@ -274,7 +274,7 @@ function tripal_cv_cvterm_edit_form_validate($form, &$form_state) {
   // make sure the cv term name is unique for this vocabulary
   if ($step == 1) {
     $values = array('name' => $name, 'cv_id' => $cv_id);
-    $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+    $results = chado_select_record('cvterm', array('cvterm_id'), $values);
     foreach ($results as $r) {
       if ($r->cvterm_id != $cvterm_id) {
         form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
@@ -294,28 +294,28 @@ function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
 
   $values = array('cv_id' => $cv_id);
-  $results = tripal_core_chado_select('cv', array('name'), $values);
+  $results = chado_select_record('cv', array('name'), $values);
   if (!$results or count($results) == 0) {
     form_set_error('cv_id', 'The controlled vocabulary does not exist');
   }
 
   // make sure the DB exists
   $values = array('db_id' => $db_id);
-  $results = tripal_core_chado_select('db', array('name'), $values);
+  $results = chado_select_record('db', array('name'), $values);
   if (!$results or count($results) == 0) {
     form_set_error('db_id', 'The database name does not exist');
   }
 
   // make sure the cv term name is unique for this vocabulary
   $values = array('name' => $name, 'cv_id' => $cv_id);
-  $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+  $results = chado_select_record('cvterm', array('cvterm_id'), $values);
   if (count($results) > 0) {
     form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
   }
 
   // make sure this accession is unique for the database
   $values = array('accession' => $accession, 'db_id' => $db_id);
-  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values);
+  $results = chado_select_record('dbxref', array('dbxref_id'), $values);
   if (count($results) > 0 ) {
     form_set_error('accession', 'The accession is not uniuqe for this vocabulary\'s database.');
   }
@@ -352,7 +352,7 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
 
       // get the original cvterm_id
       $values = array('name' => $name, 'cv_id' => $cv_id);
-      $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+      $results = chado_select_record('cvterm', array('cvterm_id'), $values);
       $cvterm = $results[0];
 
       $form_state['storage']['cv_id'] = $cv_id;
@@ -367,12 +367,12 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
       if ($op == 'Update') {
         // get the cv
         $values = array('cv_id' => $cv_id);
-        $results = tripal_core_chado_select('cv', array('name'), $values);
+        $results = chado_select_record('cv', array('name'), $values);
         $cv = $results[0];
 
         // get the db
         $values = array('db_id' => $db_id);
-        $results = tripal_core_chado_select('db', array('name'), $values);
+        $results = chado_select_record('db', array('name'), $values);
         $db = $results[0];
 
         // now add the term
@@ -394,7 +394,7 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
       }
       if ($op == 'Delete') {
         $values = array('cvterm_id' => $cvterm_id);
-        $success = tripal_core_chado_delete('cvterm', $values);
+        $success = chado_delete_record('cvterm', $values);
         if ($success) {
           drupal_set_message('Term deleted successfully.');
         }
@@ -423,12 +423,12 @@ function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
 
   // get the database
   $values = array('db_id' => $db_id);
-  $results = tripal_core_chado_select('db', array('name'), $values);
+  $results = chado_select_record('db', array('name'), $values);
   $db = $results[0];
 
   // get the cv
   $values = array('cv_id' => $cv_id);
-  $results = tripal_core_chado_select('cv', array('name'), $values);
+  $results = chado_select_record('cv', array('name'), $values);
   $cv = $results[0];
 
   // now add the term

+ 26 - 26
tripal_cv/includes/obo_loader.inc

@@ -280,7 +280,7 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
  */
 function tripal_cv_obo_quiterror($message) {
 
-  tripal_core_report_error("T_obo_loader", TRIPAL_ERROR, $message, array());
+  tripal_report_error("T_obo_loader", TRIPAL_ERROR, $message, array());
   exit;
 
 }
@@ -312,7 +312,7 @@ function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
     // update the job status every interval
     if ($jobid and $i % $interval == 0) {
       $complete = ($i / $count) * 33.33333333;
-      tripal_job_set_progress($jobid, intval($complete + 33.33333333));
+      tripal_set_job_progress($jobid, intval($complete + 33.33333333));
       printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
     }
 
@@ -328,7 +328,7 @@ function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
     else {
       $complete = 33.33333333;
     }
-    tripal_job_set_progress($jobid, intval($complete + 33.33333333));
+    tripal_set_job_progress($jobid, intval($complete + 33.33333333));
     printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
   }
   return 1;
@@ -368,7 +368,7 @@ function tripal_cv_obo_process_terms($defaultcv, $jobid = NULL, &$newcvs, $defau
     // update the job status every interval
     if ($jobid and $i % $interval == 0) {
       $complete = ($i / $count) * 33.33333333;
-      tripal_job_set_progress($jobid, intval($complete + 66.666666));
+      tripal_set_job_progress($jobid, intval($complete + 66.666666));
       printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
     }
 
@@ -388,7 +388,7 @@ function tripal_cv_obo_process_terms($defaultcv, $jobid = NULL, &$newcvs, $defau
     else {
       $complete = 33.33333333;
     }
-    tripal_job_set_progress($jobid, intval($complete + 66.666666));
+    tripal_set_job_progress($jobid, intval($complete + 66.666666));
     printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
   }
 
@@ -621,13 +621,13 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
     'object_id'  => $objcvterm->cvterm_id
   );
   $options = array('statement_name' => 'sel_cvtermrelationship_tysuob');
-  $result = tripal_core_chado_select('cvterm_relationship', array('*'), $values, $options);
+  $result = chado_select_record('cvterm_relationship', array('*'), $values, $options);
   if (count($result) == 0) {
     $options = array(
       'statement_name' => 'ins_cvtermrelationship_tysuob',
       'return_record' => FALSE
     );
-    $success = tripal_core_chado_insert('cvterm_relationship', $values, $options);
+    $success = chado_insert_record('cvterm_relationship', $values, $options);
     if (!$success) {
       tripal_cv_obo_quiterror("Cannot add term relationship: '$cvterm->name' $rel '$objcvterm->name'");
     }
@@ -643,7 +643,7 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
 function tripal_cv_obo_get_term($id) {
   $values = array('id' => $id);
   $options = array('statement_name' => 'sel_tripalobotemp_id');
-  $result = tripal_core_chado_select('tripal_obo_temp', array('stanza'), $values, $options);
+  $result = chado_select_record('tripal_obo_temp', array('stanza'), $values, $options);
   if (count($result) == 0) {
     return FALSE;
   }
@@ -679,7 +679,7 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
         ),
       );
       $options = array('statement_name' => 'sel_cvterm_nacv', 'is_updlicate' => 1);
-      $results = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+      $results = chado_select_record('cvterm', array('*'), $values, $options);
 
       // if it doesn't exist then add it
       if (!$results) {
@@ -705,7 +705,7 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
         'synonym' => $def
       );
       $options = array('statement_name' => 'sel_cvtermsynonym_cvsy');
-      $results = tripal_core_chado_select('cvtermsynonym', array('*'), $values, $options);
+      $results = chado_select_record('cvtermsynonym', array('*'), $values, $options);
       if (count($results) == 0) {
         $values = array(
           'cvterm_id' => $cvterm->cvterm_id,
@@ -716,7 +716,7 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
           'statement_name' => 'ins_cvtermsynonym_cvsy',
           'return_record' => FALSE
         );
-        $success = tripal_core_chado_insert('cvtermsynonym', $values, $options);
+        $success = chado_insert_record('cvtermsynonym', $values, $options);
         if (!$success) {
           tripal_cv_obo_quiterror("Failed to insert the synonym for term: $name ($def)");
         }
@@ -775,7 +775,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
     if ($jobid and $intv_read >= $interval) {
       $percent = sprintf("%.2f", ($num_read / $filesize) * 100);
       print "Parsing Line $line_num (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
-      tripal_job_set_progress($jobid, intval(($num_read / $filesize) * 33.33333333));
+      tripal_set_job_progress($jobid, intval(($num_read / $filesize) * 33.33333333));
       $intv_read = 0;
     }
 
@@ -806,9 +806,9 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
           'type' => $type,
         );
         $options = array('statement_name' => 'ins_tripalobotemp_all');
-        $success = tripal_core_chado_insert('tripal_obo_temp', $values, $options);
+        $success = chado_insert_record('tripal_obo_temp', $values, $options);
         if (!$success) {
-          tripal_core_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
+          tripal_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
           exit;
         }
 
@@ -855,14 +855,14 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
       'type' => $type,
     );
     $options = array('statement_name' => 'ins_tripalobotemp_all');
-    tripal_core_chado_insert('tripal_obo_temp', $values, $options);
+    chado_insert_record('tripal_obo_temp', $values, $options);
     if (!$success) {
-      tripal_core_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
+      tripal_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
       exit;
     }
     $percent = sprintf("%.2f", ($num_read / $filesize) * 100);
     print "Parsing Line $line_num (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
-    tripal_job_set_progress($jobid, intval(($num_read / $filesize) * 33.33333333));
+    tripal_set_job_progress($jobid, intval(($num_read / $filesize) * 33.33333333));
   }
   return $default_db;
 }
@@ -881,7 +881,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
 
   if (!$accession) {
     tripal_cv_obo_quiterror();
-    tripal_core_report_error("T_obo_loader", TRIPAL_WARNING, "Cannot add a dbxref without an accession: '$xref'", NULL);
+    tripal_report_error("T_obo_loader", TRIPAL_WARNING, "Cannot add a dbxref without an accession: '$xref'", NULL);
     return FALSE;
   }
 
@@ -909,13 +909,13 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
     'dbxref_id' => $dbxref->dbxref_id,
   );
   $options = array('statement_name' => 'sel_cvtermdbxref_cvdb');
-  $result = tripal_core_chado_select('cvterm_dbxref', array('*'), $values, $options);
+  $result = chado_select_record('cvterm_dbxref', array('*'), $values, $options);
   if (count($result) == 0) {
     $ins_options = array(
       'statement_name' => 'ins_cvtermdbxref_cvdb',
       'return_record' => FALSE
     );
-    $result = tripal_core_chado_insert('cvterm_dbxref', $values, $ins_options);
+    $result = chado_insert_record('cvterm_dbxref', $values, $ins_options);
     if (!$result) {
       tripal_cv_obo_quiterror("Cannot add cvterm_dbxref: $xref");
       return FALSE;
@@ -943,7 +943,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
     'cv_id' => $cv->cv_id,
   );
   $options = array('statement_name' => 'sel_cvterm_nacv_na');
-  $results = tripal_core_chado_select('cvterm', array('*'), $values, $options);
+  $results = chado_select_record('cvterm', array('*'), $values, $options);
   if (count($results) == 0) {
     $term = array(
       'name' => $property,
@@ -965,7 +965,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
   if ($rank == 0) {
     $values = array('cvterm_id' => $cvterm->cvterm_id);
     $options = array('statement_name' => 'del_cvtermprop_cv');
-    $success = tripal_core_chado_delete('cvtermprop', $values, $options);
+    $success = chado_delete_record('cvtermprop', $values, $options);
     if (!$success) {
        tripal_cv_obo_quiterror("Could not remove existing properties to update property $property for term\n");
        return FALSE;
@@ -983,7 +983,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
     'statement_name' => 'ins_cvtermprop_cvtyvara',
     'return_record' => FALSE,
   );
-  $result = tripal_core_chado_insert('cvtermprop', $values, $options);
+  $result = chado_insert_record('cvtermprop', $values, $options);
   if (!$result) {
     tripal_cv_obo_quiterror("Could not add property $property for term\n");
     return FALSE;
@@ -1004,7 +1004,7 @@ function tripal_cv_obo_add_dbxref($db_id, $accession, $version='', $description=
     'accession' => $accession,
   );
   $options = array('statement_name' => 'sel_dbxref_idac');
-  $result = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $options);
+  $result = chado_select_record('dbxref', array('dbxref_id'), $values, $options);
   if (count($result) == 0) {
     $ins_values = array(
       'db_id'       => $db_id,
@@ -1016,12 +1016,12 @@ function tripal_cv_obo_add_dbxref($db_id, $accession, $version='', $description=
       'statement_name' => 'ins_dbxref_idacvede',
       'return_record' => FALSE
     );
-    $result = tripal_core_chado_insert('dbxref', $ins_values, $ins_options);
+    $result = chado_insert_record('dbxref', $ins_values, $ins_options);
     if (!$result) {
       tripal_cv_obo_quiterror("Failed to insert the dbxref record $accession");
       return FALSE;
     }
-    $result = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $options);
+    $result = chado_select_record('dbxref', array('dbxref_id'), $values, $options);
   }
   return $result[0];
 }

+ 0 - 0
tripal_cv/theme/tripal_cv_admin.tpl.php → tripal_cv/theme/tripal_cv_help.tpl.php


+ 1 - 1
tripal_cv/tripal_cv.install

@@ -44,7 +44,7 @@ function tripal_cv_requirements($phase) {
 function tripal_cv_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_cv');
+  tripal_create_files_dir('tripal_cv');
 
   // add the cv_root_mview
   tripal_cv_add_cv_root_mview();

+ 8 - 8
tripal_cv/tripal_cv.module

@@ -308,14 +308,14 @@ function tripal_cv_form_alter(&$form, &$form_state, $form_id) {
  *
  * @ingroup tripal_db
  */
-function tripal_cv_theme() {
-  $theme_path = drupal_get_path('module', 'tripal_cv') . '/theme';
-  $items = array(
-    'tripal_cv_admin' => array(
-      'template' => 'tripal_cv_admin',
-      'arguments' =>  array(NULL),
-      'path' => $theme_path,
-    ),
+function tripal_cv_theme($existing, $type, $theme, $path) {
+ 
+ $items = array(
+    'tripal_cv_help' => array(
+      'template' => 'tripal_cv_help',
+      'variables' =>  array(NULL),
+      'path' => "$path/theme/"
+    )
   );
 
   return $items;

+ 22 - 22
tripal_db/api/tripal_db.api.inc

@@ -51,18 +51,18 @@ function tripal_db_get_db($select_values) {
     'urlprefix',
     'url'
   );
-  $results = tripal_core_chado_select('db', $columns, $select_values);
+  $results = chado_select_record('db', $columns, $select_values);
   if (sizeof($results) == 1) {
     return $results[0];
   }
   elseif (empty($results)) {
-    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
+    tripal_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_db: No db matches criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
     return FALSE;
   }
   else {
-    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
+    tripal_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_db: 2+ dbs match criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
   }
@@ -100,7 +100,7 @@ function tripal_db_get_db_by_name($name) {
   $values = array('name' => $name);
   $options = array('statement_name' => 'sel_db_na');
 
-  $db = tripal_core_chado_select('db', array('*'), $values, $options);
+  $db = chado_select_record('db', array('*'), $values, $options);
   if (count($db) == 1) {
     return $db[0];
   }
@@ -209,7 +209,7 @@ function tripal_db_get_dbxref($select_values) {
     'description',
     'version'
   );
-  $results = tripal_core_chado_select('dbxref', $columns, $select_values);
+  $results = chado_select_record('dbxref', $columns, $select_values);
   if (sizeof($results) == 1) {
     $dbxref = tripal_db_add_db_to_object(array('db_id' => $results[0]->db_id), $results[0], array());
     unset($dbxref->db_id);
@@ -217,13 +217,13 @@ function tripal_db_get_dbxref($select_values) {
     return $dbxref;
   }
   elseif (empty($results)) {
-    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
+    tripal_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_dbxref: No dbxref matches criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
     return FALSE;
   }
   else {
-    tripal_core_report_error('tripal_db', TRIPAL_WARNING,
+    tripal_report_error('tripal_db', TRIPAL_WARNING,
       'tripal_db_get_dbxref: 2+ dbxrefs match criteria values:%values',
       array('%values' => print_r($select_values, TRUE)));
   }
@@ -294,27 +294,27 @@ function tripal_db_add_db($dbname, $description = '', $url = '',
   // get the database record if it already exists
   $sel_values = array('name' => $dbname);
   $sel_options = array('statement_name' => 'sel_db_na');
-  $result = tripal_core_chado_select('db', array('*'), $sel_values, $sel_options);
+  $result = chado_select_record('db', array('*'), $sel_values, $sel_options);
 
   // if it does not exists then add it
   if (count($result) == 0) {
     $ins_options = array('statement_name' => 'ins_db_nadeurur');
-    $success = tripal_core_chado_insert('db', $ins_values, $ins_options);
+    $success = chado_insert_record('db', $ins_values, $ins_options);
     if (!$success) {
-      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Cannot create db '$dbname'.", NULL);
+      tripal_report_error('tripal_db', TRIPAL_WARNING, "Cannot create db '$dbname'.", NULL);
       return 0;
     }
-    $result = tripal_core_chado_select('db', array('*'), $sel_values, $sel_options);
+    $result = chado_select_record('db', array('*'), $sel_values, $sel_options);
   }
   // if it exists and update is enabled the do the update
   elseif ($update) {
     $upd_options = array('statement_name' => 'upd_db_nadeurur');
-    $success = tripal_core_chado_update('db', $sel_values, $ins_values, $upd_options);
+    $success = chado_update_record('db', $sel_values, $ins_values, $upd_options);
     if (!$success) {
-      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Cannot update db '$dbname'.", NULL);
+      tripal_report_error('tripal_db', TRIPAL_WARNING, "Cannot update db '$dbname'.", NULL);
       return 0;
     }
-    $result = tripal_core_chado_select('db', array('*'), $sel_values, $sel_options);
+    $result = chado_select_record('db', array('*'), $sel_values, $sel_options);
   }
 
   // return the database object
@@ -340,16 +340,16 @@ function tripal_db_add_dbxref($db_id, $accession, $version = '', $description =
     'accession' => $accession,
     'version' => $version
   );
-  $result = tripal_core_chado_select('dbxref', array('*'), $sel_values);
+  $result = chado_select_record('dbxref', array('*'), $sel_values);
 
   // if it doesn't already exist then add it
   if (!$result) {
-    $success = tripal_core_chado_insert('dbxref', $ins_values);
+    $success = chado_insert_record('dbxref', $ins_values);
     if (!$success) {
-      tripal_core_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the dbxref record $accession", NULL);
+      tripal_report_error('tripal_cv', TRIPAL_WARNING, "Failed to insert the dbxref record $accession", NULL);
       return 0;
     }
-    $result = tripal_core_chado_select('dbxref', array('*'), $sel_values);
+    $result = chado_select_record('dbxref', array('*'), $sel_values);
   }
 
   if (isset($result[0])) {
@@ -370,16 +370,16 @@ function tripal_db_add_dbxref_link($linking_table, $dbxref_id, $foreignkey_name,
     $foreignkey_name => $foreignkey_id
   );
 
-  $result = tripal_core_chado_select($linking_table, array('*'), $values);
+  $result = chado_select_record($linking_table, array('*'), $values);
 
   // if it doesn't already exist then add it
   if (!$result) {
-    $success = tripal_core_chado_insert($linking_table, $values);
+    $success = chado_insert_record($linking_table, $values);
     if (!$success) {
-      tripal_core_report_error('tripal_db', TRIPAL_WARNING, "Failed to insert the $linking_table record $accession", NULL);
+      tripal_report_error('tripal_db', TRIPAL_WARNING, "Failed to insert the $linking_table record $accession", NULL);
       return 0;
     }
-    $result = tripal_core_chado_select($linking_table, array('*'), $values);
+    $result = chado_select_record($linking_table, array('*'), $values);
   }
 
   if (isset($result[0])) {

+ 5 - 5
tripal_db/includes/tripal_db.admin.inc

@@ -145,7 +145,7 @@ function tripal_db_add_db_form_fields(&$form, $form_state, $dbid = NULL) {
   // get the default values from the database first
   if ($dbid) {
     $values = array('db_id' => $dbid);
-    $result = tripal_core_chado_select('db', array('*'), $values);
+    $result = chado_select_record('db', array('*'), $values);
     $db = $result[0];
     $default_db = $db->name;
     $default_desc = $db->description;
@@ -229,7 +229,7 @@ function tripal_db_form_fields_validate($form, &$form_state) {
 
   // make sure the database name is unique
   $values = array('name' => $name);
-  $results = tripal_core_chado_select('db', array('db_id'), $values);
+  $results = chado_select_record('db', array('db_id'), $values);
   if (count($results) > 0 and $results[0]->db_id != $dbid) {
     form_set_error('name', 'The database name must be unique');
   }
@@ -254,7 +254,7 @@ function tripal_db_db_add_form_submit($form, &$form_state) {
     'url' => $url,
     'urlprefix' => $urlp,
   );
-  $success = tripal_core_chado_insert('db', $values);
+  $success = chado_insert_record('db', $values);
   if ($success) {
     drupal_set_message(t("External database added"));
   }
@@ -288,7 +288,7 @@ function tripal_db_db_edit_form_submit($form, &$form_state) {
 
   if (strcmp($op, 'Update')==0) {
     $match = array('db_id' => $dbid);
-    $success = tripal_core_chado_update('db', $match, $values);
+    $success = chado_update_record('db', $match, $values);
     if ($success) {
       drupal_set_message(t("External database updated"));
     }
@@ -298,7 +298,7 @@ function tripal_db_db_edit_form_submit($form, &$form_state) {
   }
   if (strcmp($op, 'Delete')==0) {
     $match = array('db_id' => $dbid);
-    $success = tripal_core_chado_delete('db', $match);
+    $success = chado_delete_record('db', $match);
     if ($success) {
       drupal_set_message(t("External database deleted"));
     }

+ 0 - 0
tripal_db/theme/tripal_db_admin.tpl.php → tripal_db/theme/tripal_db_help.tpl.php


+ 0 - 1
tripal_db/tripal_db.info

@@ -7,4 +7,3 @@ version = 7.x-2.0a
 configure = admin/tripal/chado/tripal_db
 
 dependencies[] = tripal_core
-dependencies[] = tripal_views

+ 1 - 1
tripal_db/tripal_db.install

@@ -45,7 +45,7 @@ function tripal_db_requirements($phase) {
 function tripal_db_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_db');
+  tripal_create_files_dir('tripal_db');
 
 }
 

+ 8 - 8
tripal_db/tripal_db.module

@@ -132,14 +132,14 @@ function tripal_db_views_api() {
  *
  * @ingroup tripal_db
  */
-function tripal_db_theme() {
-  $theme_path = drupal_get_path('module', 'tripal_db') . '/theme';
-  $items = array(
-    'tripal_db_admin' => array(
-      'template' => 'tripal_db_admin',
-      'arguments' =>  array(NULL),
-      'path' => $theme_path,
-    ),
+function tripal_db_theme($existing, $type, $theme, $path) {
+ 
+ $items = array(
+    'tripal_db_help' => array(
+      'template' => 'tripal_db_help',
+      'variables' =>  array(NULL),
+      'path' => "$path/theme/"
+    )
   );
   return $items;
 }

+ 22 - 22
tripal_example/includes/tripal_example.chado_node.inc

@@ -114,7 +114,7 @@ function chado_example_form($node, &$form_state) {
   // if we are editing an existing node then the example is already part of the node
   if (property_exists($node, 'example')) {
     // $example = $node->example;
-    // $example = tripal_core_expand_chado_vars($example, 'field', 'example.residues');
+    // $example = chado_expand_var($example, 'field', 'example.residues');
     // $example_id   = $example->example_id;
     // $uniquename   = $example->uniquename;
 
@@ -150,7 +150,7 @@ function chado_example_form($node, &$form_state) {
     'cv_name' => 'example_property_types'   // the cv.name of the cv governing exampleprop.type_id
   );
   // Adds the form elements to your current form
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -162,7 +162,7 @@ function chado_example_form($node, &$form_state) {
     'base_key_value' => $example_id       // the value of example_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
@@ -177,7 +177,7 @@ function chado_example_form($node, &$form_state) {
     'cv_name' => 'example_relationship_types'         // the cv.name of the cv governing example_relationship.type_id
   );
   // Adds the form elements to your current form
-  chado_node_relationships_form($form, $form_state, $details);
+  chado_add_node_form_relationships($form, $form_state, $details);
 
   // return the form
   return $form;
@@ -258,10 +258,10 @@ function chado_example_insert($node) {
     //  'uniquename' => $node->uniquename,
     //  'residues' => $residues,
     //);
-    //$example = tripal_core_chado_select('example', array('*'), $values);
+    //$example = chado_select_record('example', array('*'), $values);
     //if (!$example) {
     //  drupal_set_message(t('Unable to add example.'), 'warning');
-    //  tripal_core_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
+    //  tripal_report_error('tripal_example', TRIPAL_WARNING, 'Insert example: Unable to create example where values: %values',
     //    array('%values' => print_r($values, TRUE)));
     //  return;
     //}
@@ -281,7 +281,7 @@ function chado_example_insert($node) {
       //   'foreignkey_name' => 'example_id',   // the name of the key in your base table
       //   'foreignkey_value' => $example_id    // the value of the example_id key
       // );
-      // chado_node_properties_form_update_properties($node, $details);
+      // chado_update_node_form_properties($node, $details);
 
       // * Additional DBxrefs Form *
       // If you implemented the dbxrefs form in chado_example_form then you need to
@@ -291,7 +291,7 @@ function chado_example_insert($node) {
       //   'foreignkey_name' => 'example_id',     // the name of the key in your base table
       //   'foreignkey_value' => $example_id      // the value of the example_id key
       // );
-      // chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+      // chado_update_node_form_dbxrefs($node, $details);
 
       // * Relationships Form *
       // If you implemented the relationships form in chado_example_form then you need to
@@ -300,7 +300,7 @@ function chado_example_insert($node) {
       //   'relationship_table' => 'example_relationship',  // name of the _relationship table
       //   'foreignkey_value' => $example_id                // value of the example_id key
       // );
-      // chado_node_relationships_form_update_relationships($node, $details);
+      // chado_update_node_form_relationships($node, $details);
     }
   }
   else {
@@ -310,7 +310,7 @@ function chado_example_insert($node) {
 
   // Make sure the entry for this example doesn't already exist in the
   // chado_example table if it doesn't exist then we want to add it.
-  // $check_org_id = chado_get_id_for_node('example', $node->nid);
+  // $check_org_id = chado_get_id_from_nid('example', $node->nid);
   //if (!$check_org_id) {
   //  $record = new stdClass();
   //  $record->nid = $node->nid;
@@ -334,7 +334,7 @@ function chado_example_update($node) {
   // be sure to always trim text fields
   // $node->uniquename   = trim($node->uniquename);
 
-  // use the tripal_core_chado_update() function to update the record
+  // use the chado_update_record() function to update the record
   //$match = array(
   //'example_id' => $example_id,
   //);
@@ -342,11 +342,11 @@ function chado_example_update($node) {
   //  'uniquename' => $node->uniquename,
   //);
   //$options = array('return_record' => TRUE);
-  //$status = tripal_core_chado_update('example', $match, $values, $options);
+  //$status = chado_update_record('example', $match, $values, $options);
 
   //if (!$status) {
   //  drupal_set_message(t('Unable to update example.'), 'warning');
-  //  tripal_core_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
+  //  tripal_report_error('tripal_example', TRIPAL_WARNING, 'Update example: Unable to update example where values: %values',
   //    array('%values' => print_r($values, TRUE)));
   //}
 
@@ -359,7 +359,7 @@ function chado_example_update($node) {
   //   'foreignkey_name' => 'example_id',   // the name of the key in your base table
   //   'foreignkey_value' => $example_id    // the value of the example_id key
   // );
-  // chado_node_properties_form_update_properties($node, $details);
+  // chado_update_node_form_properties($node, $details);
 
   // * Additional DBxrefs Form *
   // If you implemented the dbxrefs form in chado_example_form then you need to
@@ -369,7 +369,7 @@ function chado_example_update($node) {
   //   'foreignkey_name' => 'example_id',     // the name of the key in your base table
   //   'foreignkey_value' => $example_id      // the value of the example_id key
   // );
-  // chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+  // chado_update_node_form_dbxrefs($node, $details);
 
   // * Relationships Form *
   // If you implemented the relationships form in chado_example_form then you need to
@@ -378,7 +378,7 @@ function chado_example_update($node) {
   //   'relationship_table' => 'example_relationship',  // name of the _relationship table
   //   'foreignkey_value' => $example_id                // value of the example_id key
   // );
-  // chado_node_relationships_form_update_relationships($node, $details);
+  // chado_update_node_form_relationships($node, $details);
 
 }
 /**
@@ -394,7 +394,7 @@ function chado_example_update($node) {
 function chado_example_delete($node) {
 
   // get the example id from the node
-  //$example_id  = chado_get_id_for_node('example', $node->nid);
+  //$example_id  = chado_get_id_from_nid('example', $node->nid);
 
   // if we don't have a example id for this node then this isn't a node of
   // type chado_example or the entry in the chado_example table was lost.
@@ -435,21 +435,21 @@ function chado_example_load($nodes) {
   // them all
   foreach ($nodes as $nid => $node) {
     // find the example and add in the details
-    //$example_id = chado_get_id_for_node('example', $nid);
+    //$example_id = chado_get_id_from_nid('example', $nid);
 
-    // build the example variable by using the tripal_core_generate_chado_var() function
+    // build the example variable by using the chado_generate_var() function
     //$values = array('example_id' => $example_id);
-    //$example = tripal_core_generate_chado_var('example', $values);
+    //$example = chado_generate_var('example', $values);
 
     // for fields in the table that are of type 'text' you may want to include those
     // by default, the tripal_core_generate_chado_var does not include text fields as
     // they may be very large and including a large text field can slow the page load.
     // If you know a text field will never be large and it is important for the
     // other functions that will see the node to have access to a field you can
-    // include it here using the tripal_core_expand_chado_vars() function.  In most
+    // include it here using the chado_expand_var() function.  In most
     // cases it is probably best to let the end-user decide if text fields should
     // be included by using this function in the templates.
-    //$example = tripal_core_expand_chado_vars($example, 'field', 'example.residues');
+    //$example = chado_expand_var($example, 'field', 'example.residues');
 
     // add the new example object to this node.
     //$nodes[$nid]->example = $example;

+ 38 - 38
tripal_feature/api/tripal_feature.api.inc

@@ -39,7 +39,7 @@ function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id =
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+      tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_get_property: Both an analysis ID and feature ID should be specified',
       array());
   }
@@ -48,12 +48,12 @@ function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id =
   if (!$analysisfeature_id) {
     $columns = array('analysisfeature_id');
     $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
-    $result = tripal_core_chado_select('analysisfeature', $columns, $values);
+    $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
   // get the property.
-  return tripal_core_get_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
+  return chado_get_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
 }
 
 /**
@@ -92,7 +92,7 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
       (!$analysis_id and $feature_id)) {
-    tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+    tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified',
       array());
   }
@@ -101,15 +101,15 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
   if (!$analysisfeature_id) {
     $columns = array('analysisfeature_id');
     $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
-    $result = tripal_core_chado_select('analysisfeature', $columns, $values);
+    $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
   // insert the property.
-  $success = tripal_core_insert_property('analysisfeature', $analysisfeature_id,
+  $success = chado_insert_property('analysisfeature', $analysisfeature_id,
     $property, $cv_name, $value, $update_if_present);
   if (!$success) {
-     tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+     tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_insert_property: Failed to insert analysis feature property',
        array());
      return FALSE;
@@ -160,7 +160,7 @@ function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+      tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_update_property: Both an analysis ID and feature ID should be specified',
       array());
   }
@@ -169,12 +169,12 @@ function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_i
   if (!$analysisfeature_id) {
     $columns = array('analysisfeature_id');
     $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
-    $result = tripal_core_chado_select('analysisfeature', $columns, $values);
+    $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
   // update the property.
-  return tripal_core_update_property('analysisfeature', $analysisfeature_id, $property, $cv_name, $value, $insert_if_missing);
+  return chado_update_property('analysisfeature', $analysisfeature_id, $property, $cv_name, $value, $insert_if_missing);
 }
 
 /**
@@ -199,7 +199,7 @@ function tripal_feature_analysis_update_property_by_id($analysisfeatureprop_id,
   $property, $value, $cv_name = 'tripal') {
 
     // update the property.
-    return tripal_core_update_property_by_id('analysisfeature',
+    return chado_update_propertyID('analysisfeature',
       $analysisfeatureprop_id, $property, $cv_name, $value);
 }
 /**
@@ -239,7 +239,7 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
   // check that the incoming arguments are correct
   if (($analysis_id and !$feature_id) or
     (!$analysis_id and $feature_id)) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+      tripal_report_error('tripal_feature', TRIPAL_WARNING,
       'tripal_feature_analysis_delete_property: Both an analysis ID and feature ID should be specified',
         array());
   }
@@ -248,12 +248,12 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
   if (!$analysisfeature_id) {
     $columns = array('analysisfeature_id');
     $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
-    $result = tripal_core_chado_select('analysisfeature', $columns, $values);
+    $result = chado_select_record('analysisfeature', $columns, $values);
     $analysisfeature_id = $result[0]->analysisfeature_id;
   }
 
   // get the property.
-  return tripal_core_delete_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
+  return chado_delete_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
 }
 /**
  * Delete a property using the analysisfeatureprop_id
@@ -268,7 +268,7 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
  */
 function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id) {
   // get the property.
-  return tripal_core_delete_property_by_id('analysisfeature', $analysisfeatureprop_id);
+  return chado_delete_propertyID('analysisfeature', $analysisfeatureprop_id);
 }
 /**
  * Retrieve properties of a given type for a given feature
@@ -287,7 +287,7 @@ function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id)
  * @ingroup tripal_feature_api
  */
 function tripal_feature_get_property($feature_id, $property, $cv_name='tripal') {
-  return tripal_core_get_property('feature', $feature_id, $property, $cv_name);
+  return chado_get_property('feature', $feature_id, $property, $cv_name);
 }
 
 /**
@@ -312,7 +312,7 @@ function tripal_feature_get_property($feature_id, $property, $cv_name='tripal')
  */
 function tripal_feature_insert_property($feature_id, $property, $value,
   $update_if_present = 0, $cv_name = 'tripal') {
-  return tripal_core_insert_property('feature', $feature_id, $property,
+  return chado_insert_property('feature', $feature_id, $property,
     $cv_name, $value, $update_if_present);
 }
 /**
@@ -341,7 +341,7 @@ function tripal_feature_insert_property($feature_id, $property, $value,
  */
 function tripal_feature_update_property($feature_id, $property,
   $value, $insert_if_missing = 0, $cv_name = 'tripal') {
-    return tripal_core_update_property('feature', $feature_id, $property, $cv_name, $value, $insert_if_missing);
+    return chado_update_property('feature', $feature_id, $property, $cv_name, $value, $insert_if_missing);
 }
 
 /**
@@ -364,7 +364,7 @@ function tripal_feature_update_property($feature_id, $property,
  */
 function tripal_feature_update_property_by_id($featureprop_id, $property,
   $value, $cv_name = 'tripal') {
-    return tripal_core_update_property_by_id('feature', $featureprop_id, $property, $cv_name, $value);
+    return chado_update_propertyID('feature', $featureprop_id, $property, $cv_name, $value);
 }
 
 /**
@@ -388,7 +388,7 @@ function tripal_feature_update_property_by_id($featureprop_id, $property,
  * @ingroup tripal_feature_api
  */
 function tripal_feature_delete_property($feature_id, $property, $cv_name='tripal') {
-  return tripal_core_delete_property('feature', $feature_id, $property, $cv_name);
+  return chado_delete_property('feature', $feature_id, $property, $cv_name);
 }
 /**
  * Delete a given feature property using the featureprop_id
@@ -402,7 +402,7 @@ function tripal_feature_delete_property($feature_id, $property, $cv_name='tripal
  * @ingroup tripal_feature_api
  */
 function tripal_feature_delete_property_by_id($featureprop_id) {
-  return tripal_core_delete_property_by_id('feature', $featureprop_id);
+  return chado_delete_propertyID('feature', $featureprop_id);
 }
 
 /**
@@ -512,7 +512,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       ';
       $status = tripal_core_chado_prepare('feature_rel_get_object', $psql, array('int', 'text'));
       if (!$status) {
-        tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
+        tripal_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
           array('%name' => 'feature_by_subject'));
       }
       $sql = "EXECUTE feature_rel_get_object(:feature_id, :relationship)";
@@ -534,7 +534,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       ';
       $status = tripal_core_chado_prepare('feature_rel_get_subject', $psql, array('int', 'text'));
       if (!$status) {
-        tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
+        tripal_report_error('tripal_feature', TRIPAL_ERROR, "init: not able to prepare SQL statement '%name'",
           array('%name' => 'feature_by_object'));
       }
       $sql = "EXECUTE feature_rel_get_subject(:feature_id, :relationship)";
@@ -634,7 +634,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
     ';
     $status = tripal_core_chado_prepare('sequence_by_parent', $psql, array('int', 'int', 'int'));
     if (!$status) {
-      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
+      tripal_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
         array('%name' => 'sequence_by_parent'));
     }
@@ -653,7 +653,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             ORDER BY FL.fmin ASC';
     $status = tripal_core_chado_prepare('sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
+      tripal_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
         array('%name' => 'ssub_features'));
     }
@@ -667,7 +667,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             WHERE FR.object_id = $1 and PF.feature_id = $2';
     $status = tripal_core_chado_prepare('count_sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      tripal_core_report_error('tripal_feature', TRIPAL_ERROR,
+      tripal_report_error('tripal_feature', TRIPAL_ERROR,
         "init: not able to prepare SQL statement '%name'",
         array('%name' => 'count_sub_features'));
     }
@@ -853,12 +853,12 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
   // make sure the db exists. If it doesn't, then add it
   $values = array('name' => $dbname);
   $options = array('statement_name' => 'sel_db_na');
-  $db = tripal_core_chado_select('db', array('db_id'), $values, $options);
+  $db = chado_select_record('db', array('db_id'), $values, $options);
   if (!$db or count($db) == 0) {
     $options = array('statement_name' => 'ins_db_na');
-    $success = tripal_core_chado_insert('db', $values, $options);
+    $success = chado_insert_record('db', $values, $options);
       if (!$success) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " .
+      tripal_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " .
         "could not be added because the database, %dbname, does not exist and cannot be added.',
         array('%feature_id' => $feature_id, '%dbname' => $dbname));
       return FALSE;
@@ -876,13 +876,13 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     'feature_id' => $feature_id,
   );
   $options = array('statement_name' => 'sel_featuredbxref_dbfe');
-  $xref = tripal_core_chado_select('feature_dbxref', array('feature_dbxref_id'), $values, $options);
+  $xref = chado_select_record('feature_dbxref', array('feature_dbxref_id'), $values, $options);
   if (count($xref) == 0) {
     // if the record doesn't exist then add it.
     $options = array('statement_name' => 'ins_featuredbxref_dbfe');
-    $success = tripal_core_chado_insert('feature_dbxref', $values, $options);
+    $success = chado_insert_record('feature_dbxref', $values, $options);
     if (!$success) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' .
+      tripal_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' .
         'could not be added: %db:%accession.', array('%feature_id' => $feature_id, '%db' => $dbname,
         '%accession' => $accession));
       return FALSE;
@@ -911,12 +911,12 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
   // make sure the cv exists. If it doesn't, then add it
   $values = array('name' => $cvname);
   $options = array('statement_name' => 'sel_cv_na');
-  $cv = tripal_core_chado_select('cv', array('cv_id'), $values, $options);
+  $cv = chado_select_record('cv', array('cv_id'), $values, $options);
   if (!$cv or count($cv) == 0) {
     $options = array('statement_name' => 'ins_cv_na');
-    $success = tripal_core_chado_insert('cv', $values, $options);
+    $success = chado_insert_record('cv', $values, $options);
       if (!$success) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " .
+      tripal_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " .
         "could not be added because the CV, %cvname, does not exist and cannot be added.',
         array('%feature_id' => $feature_id, '%cvname' => $cvname));
       return FALSE;
@@ -935,13 +935,13 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     'pub_id' => 1,
   );
   $options = array('statement_name' => 'sel_featuredcvterm_cvfepu');
-  $xref = tripal_core_chado_select('feature_cvterm', array('feature_cvterm_id'), $values, $options);
+  $xref = chado_select_record('feature_cvterm', array('feature_cvterm_id'), $values, $options);
   if (count($xref) == 0) {
     // if the record doesn't exist then add it.
     $options = array('statement_name' => 'ins_featurecvterm_cvfepu');
-    $success = tripal_core_chado_insert('feature_cvterm', $values, $options);
+    $success = chado_insert_record('feature_cvterm', $values, $options);
     if (!$success) {
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' .
+      tripal_report_error('tripal_feature', TRIPAL_WARNING, 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' .
         'could not be added: %cvterm.', array('%feature_id' => $feature_id, '%cvterm' => $cvterm));
       return FALSE;
     }

+ 3 - 3
tripal_feature/api/tripal_feature.schema.api.inc

@@ -3,9 +3,9 @@
 /**
  * Implements hook_chado_schema_v1_2_tripal_gff_temp()
  * Purpose: To describe the structure of 'tripal_gff_temp' to tripal
- * @see tripal_core_chado_insert()
- * @see tripal_core_chado_update()
- * @see tripal_core_chado_select()
+ * @see chado_insert_record()
+ * @see chado_update_record()
+ * @see chado_select_record()
  *
  * @return
  *    An array describing the 'tripal_gff_temp' table

+ 1 - 1
tripal_feature/includes/tripal_feature.admin.inc

@@ -433,7 +433,7 @@ function tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) {
 
   // update the job status every 1% features
   if ($job_id and $i % $interval == 0) {
-    tripal_job_set_progress($job_id, intval(($i/$count)*100));
+    tripal_set_job_progress($job_id, intval(($i/$count)*100));
   }
   print "$i of $count: ";
   $node = db_query($nsql, array(':nid' => $chado_feature->nid))->fetchObject();

+ 32 - 32
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -71,7 +71,7 @@ function chado_feature_form($node, &$form_state) {
   // if we are editing an existing node then the feature is already part of the node
   if (property_exists($node, 'feature')) {
     $feature = $node->feature;
-    $feature = tripal_core_expand_chado_vars($feature, 'field', 'feature.residues');
+    $feature = chado_expand_var($feature, 'field', 'feature.residues');
     $feature_id   = $feature->feature_id;
     $uniquename   = $feature->uniquename;
     $fname        = $feature->name;
@@ -89,7 +89,7 @@ function chado_feature_form($node, &$form_state) {
     // get synonyms from the database if we don't already have them
     if (!$synonyms) {
       $options = array('return_array' => 1);
-      $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_synonym', $options);
+      $feature = chado_expand_var($feature, 'table', 'feature_synonym', $options);
       $feature_synonyms = (isset($feature->feature_synonym)) ? $feature->feature_synonym : array();
       foreach ($feature_synonyms as $index => $synonym) {
         $synonyms .= $synonym->synonym_id->name . "\n";
@@ -142,7 +142,7 @@ function chado_feature_form($node, &$form_state) {
   );
   // get the sequence ontology CV ID
   $values = array('name' => 'sequence');
-  $cv = tripal_core_chado_select('cv', array('cv_id'), $values);
+  $cv = chado_select_record('cv', array('cv_id'), $values);
   $cv_id = $cv[0]->cv_id;
 
   $form['feature_type'] = array(
@@ -220,7 +220,7 @@ function chado_feature_form($node, &$form_state) {
     'cv_name' => 'feature_property'         // the cv.name of the cv governing featureprop.type_id
   );
   // Adds the form elements to your current form
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -230,7 +230,7 @@ function chado_feature_form($node, &$form_state) {
     'base_key_value' => $feature_id       // the value of feature_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   return $form;
 }
@@ -402,7 +402,7 @@ function chado_feature_insert($node) {
     ),
     'name' => $node->feature_type
   );
-  $type = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+  $type = chado_select_record('cvterm', array('cvterm_id'), $values);
 
   $feature_id = '';
 
@@ -420,10 +420,10 @@ function chado_feature_insert($node) {
       'type_id' => $type[0]->cvterm_id,
       'md5checksum' => md5($residues)
     );
-    $feature = tripal_core_chado_insert('feature', $values);
+    $feature = chado_insert_record('feature', $values);
     if (!$feature) {
       drupal_set_message(t('Unable to add feature.'), 'warning');
-      tripal_core_report_error('tripal_feature', TRIPAL_WARNING, 'Insert feature: Unable to create feature where values: %values',
+      tripal_report_error('tripal_feature', TRIPAL_WARNING, 'Insert feature: Unable to create feature where values: %values',
       array('%values' => print_r($values, TRUE)));
       return;
     }
@@ -439,7 +439,7 @@ function chado_feature_insert($node) {
       'foreignkey_name' => 'feature_id',   // the name of the key in your base table
       'foreignkey_value' => $feature_id    // the value of the feature_id key
     );
-    chado_node_properties_form_update_properties($node, $details);
+    chado_update_node_form_properties($node, $details);
 
     // * Additional DBxrefs Form *
     $details = array(
@@ -447,7 +447,7 @@ function chado_feature_insert($node) {
       'foreignkey_name' => 'feature_id',     // the name of the key in your base table
       'foreignkey_value' => $feature_id      // the value of the feature_id key
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
 
   }
   else {
@@ -456,7 +456,7 @@ function chado_feature_insert($node) {
 
   // Make sure the entry for this feature doesn't already exist in the
   // chado_feature table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('feature', $node->nid);
+  $check_org_id = chado_get_id_from_nid('feature', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -492,9 +492,9 @@ function chado_feature_update($node) {
     ),
     'name' => $node->feature_type
   );
-  $type = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+  $type = chado_select_record('cvterm', array('cvterm_id'), $values);
 
-  $feature_id = chado_get_id_for_node('feature', $node->nid) ;
+  $feature_id = chado_get_id_from_nid('feature', $node->nid) ;
 
   if (sizeof($type) > 0) {
     $match = array(
@@ -511,7 +511,7 @@ function chado_feature_update($node) {
       'md5checksum' => md5($residues)
     );
     $options = array('return_record' => TRUE);
-    $status = tripal_core_chado_update('feature', $match, $values, $options);
+    $status = chado_update_record('feature', $match, $values, $options);
 
     // add the genbank synonyms
     chado_feature_add_synonyms($node->synonyms, $feature_id);
@@ -523,7 +523,7 @@ function chado_feature_update($node) {
       'foreignkey_name' => 'feature_id',   // the name of the key in your base table
       'foreignkey_value' => $feature_id    // the value of the feature_id key
     );
-    chado_node_properties_form_update_properties($node, $details);
+    chado_update_node_form_properties($node, $details);
 
     // * Additional DBxrefs Form *
     $details = array(
@@ -531,12 +531,12 @@ function chado_feature_update($node) {
       'foreignkey_name' => 'feature_id',     // the name of the key in your base table
       'foreignkey_value' => $feature_id      // the value of the feature_id key
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
 
   }
   else {
     drupal_set_message(t('Unable to update feature.'), 'warning');
-    tripal_core_report_error('tripal_feature', TRIPAL_WARNING,
+    tripal_report_error('tripal_feature', TRIPAL_WARNING,
      'Update feature: Unable to update feature where values: %values',
      array('%values' => print_r($values, TRUE))
     );
@@ -551,7 +551,7 @@ function chado_feature_update($node) {
  */
 function chado_feature_delete($node) {
 
-  $feature_id  = chado_get_id_for_node('feature', $node->nid);
+  $feature_id  = chado_get_id_from_nid('feature', $node->nid);
 
   // if we don't have a library id for this node then this isn't a node of
   // type chado_library or the entry in the chado_library table was lost.
@@ -595,7 +595,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
   // remove any old synonyms
   $feature_syn_dsql = "DELETE FROM {feature_synonym} WHERE feature_id = :feature_id";
   if (!chado_query($feature_syn_dsql, array(':feature_id' => $feature_id))) {
-    tripal_core_report_error('tripal_feature', TRIPAL_ERROR, "Could not remove synonyms from feature. ", array());
+    tripal_report_error('tripal_feature', TRIPAL_ERROR, "Could not remove synonyms from feature. ", array());
     return;
   }
 
@@ -626,7 +626,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
           )
       ";
       if (!chado_query($synonym_isql, array(':name' => $syn, ':synonym_sgml' => $syn))) {
-        tripal_core_report_error('tripal_feature', "Could not add synonym. ", array(), TRIPAL_WARNING);
+        tripal_report_error('tripal_feature', "Could not add synonym. ", array(), TRIPAL_WARNING);
         return;
       }
       // now get the synonym we just added
@@ -640,7 +640,7 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
       VALUES (:synonym_id, :feature_id, :pub_id)";
     $args = array(':synonym_id' => $synonym->synonym_id, ':feature_id' => $feature_id, ':pub_id'=> 1);
     if (!chado_query($feature_syn_isql, $args)) {
-      tripal_core_report_error('tripal_feature', "Could not associate synonym with feature. ", array(), TRIPAL_WARNING);
+      tripal_report_error('tripal_feature', "Could not associate synonym with feature. ", array(), TRIPAL_WARNING);
       return;
     }
   }
@@ -656,11 +656,11 @@ function chado_feature_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // find the feature and add in the details
-    $feature_id = chado_get_id_for_node('feature', $nid);
+    $feature_id = chado_get_id_from_nid('feature', $nid);
 
     // build the feature variable
     $values = array('feature_id' => $feature_id);
-    $feature = tripal_core_generate_chado_var('feature', $values);
+    $feature = chado_generate_var('feature', $values);
     $nodes[$nid]->feature = $feature;
 
     // by default, the titles are saved using the unique constraint.  We will
@@ -714,12 +714,12 @@ function tripal_feature_node_presave($node) {
         $uname       = $node->feature->uniquename;
         $type_id     = $node->feature->type_id;
         $values = array('cvterm_id' => $type_id);
-        $ftype = tripal_core_chado_select('cv', array('name'), $values);
+        $ftype = chado_select_record('cv', array('name'), $values);
         $type = $ftype[0]->name;
       }
      
       $values = array('organism_id' => $organism_id);
-      $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
+      $organism = chado_select_record('organism', array('genus', 'species'), $values);
       $node->title = "$name, $uname ($type) " . $organism[0]->genus . ' ' . $organism[0]->species;
       
       if ($name == $uname) {
@@ -779,18 +779,18 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
 
   // get the feature
   $values = array('feature_id' => $node->feature_id);
-  $feature = tripal_core_chado_select('feature', array('*'), $values);
+  $feature = chado_select_record('feature', array('*'), $values);
   if (!$feature) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find feature when setting URL alias for feature: %id", array('%id' => $node->feature_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find feature when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $feature = (object) $feature[0];
 
   // get the organism
   $values = array('organism_id' => $feature->organism_id);
-  $organism  = tripal_core_chado_select('organism', array('*'), $values);
+  $organism  = chado_select_record('organism', array('*'), $values);
   if (!$organism) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for feature: %id", array('%id' => $node->feature_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $genus = preg_replace('/\s/', '_', strtolower($organism[0]->genus));
@@ -798,9 +798,9 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
 
   // get the type
   $values = array('cvterm_id' => $feature->type_id);
-  $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
+  $cvterm = chado_select_record('cvterm', array('name'), $values);
   if (!$cvterm) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for feature: %id", array('%id' => $node->feature_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for feature: %id", array('%id' => $node->feature_id));
     return FALSE;
   }
   $type = preg_replace('/\s/', '_', $cvterm[0]->name);
@@ -816,7 +816,7 @@ function tripal_feature_get_feature_url($node, $url_alias = NULL) {
   // the dst field of the url_alias table is only 128 characters long.
   // if this is the case then simply return the node URL, we can't set this one
   if (strlen($url_alias) > 128) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
     return "node/" . $node->nid;
   }
 

+ 4 - 4
tripal_feature/includes/tripal_feature.delete.inc

@@ -132,9 +132,9 @@ function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
     else {
       $match['name'] = $names;
     }
-    $num_deletes = tripal_core_chado_select('feature', array('count(*) as cnt'), $match);
+    $num_deletes = chado_select_record('feature', array('count(*) as cnt'), $match);
     print "Deleting " . $num_deletes[0]->cnt . " features\n";
-    tripal_core_chado_delete('feature', $match);
+    chado_delete_record('feature', $match);
   }
 
   // if the user has provided an analysis_id then handle that separately
@@ -154,9 +154,9 @@ function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
         ),
       );
     }
-    $num_deletes = tripal_core_chado_select('feature', array('count(*) as cnt'), $match);
+    $num_deletes = chado_select_record('feature', array('count(*) as cnt'), $match);
     print "Deleting " . $num_deletes[0]->cnt . " features\n";
-    tripal_core_chado_delete('feature', $match);
+    chado_delete_record('feature', $match);
   }
 
   print "Removing orphaned feature pages\n";

+ 46 - 46
tripal_feature/includes/tripal_feature.fasta_loader.inc

@@ -447,20 +447,20 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
                WHERE cv.name = :cvname and (CVT.name = :name or CVTS.synonym = :synonym)";
   $cvterm = chado_query($cvtermsql, array(':cvname' => 'sequence', ':name' => $type, ':synonym' => $type))->fetchObject();     
   if (!$cvterm) {
-    tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the term type: '%type'", array('%type' => $type));
+    tripal_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the term type: '%type'", array('%type' => $type));
     return 0;
   }
   if ($parent_type) {
     $parentcvterm = chado_query($cvtermsql, array(':cvname' => 'sequence', ':name' => $parent_type, ':synonym' => $parent_type))->fetchObject();
     if (!$parentcvterm) {
-      tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the paretne term type: '%type'", array('%type' => $parentcvterm));
+      tripal_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the paretne term type: '%type'", array('%type' => $parentcvterm));
       return 0;
     }
   }
   if ($rel_type) {
     $relcvterm = chado_query($cvtermsql, array(':cvname' => 'relationship', ':name' => $rel_type, ':synonym' => $rel_type))->fetchObject();
     if (!$relcvterm) {
-      tripal_core_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the relationship term type: '%type'", array('%type' => $relcvterm));
+      tripal_report_error("T_fasta_loader", TRIPAL_ERROR, "Cannot find the relationship term type: '%type'", array('%type' => $relcvterm));
       return 0;
     }
   }
@@ -470,7 +470,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
   //$lines = file($dfile, FILE_SKIP_EMPTY_LINES);
   $fh = fopen($dfile, 'r');
   if (!$fh) {
-    tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "cannot open file: %dfile", array('%dfile' => $dfile));
+    tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "cannot open file: %dfile", array('%dfile' => $dfile));
     return 0;
   }
   $filesize = filesize($dfile);
@@ -487,8 +487,8 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
   
   // we need to get the table schema to make sure we don't overrun the 
   // size of fields with what our regular expressions retrieve
-  $feature_tbl = tripal_core_get_chado_table_schema('feature');
-  $dbxref_tbl = tripal_core_get_chado_table_schema('dbxref');
+  $feature_tbl = chado_get_schema('feature');
+  $dbxref_tbl = chado_get_schema('dbxref');
 
   //foreach ($lines as $line_num => $line) {  
   while ($line = fgets($fh)) {
@@ -515,10 +515,10 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
       // get the feature name
       if ($re_name) {
         if (!preg_match("/$re_name/", $line, $matches)) {
-          tripal_core_report_error('trp-fasta', "ERROR: Regular expression for the feature name finds nothing. Line %line.", array('%line' => $i), 'error');
+          tripal_report_error('trp-fasta', "ERROR: Regular expression for the feature name finds nothing. Line %line.", array('%line' => $i), 'error');
         }
         elseif (strlen($matches[1]) > $feature_tbl['fields']['name']['length']) {
-          tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves a value too long for the feature name. Line %line.", array('%line' => $i), 'error');  
+          tripal_report_error('trp-fasta', "WARNING: Regular expression retrieves a value too long for the feature name. Line %line.", array('%line' => $i), 'error');  
         }
         else {
           $name = trim($matches[1]);
@@ -530,14 +530,14 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
         if (strcmp($match_type, 'Name')==0) {
           if (preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)) {
             if (strlen($matches[1]) > $feature_tbl['fields']['name']['length']) {
-              tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves a feature name too long for the feature name. Line %line.", array('%line' => $i), 'error');  
+              tripal_report_error('trp-fasta', "WARNING: Regular expression retrieves a feature name too long for the feature name. Line %line.", array('%line' => $i), 'error');  
             }
             else {
               $name = trim($matches[1]);
             }
           }
           else {
-            tripal_core_report_error('trp-fasta', "ERROR: Cannot find a feature name. Line %line.", array('%line' => $i), 'error');  
+            tripal_report_error('trp-fasta', "ERROR: Cannot find a feature name. Line %line.", array('%line' => $i), 'error');  
           }
         }
       }
@@ -545,7 +545,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
       // get the feature unique name
       if ($re_uname) {
         if (!preg_match("/$re_uname/", $line, $matches)) {
-          tripal_core_report_error('trp-fasta', "ERROR: Regular expression for the feature unique name finds nothing. Line %line.", array('%line' => $i), 'error');
+          tripal_report_error('trp-fasta', "ERROR: Regular expression for the feature unique name finds nothing. Line %line.", array('%line' => $i), 'error');
         }
         $uname = trim($matches[1]);
       }
@@ -557,14 +557,14 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
             $uname = trim($matches[1]);
           }
           else {
-            tripal_core_report_error('trp-fasta', "ERROR: Cannot find a feature unique name. Line %line.", array('%line' => $i), 'error');  
+            tripal_report_error('trp-fasta', "ERROR: Cannot find a feature unique name. Line %line.", array('%line' => $i), 'error');  
           }
         }
       }
       // get the accession
       preg_match("/$re_accession/", $line, $matches);
       if (strlen($matches[1]) > $dbxref_tbl['fields']['accession']['length']) {
-        tripal_core_report_error('trp-fasta', "WARNING: Regular expression retrieves an accession too long for the feature name. Cannot add cross reference. Line %line.", array('%line' => $i), 'warning');  
+        tripal_report_error('trp-fasta', "WARNING: Regular expression retrieves an accession too long for the feature name. Cannot add cross reference. Line %line.", array('%line' => $i), 'warning');  
       }
       else {
         $accession = trim($matches[1]);
@@ -587,7 +587,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
         else {
           print "Parsing Line $i (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes. Current feature: $uname\r";  
         }
-        tripal_job_set_progress($job, intval(($num_read / $filesize) * 100));
+        tripal_set_job_progress($job, intval(($num_read / $filesize) * 100));
       }
     }
   }
@@ -619,9 +619,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'type_id' => $cvterm->cvterm_id,    
     );
     $options = array('statement_name' => 'sel_feature_ornaty');
-    $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+    $results = chado_select_record('feature', array('feature_id'), $values, $options);
     if (count($results) > 1) {
-      tripal_core_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
+      tripal_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
@@ -638,9 +638,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     );
 
     $options = array('statement_name' => 'sel_feature_oruqty');
-    $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+    $results = chado_select_record('feature', array('feature_id'), $values, $options);
     if (count($results) > 1) {
-      tripal_core_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
+      tripal_report_error('T_fasta_loader', "Multiple features exist with the name '%name' of type 
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
@@ -650,7 +650,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     
     // if the feature exists but this is an "insert only" method then skip this feature 
     if ($feature and (strcmp($method, 'Insert only')==0)) {
-      tripal_core_report_error('T_fasta_loader', TRIPAL_WARNING, "Feature already exists '%name' ('%uname') while matching on %type. Skipping insert.", 
+      tripal_report_error('T_fasta_loader', TRIPAL_WARNING, "Feature already exists '%name' ('%uname') while matching on %type. Skipping insert.", 
         array('%name' => $name, '%uname' => $uname, '%type' => drupal_strtolower($match_type)));
       return 0;
     } 
@@ -680,9 +680,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'is_obsolete' => 'FALSE',
     );
     $options = array('statement_name' => 'ins_feature_all');
-    $success = tripal_core_chado_insert('feature', $values, $options);    
+    $success = chado_insert_record('feature', $values, $options);    
     if (!$success) {
-      tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to insert feature '%name (%uname)'", 
+      tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to insert feature '%name (%uname)'", 
         array('%name' => $name, '%uname' => $numane));
       return 0;
     }
@@ -694,13 +694,13 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'type_id' => $cvterm->cvterm_id,    
     );
     $options = array('statement_name' => 'sel_feature_oruqty');
-    $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+    $results = chado_select_record('feature', array('feature_id'), $values, $options);
     if (count($results) == 1) {
        $inserted = 1;
        $feature = $results[0];
     } 
     else {
-      tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted feature '%name (%uname)'", 
+      tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted feature '%name (%uname)'", 
         array('%name' => $name, '%uname' => $numane));
       return 0;  
     }     
@@ -708,7 +708,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
   
   // if we don't have a feature and the user wants to do an update then fail
   if (!$feature and (strcmp($method, 'Update only')==0 or drupal_strcmp($method, 'Insert and update')==0)) {
-    tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to find feature '%name' ('%uname') while matching on " . 
+    tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to find feature '%name' ('%uname') while matching on " . 
       drupal_strtolower($match_type), array('%name' => $name, '%uname' => $uname));
     return 0;
   }
@@ -728,9 +728,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
           'type_id' => $cvterm->cvterm_id,    
         );    
         $options = array('statement_name' => 'sel_feature_oruqty');
-        $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+        $results = chado_select_record('feature', array('feature_id'), $values, $options);
         if (count($results) > 0) {
-          tripal_core_report_error('T_fasta_loader', "Cannot update the feature '%name' with a uniquename of '%uname' and type of '%type' as it 
+          tripal_report_error('T_fasta_loader', "Cannot update the feature '%name' with a uniquename of '%uname' and type of '%type' as it 
             conflicts with an existing feature with the same uniquename and type.", 
             array('%name' => $name, '%uname' => $uname, '%type' => $type));
           return 0;
@@ -770,9 +770,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       }
       
       // perform the update
-      $success = tripal_core_chado_update('feature', $match, $values, $options);
+      $success = chado_update_record('feature', $match, $values, $options);
       if (!$success) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, 
           "Failed to update feature '%name' ('%name')", 
           array('%name' => $name, '%uiname' => $uname));
         return 0;
@@ -813,9 +813,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
         );
         $options = array('statement_name' => 'upd_feature_naresemdisis_unorty'); 
       }
-      $success = tripal_core_chado_update('feature', $match, $values, $options);
+      $success = chado_update_record('feature', $match, $values, $options);
       if (!$success) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to update feature '%name' ('%name')", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to update feature '%name' ('%name')", 
           array('%name' => $name, '%uiname' => $uname));
         return 0;
       }
@@ -830,12 +830,12 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'feature_id' => $feature->feature_id,
     );
     $sel_options = array('statement_name' => 'sel_analysisfeature_anfe');
-    $results = tripal_core_chado_select('analysisfeature', array('analysisfeature_id'), $values, $sel_options);
+    $results = chado_select_record('analysisfeature', array('analysisfeature_id'), $values, $sel_options);
     if (count($results) == 0) {
       $ins_options = array('statement_name' => 'ins_analysisfeature_anfe');
-      $success = tripal_core_chado_insert('analysisfeature', $values, $ins_options);      
+      $success = chado_insert_record('analysisfeature', $values, $ins_options);      
       if (!$success) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to associate analysis and feature '%name' ('%name')", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to associate analysis and feature '%name' ('%name')", 
           array('%name' => $name, '%uname' => $uname));
         return 0;  
       }
@@ -850,22 +850,22 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'accession' => $accession
     );
     $sel_options = array('statement_name' => 'sel_dbxref_dbac');
-    $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
+    $results = chado_select_record('dbxref', array('dbxref_id'), $values, $sel_options);
     // if the accession doesn't exist then add it
     if (count($results) == 0) {   
       $ins_options = array('statement_name' => 'ins_dbxref_dbac');
-      $results = tripal_core_chado_insert('dbxref', $values, $ins_options);
+      $results = chado_insert_record('dbxref', $values, $ins_options);
       if (!$results) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add database accession '%accession'", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add database accession '%accession'", 
           array('%accession' => $accession));
         return 0;
       }
-      $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
+      $results = chado_select_record('dbxref', array('dbxref_id'), $values, $sel_options);
       if (count($results) == 1) {
         $dbxref = $results[0];
       }
       else { 
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted dbxref '%name (%uname)'", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to retreive newly inserted dbxref '%name (%uname)'", 
           array('%name' => $name, '%uname' => $numane));
         return 0;
       }
@@ -880,12 +880,12 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'dbxref_id' => $dbxref->dbxref_id
     );
     $sel_options = array('statement_name' => 'sel_featuredbxref_fedb');
-    $results = tripal_core_chado_select('feature_dbxref', array('feature_dbxref_id'), $values, $sel_options);
+    $results = chado_select_record('feature_dbxref', array('feature_dbxref_id'), $values, $sel_options);
     if (count($results) == 0) {  
       $ins_options = array('statement_name' => 'ins_featuredbxref_fedb');
-      $success = tripal_core_chado_insert('feature_dbxref', $values, $ins_options);
+      $success = chado_insert_record('feature_dbxref', $values, $ins_options);
       if (!$success) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
           array('%accession' => $accession));
         return 0;
       }
@@ -900,9 +900,9 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'type_id' => $parentcvterm->cvterm_id,    
     );
     $options = array('statement_name' => 'sel_feature_oruqty');
-    $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+    $results = chado_select_record('feature', array('feature_id'), $values, $options);
     if (count($results) != 1) {
-      tripal_core_report_error('T_fasta_loader', "Cannot find a unique fature for the parent '%parent' of type 
+      tripal_report_error('T_fasta_loader', "Cannot find a unique fature for the parent '%parent' of type 
                '%type' for the feature.", array('%parent' => $parent, '%type' => $parent_type));
       return 0;
     } 
@@ -915,12 +915,12 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       'type_id' => $relcvterm->cvterm_id,    
     );
     $sel_options = array('statement_name' => 'sel_featurerelationship_suojty');
-    $results = tripal_core_chado_select('feature_relationship', array('feature_relationship_id'), $values, $sel_options);
+    $results = chado_select_record('feature_relationship', array('feature_relationship_id'), $values, $sel_options);
     if (count($results) == 0) {    
       $ins_options = array('statement_name' => 'ins_featurerelationship_suojty');
-      $success = tripal_core_chado_insert('feature_relationship', $values, $ins_options);
+      $success = chado_insert_record('feature_relationship', $values, $ins_options);
       if (!$success) {
-        tripal_core_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
+        tripal_report_error('T_fasta_loader', TRIPAL_ERROR, "Failed to add associate database accession '%accession' with feature", 
           array('%accession' => $accession));
         return 0;
       }

+ 121 - 121
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -335,7 +335,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
       $dfile = $gff_file;
     }
     if (!file_exists($dfile)) {
-      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Cannot find the file: %dfile", 
+      tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Cannot find the file: %dfile", 
         array('%dfile' => $dfile));
       return 0;
     }
@@ -345,7 +345,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     //$lines = file($dfile,FILE_SKIP_EMPTY_LINES);
     $fh = fopen($dfile, 'r');
     if (!$fh) {
-      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot open file: %dfile", 
+      tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot open file: %dfile", 
         array('%dfile' => $dfile));
       return 0;
     }
@@ -356,7 +356,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     $sql = "SELECT * FROM {cv} WHERE name = :cvname";
     $cv = chado_query($sql, array(':cvname' => 'sequence'))->fetchObject();
     if (!$tripal_core_report_error) {   
-      tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Cannot find the 'sequence' ontology", 
+      tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Cannot find the 'sequence' ontology", 
         array());
       return '';
     }
@@ -402,7 +402,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         $intv_read = 0;
         $percent = sprintf("%.2f", ($num_read / $filesize) * 100);
         print "Parsing Line $line_num (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
-        tripal_job_set_progress($job, intval(($num_read / $filesize) * 100));
+        tripal_set_job_progress($job, intval(($num_read / $filesize) * 100));
       }
         
       // check to see if we have FASTA section, if so then set the variable
@@ -424,7 +424,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           $result = chado_query($sel_cvterm_sql, array(':cv_id' => $cv->cv_id, ':name' => $landmark_type, ':synonym' => $landmark_type));
           $cvterm = $result->fetchObject();
           if (!$cvterm) {
-            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature type \'%landmark_type\' on line %line_num of the GFF file', 
+            tripal_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature type \'%landmark_type\' on line %line_num of the GFF file', 
               array('%landmark_type' => $landmark_type, '%line_num' => $line_num));
             return '';
           }
@@ -447,7 +447,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
       // get the columns
       $cols = explode("\t", $line);
       if (sizeof($cols) != 9) {
-        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'improper number of columns on line %line_num', 
+        tripal_report_error('T_gff3_loader', TRIPAL_ERROR, 'improper number of columns on line %line_num', 
           array('%line_num' => $line_num));
         return '';
       }
@@ -489,7 +489,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
   
       $cvterm = $result->fetchObject();
       if (!$cvterm) {
-        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature term \'%type\' on line %line_num of the GFF file', 
+        tripal_report_error('T_gff3_loader', TRIPAL_ERROR, 'cannot find feature term \'%type\' on line %line_num of the GFF file', 
           array('%type' => $type, '%line_num' => $line_num));
         return '';
       }
@@ -520,7 +520,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           continue;
         }
         if (!preg_match('/^[^\=]+\=.+$/', $attr)) {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, 'Attribute is not correctly formatted on line %line_num: %attr', 
+          tripal_report_error('T_gff3_loader', TRIPAL_ERROR, 'Attribute is not correctly formatted on line %line_num: %attr', 
             array('%line_num' => $line_num, '%attr' => $attr));
           return '';
         }
@@ -557,18 +557,18 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
               'genus' => $org_matches[1],
               'species' => $org_matches[2],
             ); 
-            $org = tripal_core_chado_select('organism', array("*"), $values);
+            $org = chado_select_record('organism', array("*"), $values);
             if (count($org) == 0) {
               if ($create_organism) {
-                $feature_organism = (object) tripal_core_chado_insert('organism', $values);
+                $feature_organism = (object) chado_insert_record('organism', $values);
                 if (!$feature_organism) {
-                  tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add the organism, '%org', from line %line. Skipping this line. ",
+                  tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add the organism, '%org', from line %line. Skipping this line. ",
                     array('%org' => $attr_organism, '%line' => $line_num)); 
                   $skip_feature = 1; 
                 }
               } 
               else {
-                tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line does not exist. Skipping this line. ",
+                tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line does not exist. Skipping this line. ",
                   array('%org' => $attr_organism, '%line' => $line_num)); 
                 $skip_feature = 1;
               }
@@ -579,7 +579,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
             }
           } 
           else {
-            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line is not properly formated. It " .
+            tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The organism attribute '%org' on line %line is not properly formated. It " .
               "should be of the form: organism=Genus:species.  Skipping this line.", 
               array('%org' => $attr_organism, '%line' => $line_num));
             $skip_feature = 1;  
@@ -654,7 +654,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
             'name' => $landmark_type,
           );
         }      
-        $count = tripal_core_chado_select('feature', $columns, $select);        
+        $count = chado_select_record('feature', $columns, $select);        
         if (!$count or count($count) == 0 or $count[0]->num_landmarks == 0) {        
           // now look for the landmark using the name rather than uniquename.
           $select = array(
@@ -667,22 +667,22 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
               'name' => $landmark_type,
             );
           }
-          $count = tripal_core_chado_select('feature', $columns, $select); 
+          $count = chado_select_record('feature', $columns, $select); 
           if (!$count or count($count) == 0 or $count[0]->num_landmarks == 0) {
-            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' cannot be found for this organism (%species) " .
+            tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' cannot be found for this organism (%species) " .
                   "Please add the landmark and then retry the import of this GFF3 " .
                   "file", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species));
             return '';
           }
           elseif ($count[0]->num_landmarks > 1) {
-            tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' has more than one entry for this organism (%species) " .
+            tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' has more than one entry for this organism (%species) " .
                   "Cannot continue", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species));
             return '';  
           }
   
         }
         if ($count[0]->num_landmarks > 1) {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' is not unique for this organism. " .
+          tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The landmark '%landmark' is not unique for this organism. " .
                 "The features cannot be associated", array('%landmark' => $landmark));
           return '';
         }  
@@ -698,9 +698,9 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
            'uniquename'  => $attr_uniquename,
            'type_id'     => $cvterm->cvterm_id
         );
-        $result = tripal_core_chado_delete('feature', $match);
+        $result = chado_delete_record('feature', $match);
         if (!$result) {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot delete feature %attr_uniquename", 
+          tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "cannot delete feature %attr_uniquename", 
             array('%attr_uniquename' => $attr_uniquename));
         }
         $feature = 0;
@@ -726,12 +726,12 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
             'uniquename' => $feature->uniquename
           );
           // make sure this record doesn't already exist in oru temp table
-          $results = tripal_core_chado_select('tripal_gff_temp', array('*'), $values);
+          $results = chado_select_record('tripal_gff_temp', array('*'), $values);
   
           if (count($results) == 0) {
-            $result = tripal_core_chado_insert('tripal_gff_temp', $values);
+            $result = chado_insert_record('tripal_gff_temp', $values);
             if (!$result) {
-              tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Cound not save record in temporary table, Cannot continue.", array());
+              tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Cound not save record in temporary table, Cannot continue.", array());
               exit;
             }
           }
@@ -862,7 +862,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         foreach ($children as $child) {
           $match = array('feature_relationship_id' => $child->feature_relationship_id);
           $values = array('rank' => $rank);      
-          tripal_core_chado_update('feature_relationship', $match, $values);
+          chado_update_record('feature_relationship', $match, $values);
           $rank--;
         }
         // now set the rank correctly. The rank should start at 0.
@@ -871,7 +871,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           $match = array('feature_relationship_id' => $child->feature_relationship_id);
           $values = array('rank' => $rank); 
           //print "Was: " . $child->rank . " now $rank ($parent->strand)\n"     ;
-          tripal_core_chado_update('feature_relationship', $match, $values);
+          chado_update_record('feature_relationship', $match, $values);
           $rank++;
         }
         $i++;
@@ -906,9 +906,9 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
     'organism_id' => $organism->organism_id,
     'uniquename' => $subject,
   );
-  $result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values);   
+  $result = chado_select_record('tripal_gff_temp', array('type_name'), $values);   
   if (count($result) == 0) {
-    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find subject type for feature in 'derives_from' relationship: %subject", array('%subject' => $subject));
+    tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find subject type for feature in 'derives_from' relationship: %subject", array('%subject' => $subject));
      return ''; 
   }
   $subject_type = $result[0]->type_name;
@@ -924,9 +924,9 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
       ),
     ),      
   );
-  $sfeature = tripal_core_chado_select('feature', array('feature_id'), $match);
+  $sfeature = chado_select_record('feature', array('feature_id'), $match);
   if (count($sfeature)==0) {
-    tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Derives_from' relationship " .
+    tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Derives_from' relationship " .
       "for %uniquename and %subject.  Subject feature, '%subject', " .
       "cannot be found", array('%uniquename' => $feature->uniquename, '%subject' => $subject));
     return;
@@ -944,15 +944,15 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
     ),
     'rank' => 0
   );
-  $rel = tripal_core_chado_select('feature_relationship', array('*'), $values);
+  $rel = chado_select_record('feature_relationship', array('*'), $values);
   if (count($rel) > 0) {
     return;
   }
 
   // finally insert the relationship if it doesn't exist
-  $ret = tripal_core_chado_insert('feature_relationship', $values);
+  $ret = chado_insert_record('feature_relationship', $values);
   if (!$ret) {
-    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add 'Derives_from' relationship for $feature->uniquename and $subject", 
+    tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add 'Derives_from' relationship for $feature->uniquename and $subject", 
       array());
   }
 }
@@ -983,9 +983,9 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
       'organism_id' => $organism_id,
       'uniquename' => $parent,
     );
-    $result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values);    
+    $result = chado_select_record('tripal_gff_temp', array('type_name'), $values);    
     if (count($result) == 0) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find parent: %parent", array('%parent' => $parent));
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find parent: %parent", array('%parent' => $parent));
        return '';  
     }
     $parent_type = $result[0]->type_name;
@@ -998,7 +998,7 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
         'uniquename' => $parent,
         'type_id' => $parentcvterm->cvterm_id,
     );
-    $result = tripal_core_chado_select('feature', array('feature_id'), $values);
+    $result = chado_select_record('feature', array('feature_id'), $values);
     $parent_feature = $result[0];
 
     // if the parent exists then add the relationship otherwise print error and skip
@@ -1010,7 +1010,7 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
         'subject_id' => $feature->feature_id,
         'type_id' => $relcvterm->cvterm_id,
       );
-      $rel = tripal_core_chado_select('feature_relationship', array('*'), $values);
+      $rel = chado_select_record('feature_relationship', array('*'), $values);
 
       if (count($rel) > 0) {
       }
@@ -1021,15 +1021,15 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
           'object_id'  => $parent_feature->feature_id,
           'type_id' => $relcvterm->cvterm_id,
         );
-        $result = tripal_core_chado_insert('feature_relationship', $values);
+        $result = chado_insert_record('feature_relationship', $values);
         if (!$result) {
-          tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature relationship '$uname' ($type) $rel_type '$parent' ($parent_type)", 
+          tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature relationship '$uname' ($type) $rel_type '$parent' ($parent_type)", 
             array());
         }
       }
     }
     else {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot establish relationship '$uname' ($type) $rel_type '$parent' ($parent_type): Cannot find the parent", 
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot establish relationship '$uname' ($type) $rel_type '$parent' ($parent_type): Cannot find the parent", 
         array());      
     }
   }
@@ -1056,23 +1056,23 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
     // can't be found then look for the name as is.  If it still can't be found
     // the create the database
     $values = array('name' => "DB:$dbname");
-    $db = tripal_core_chado_select('db', array('db_id'), $values);
+    $db = chado_select_record('db', array('db_id'), $values);
     if (count($db) == 0) {
       $values = array('name' => "$dbname");
-      $db = tripal_core_chado_select('db', array('db_id'), $values);
+      $db = chado_select_record('db', array('db_id'), $values);
     }
     if (count($db) == 0) {
       $values = array(
         'name' => $dbname,
         'description' => 'Added automatically by the GFF loader'
       );
-      $success = tripal_core_chado_insert('db', $values);
+      $success = chado_insert_record('db', $values);
       if ($success) {
         $values = array('name' => "$dbname");
-        $db = tripal_core_chado_select('db', array('db_id'), $values);
+        $db = chado_select_record('db', array('db_id'), $values);
       }
       else {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find or add the database $dbname", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find or add the database $dbname", array());
         return 0;
       }
     }
@@ -1083,7 +1083,7 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
       'accession' => $accession, 
       'db_id' => $db->db_id
     );
-    $dbxref = tripal_core_chado_select('dbxref', array('dbxref_id'), $values);
+    $dbxref = chado_select_record('dbxref', array('dbxref_id'), $values);
 
     // if the accession doesn't exist then we want to add it
     if (sizeof($dbxref) == 0) {
@@ -1092,12 +1092,12 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
         'accession' => $accession, 
         'version' => ''
       );
-      $ret = tripal_core_chado_insert('dbxref', $values);
+      $ret = chado_insert_record('dbxref', $values);
       $values = array(
         'accession' => $accession, 
         'db_id' => $db->db_id
       );
-      $dbxref = tripal_core_chado_select('dbxref', array('dbxref_id'), $values);
+      $dbxref = chado_select_record('dbxref', array('dbxref_id'), $values);
     }
     $dbxref = $dbxref[0];
 
@@ -1106,7 +1106,7 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
       'dbxref_id' => $dbxref->dbxref_id, 
       'feature_id' => $feature->feature_id
     );
-    $fdbx = tripal_core_chado_select('feature_dbxref', array('feature_dbxref_id'), $values);
+    $fdbx = chado_select_record('feature_dbxref', array('feature_dbxref_id'), $values);
 
     // now associate this feature with the database reference if it doesn't
     // already exist
@@ -1115,9 +1115,9 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
         'dbxref_id' => $dbxref->dbxref_id,
         'feature_id' => $feature->feature_id
       );
-      $success = tripal_core_chado_insert('feature_dbxref', $values);
+      $success = chado_insert_record('feature_dbxref', $values);
       if (!$success) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert Dbxref: $dbname:$accession", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert Dbxref: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1140,35 +1140,35 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
     $accession = $ref[1];
 
     // first look for the database name
-    $db = tripal_core_chado_select('db', array('db_id'), array('name' => "DB:$dbname"));
+    $db = chado_select_record('db', array('db_id'), array('name' => "DB:$dbname"));
     if (sizeof($db) == 0) {
       // now look for the name without the 'DB:' prefix.
-      $db = tripal_core_chado_select('db', array('db_id'), array('name' => "$dbname"));
+      $db = chado_select_record('db', array('db_id'), array('name' => "$dbname"));
       if (sizeof($db) == 0) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Database, $dbname, is not present. Cannot associate term: $dbname:$accession", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Database, $dbname, is not present. Cannot associate term: $dbname:$accession", array());
         return 0;
       }
     }
     $db = $db[0];
 
     // now check to see if the accession exists
-    $dbxref = tripal_core_chado_select('dbxref', array('dbxref_id'), 
+    $dbxref = chado_select_record('dbxref', array('dbxref_id'), 
       array('accession' => $accession, 'db_id' => $db->db_id));
     if (sizeof($dbxref) == 0) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Accession, $accession is missing for reference: $dbname:$accession", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Accession, $accession is missing for reference: $dbname:$accession", array());
       return 0;
     }
     $dbxref = $dbxref[0];
 
     // now check to see if the cvterm exists
-    $cvterm = tripal_core_chado_select('cvterm', array('cvterm_id'), array(
+    $cvterm = chado_select_record('cvterm', array('cvterm_id'), array(
        'dbxref_id' => $dbxref->dbxref_id));
     // if it doesn't exist in the cvterm table, look for an alternate id
     if (sizeof($cvterm) == 0) {
-      $cvterm = tripal_core_chado_select('cvterm_dbxref', array('cvterm_id'), array(
+      $cvterm = chado_select_record('cvterm_dbxref', array('cvterm_id'), array(
         'dbxref_id' => $dbxref->dbxref_id));
       if (sizeof($cvterm) == 0) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "CV Term is missing for reference: $dbname:$accession", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "CV Term is missing for reference: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1176,7 +1176,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
 
 
     // check to see if this feature cvterm already exists
-    $fcvt = tripal_core_chado_select('feature_cvterm', array('feature_cvterm_id'),
+    $fcvt = chado_select_record('feature_cvterm', array('feature_cvterm_id'),
       array('cvterm_id' => $cvterm->cvterm_id, 'feature_id' => $feature->feature_id));
 
     // now associate this feature with the cvterm if it doesn't already exist
@@ -1188,10 +1188,10 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
           'uniquename' => 'null',
         ),
       );
-      $success = tripal_core_chado_insert('feature_cvterm', $values);
+      $success = chado_insert_record('feature_cvterm', $values);
 
       if (!$success) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert ontology term: $dbname:$accession", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert ontology term: $dbname:$accession", array());
         return 0;
       }
     }
@@ -1207,7 +1207,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
 
   // make sure we have a 'synonym_type' vocabulary
   $select = array('name' => 'synonym_type');
-  $results = tripal_core_chado_select('cv', array('*'), $select);
+  $results = chado_select_record('cv', array('*'), $select);
   
   if (count($results) == 0) {
     // insert the 'synonym_type' vocabulary
@@ -1215,13 +1215,13 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       'name' => 'synonym_type',
       'definition' => 'vocabulary for synonym types',
     );
-    $success = tripal_core_chado_insert('cv', $values);
+    $success = chado_insert_record('cv', $values);
     if (!$success) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to add the synonyms type vocabulary", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to add the synonyms type vocabulary", array());
       return 0;
     }
     // now that we've added the cv we need to get the record
-    $results = tripal_core_chado_select('cv', array('*'), $select);
+    $results = chado_select_record('cv', array('*'), $select);
     if (count($results) > 0) {
       $syncv = $results[0];
     }
@@ -1237,7 +1237,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
         'name' => 'synonym_type'
      ),
   );
-  $result = tripal_core_chado_select('cvterm', array('*'), $select);  
+  $result = chado_select_record('cvterm', array('*'), $select);  
   if (count($result) == 0) {
     $term = array(
       'name' => 'exact',
@@ -1247,7 +1247,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
     );
     $syntype = tripal_cv_add_cvterm($term, $syncv->name, 0, 1);
     if (!$syntype) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add synonym type: internal:$type", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add synonym type: internal:$type", array());
       return 0;
     }
   } 
@@ -1264,19 +1264,19 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
        'name' => $alias,
        'type_id' => $syntype->cvterm_id,
     );
-    $result = tripal_core_chado_select('synonym', array('*'), $select);    
+    $result = chado_select_record('synonym', array('*'), $select);    
     if (count($result) == 0) {
       $values = array(
          'name' => $alias,
          'type_id' => $syntype->cvterm_id,
          'synonym_sgml' => '',
       );
-      $success = tripal_core_chado_insert('synonym', $values);
+      $success = chado_insert_record('synonym', $values);
       if (!$success) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to synonym table", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to synonym table", array());
         return 0;
       }
-      $result = tripal_core_chado_select('synonym', array('*'), $select);
+      $result = chado_select_record('synonym', array('*'), $select);
       $synonym = $result[0];
     }
     else {
@@ -1286,7 +1286,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
     // check to see if we have a NULL publication in the pub table.  If not,
     // then add one.
     $select = array('uniquename' => 'null');
-    $result = tripal_core_chado_select('pub', array('*'), $select);    
+    $result = chado_select_record('pub', array('*'), $select);    
     if (count($result) == 0) {
       $pub_sql = "
         INSERT INTO {pub} (uniquename,type_id) 
@@ -1299,17 +1299,17 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       ";
       $status = chado_query($psql);
       if (!$status) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot prepare statement 'ins_pub_uniquename_typeid", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot prepare statement 'ins_pub_uniquename_typeid", array());
         return 0;
       } 
 
       // insert the null pub 
       $result = chado_query($pub_sql, array(':uname' => 'null', ':type_id' => 'null'))->fetchObject();
       if (!$result) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add null publication needed for setup of alias", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add null publication needed for setup of alias", array());
         return 0;
       }
-      $result = tripal_core_chado_select('pub', array('*'), $select);
+      $result = chado_select_record('pub', array('*'), $select);
       $pub = $result[0];
     }
     else {
@@ -1324,17 +1324,17 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
        'pub_id' => $pub->pub_id,
     );
     $columns = array('feature_synonym_id');
-    $result = tripal_core_chado_select('feature_synonym', $columns, $values);
+    $result = chado_select_record('feature_synonym', $columns, $values);
     if (count($result) == 0) {      
       $values = array(
          'synonym_id' => $synonym->synonym_id,
          'feature_id' => $feature->feature_id,
          'pub_id' => $pub->pub_id,
       );  
-      $success = tripal_core_chado_insert('feature_synonym', $values);   
+      $success = chado_insert_record('feature_synonym', $values);   
      
       if (!$success) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to feature synonym table", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add alias $alias to feature synonym table", array());
         return 0;
       }
     }
@@ -1358,7 +1358,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
      'type_id' => $cvterm->cvterm_id
   );
   $columns = array('feature_id', 'name', 'uniquename', 'seqlen', 'organism_id', 'type_id');
-  $result = tripal_core_chado_select('feature', $columns, $fselect);
+  $result = chado_select_record('feature', $columns, $fselect);
   if (count($result) > 0) {
     $feature = $result[0];
   }
@@ -1389,9 +1389,9 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
        'is_analysis' => $is_analysis,
        'is_obsolete' => $is_obsolete,
     );
-    $result = tripal_core_chado_insert('feature', $values);
+    $result = chado_insert_record('feature', $values);
     if (!$result) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature '$uniquename' ($cvterm->name)", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert feature '$uniquename' ($cvterm->name)", array());
       return 0;
     }
   }
@@ -1409,9 +1409,9 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
       'uniquename' => $uniquename,
       'type_id' => $cvterm->cvterm_id,
     );
-    $result = tripal_core_chado_update('feature', $match, $values);
+    $result = chado_update_record('feature', $match, $values);
     if (!$result) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to update feature '$uniquename' ($cvterm->name)", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to update feature '$uniquename' ($cvterm->name)", array());
       return 0;
     }
   }
@@ -1423,7 +1423,7 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
 
   // get the newly added feature
   $columns = array('feature_id', 'name', 'uniquename', 'seqlen', 'organism_id', 'type_id');
-  $result = tripal_core_chado_select('feature', $columns, $fselect);  
+  $result = chado_select_record('feature', $columns, $fselect);  
   $feature = $result[0];
 
   // add the analysisfeature entry to the analysisfeature table if it doesn't already exist
@@ -1431,14 +1431,14 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
     'analysis_id' => $analysis_id,
     'feature_id' => $feature->feature_id
   );
-  $afeature = tripal_core_chado_select('analysisfeature', array('analysisfeature_id'), $af_values);
+  $afeature = chado_select_record('analysisfeature', array('analysisfeature_id'), $af_values);
   if (count($afeature)==0) {
     // if a score is available then set that to be the significance field
     if (strcmp($score, '.') != 0) {
       $af_values['significance'] = $score;
     } 
     if (!tripal_core_chado_insert('analysisfeature', $af_values)) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add analysisfeature record: $analysis_id, $feature->feature_id", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not add analysisfeature record: $analysis_id, $feature->feature_id", array());
     }    
   }
   else {
@@ -1451,9 +1451,9 @@ function tripal_feature_load_gff3_feature($organism, $analysis_id, $cvterm, $uni
       $new_vals['significance'] = '__NULL__';
     }
     if (!$add_only) {
-      $ret = tripal_core_chado_update('analysisfeature', $af_values, $new_vals);
+      $ret = chado_update_record('analysisfeature', $af_values, $new_vals);
       if (!$ret) {
-        tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not update analysisfeature record: $analysis_id, $feature->feature_id", array());
+        tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Could not update analysisfeature record: $analysis_id, $feature->feature_id", array());
       }
     }
   }
@@ -1477,7 +1477,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
   if ($landmark_type_id) {
     $select['type_id'] = $landmark_type_id;
   }  
-  $results = tripal_core_chado_select('feature', array('feature_id'), $select);
+  $results = chado_select_record('feature', array('feature_id'), $select);
 
   $srcfeature = '';
   if (count($results)==0) {
@@ -1490,13 +1490,13 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     if ($landmark_type_id) {
       $select['type_id'] = $landmark_type_id;
     } 
-    $results = tripal_core_chado_select('feature', array('feature_id'), $select);
+    $results = chado_select_record('feature', array('feature_id'), $select);
     if (count($results) == 0) {
        // if the landmark is the target feature in a matched alignment then try one more time to
        // find it by querying any feature with the same uniquename. If we find one then use it.
        if ($landmark_is_target) {
          $select = array('uniquename' => $landmark);
-         $results = tripal_core_chado_select('feature', array('feature_id'), $select);
+         $results = chado_select_record('feature', array('feature_id'), $select);
          if (count($results) == 1) {
            $srcfeature = $results[0]; 
          }
@@ -1512,9 +1512,9 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
               'uniquename' => $landmark,
               'type_id' => $landmark_type_id
             );
-            $results = tripal_core_chado_insert('feature', $values);
+            $results = chado_insert_record('feature', $values);
             if (!$results) {
-              tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find landmark feature: '%landmark', nor could it be inserted", 
+              tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find landmark feature: '%landmark', nor could it be inserted", 
                 array('%landmark' => $landmark));
               return 0;  
             }  
@@ -1522,14 +1522,14 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
             $srcfeature->feature_id = $results['feature_id'];
          } 
          else {
-           tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find unique landmark feature: '%landmark'.", 
+           tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot find unique landmark feature: '%landmark'.", 
              array('%landmark' => $landmark));
            return 0;
          } 
        }        
     } 
     elseif (count($results) > 1) {
-       tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
+       tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
          resolve which one to use. Cannot add the feature location record", 
          array('%landmark' => $landmark));
        return 0;    
@@ -1539,7 +1539,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     }   
   }
   elseif (count($results) > 1) {
-    tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
+    tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "multiple landmarks exist with the name: '%landmark'.  Cannot 
       resolve which one to use. Cannot add the feature location record", 
       array('%landmark' => $landmark));
     return 0;  
@@ -1563,7 +1563,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     ),
   );
  
-  $locrecs = tripal_core_chado_select('featureloc', array('*'), $select, $options);
+  $locrecs = chado_select_record('featureloc', array('*'), $select, $options);
 
   foreach ($locrecs as $featureloc) {
     // it is possible for the featureloc->srcfeature_id to be NULL. This can happen if the srcfeature
@@ -1573,7 +1573,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     }    
     $select = array('feature_id' => $featureloc->srcfeature_id);
     $columns = array('feature_id', 'name');
-    $locsfeature = tripal_core_chado_select('feature', $columns, $select);   
+    $locsfeature = chado_select_record('feature', $columns, $select);   
     
     // the source feature name and at least the fmin and fmax must be the same
     // for an update of the featureloc, otherwise we'll insert a new record.
@@ -1592,7 +1592,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
          $values['strand'] = $strand;
       }
       if (count($values) > 0) {
-        tripal_core_chado_update('featureloc', $match, $values);
+        chado_update_record('featureloc', $match, $values);
       }
     }
     $rank = $featureloc->rank + 1;
@@ -1627,9 +1627,9 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     if ($phase) {
       $values['phase'] = $phase;
     }    
-    $success = tripal_core_chado_insert('featureloc', $values);
+    $success = chado_insert_record('featureloc', $values);
     if (!$success) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert featureloc", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Failed to insert featureloc", array());
       exit;
       return 0;
     }
@@ -1650,7 +1650,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
         'name' => 'feature_property',
      ),
   );
-  $result = tripal_core_chado_select('cvterm', array('*'), $select);
+  $result = chado_select_record('cvterm', array('*'), $select);
 
   // if we don't have a property like this already, then add it otherwise, just return
   if (count($result) == 0) {
@@ -1662,7 +1662,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
     );    
     $cvterm = (object) tripal_cv_add_cvterm($term, 'feature_property', 0, 0);
     if (!$cvterm) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add cvterm, $property", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "Cannot add cvterm, $property", array());
       return 0;  
     }
   } 
@@ -1685,7 +1685,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
       'rank' => 'ASC',
     ),
   );
-  $results = tripal_core_chado_select('featureprop', array('*'), $select, $options);
+  $results = chado_select_record('featureprop', array('*'), $select, $options);
   foreach ($results as $prop) {
     if (strcmp($prop->value, $value)==0) {
       $add = NULL; // don't add it, it already exists
@@ -1701,9 +1701,9 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
        'value' => $value,
        'rank' => $rank,
     );
-    $result = tripal_core_chado_insert('featureprop', $values);
+    $result = chado_insert_record('featureprop', $values);
     if (!$result) {
-      tripal_core_report_error("T_gff3_loader", TRIPAL_WARNING, "cannot add featureprop, $property", array());
+      tripal_report_error("T_gff3_loader", TRIPAL_WARNING, "cannot add featureprop, $property", array());
     }
   }
 }
@@ -1733,7 +1733,7 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
       $intv_read = 0;
       $percent = sprintf("%.2f", ($num_read / $filesize) * 100);
       print "Parsing Line $line_num (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
-      tripal_job_set_progress($job, intval(($num_read / $filesize) * 100));
+      tripal_set_job_progress($job, intval(($num_read / $filesize) * 100));
     }
     
     // if we encounter a definition line then get the name, uniquename,
@@ -1743,9 +1743,9 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
       // if we are beginning a new sequence then save to the database the last one we just finished.     
       if ($id) {
         $values = array('uniquename' => $id);
-        $result = tripal_core_chado_select('tripal_gff_temp', array('*'), $values); 
+        $result = chado_select_record('tripal_gff_temp', array('*'), $values); 
         if (count($result) == 0) {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
+          tripal_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
              array('%uname' => $id));
         }
         else {
@@ -1753,7 +1753,7 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
           $feature = $result[0];
           $values = array('residues' => $residues);
           $match = array('feature_id' => $feature->feature_id);
-          tripal_core_chado_update('feature', $match, $values);
+          chado_update_record('feature', $match, $values);
         }
       }
       
@@ -1768,9 +1768,9 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
   
   // add in the last sequence
   $values = array('uniquename' => $id);
-  $result = tripal_core_chado_select('tripal_gff_temp', array('*'), $values); 
+  $result = chado_select_record('tripal_gff_temp', array('*'), $values); 
   if (count($result) == 0) {
-    tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
+    tripal_report_error('T_gff3_loader', TRIPAL_WARNING, 'Cannot find feature to assign FASTA sequence: %uname', 
        array('%uname' => $id));
   }
   else {
@@ -1778,7 +1778,7 @@ function tripal_feature_load_gff3_fasta($fh, $interval, &$num_read, &$intv_read,
     $feature = $result[0];
     $values = array('residues' => $residues);
     $match = array('feature_id' => $feature->feature_id);
-    tripal_core_chado_update('feature', $match, $values);
+    chado_update_record('feature', $match, $values);
   }
 
 }
@@ -1834,18 +1834,18 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
           'genus' => $matches[1],
           'species' => $matches[2],
         );
-        $torganism = tripal_core_chado_select('organism', array('organism_id'), $values);
+        $torganism = chado_select_record('organism', array('organism_id'), $values);
         if (count($torganism) == 1) {
           $t_organism_id = $torganism[0]->organism_id;
         }
         else {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "Cannot find organism for target %target.", 
+          tripal_report_error('T_gff3_loader', TRIPAL_WARNING, "Cannot find organism for target %target.", 
             array('%target' => $gff_target_organism));
           $t_organism_id = '';                                   
         }
       }
       else {
-        tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_organism attribute is improperly formatted: %target. 
+        tripal_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_organism attribute is improperly formatted: %target. 
           It should be target_organism=genus:species.", 
           array('%target' => $gff_target_organism));
         $t_organism_id = '';                
@@ -1862,12 +1862,12 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
            'name' => 'sequence',
         )
       );
-      $type = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+      $type = chado_select_record('cvterm', array('cvterm_id'), $values);
       if (count($type) == 1) {
         $t_type_id = $type[0]->cvterm_id;
       }
       else {
-        tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "The target type does not exist in the sequence ontology: %type. ", 
+        tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "The target type does not exist in the sequence ontology: %type. ", 
           array('%type' => $target_type));
         exit;  
       }
@@ -1881,7 +1881,7 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
       );
       
       // get the cvterm_id for the target type
-      $type = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+      $type = chado_select_record('cvterm', array('cvterm_id'), $values);
       if (count($type) == 1) {
         $t_type_id = $type[0]->cvterm_id;
       }
@@ -1899,7 +1899,7 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
           $t_type_id = $synonym->cvterm_id;
         }
         else {
-          tripal_core_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_type attribute does not exist in the sequence ontology: %type. ", 
+          tripal_report_error('T_gff3_loader', TRIPAL_WARNING, "The target_type attribute does not exist in the sequence ontology: %type. ", 
             array('%type' => $gff_target_type));
           $t_type_id = '';
         }
@@ -1914,7 +1914,7 @@ function tripal_feature_load_gff3_target($feature, $tags, $target_organism_id, $
   }
   // the target attribute is not correctly formatted
   else {
-    tripal_core_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Target' alignment as it is improperly formatted:  '%target'",
+    tripal_report_error('T_gff3_loader', TRIPAL_ERROR, "Could not add 'Target' alignment as it is improperly formatted:  '%target'",
       array('%target' => $tags['Target'][0]));            
   }
 }

+ 5 - 5
tripal_feature/theme/tripal_feature.theme.inc

@@ -18,7 +18,7 @@ function tripal_feature_preprocess_tripal_feature_sequence(&$variables) {
     ),
   );
 
-  $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureloc', $options);
+  $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
 
   // because there are two foriegn keys in the featureloc table with the feature table
   // we have to access the records for each by specifying the field name after the table name:
@@ -75,7 +75,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
       ),
     )
   );
-  $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureloc', $options);
+  $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
 
   // get alignments as child
   $cfeaturelocs = $feature->featureloc->feature_id;
@@ -138,7 +138,7 @@ function tripal_feature_preprocess_tripal_feature_alignments(&$variables) {
   foreach ($mfeaturelocs as $featureloc) {
     // get more information about the right feature
     $select = array('feature_id' => $featureloc->right_srcfeature_id);
-    $rfeature = tripal_core_generate_chado_var('feature', $select);
+    $rfeature = chado_generate_var('feature', $select);
     // now add to the list
     $alignment = new stdClass();
     $alignment->record = $featureloc;
@@ -209,7 +209,7 @@ function tripal_feature_get_feature_relationships($feature) {
       ),
     ),
   );
-  $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_relationship', $options);
+  $feature = chado_expand_var($feature, 'table', 'feature_relationship', $options);
 
   // get the subject relationships
   $srelationships = $feature->feature_relationship->subject_id;
@@ -224,7 +224,7 @@ function tripal_feature_get_feature_relationships($feature) {
       'feature_id' => 1,
     ),
   );
-  $feature = tripal_core_expand_chado_vars($feature, 'table', 'featureloc', $options);
+  $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
   $cfeaturelocs = $feature->featureloc->feature_id;
   if (!$cfeaturelocs) {
     $cfeaturelocs = array();

+ 1 - 1
tripal_feature/tripal_feature.install

@@ -43,7 +43,7 @@ function tripal_feature_requirements($phase) {
  */
 function tripal_feature_install() {
   // create the module's data directory
-  tripal_create_moddir('tripal_feature');
+  tripal_create_files_dir('tripal_feature');
 
   // add the materialized view
   tripal_feature_add_organism_count_mview();

+ 11 - 11
tripal_feature/tripal_feature.module

@@ -290,7 +290,7 @@ function tripal_feature_theme($existing, $type, $theme, $path) {
     'tripal_feature_help' => array(
       'template' => 'tripal_feature_help',
       'variables' =>  array(NULL),
-      'path' => drupal_get_path('module', 'tripal_feature') . '/theme'
+      'path' => "$path/theme/"
     ),
 
     // template for the organism page
@@ -357,8 +357,8 @@ function tripal_feature_load_featurelocs($feature_id, $side = 'as_parent', $aggr
   while ($loc = $flresults->fetchObject()) {
     // if a drupal node exists for this feature then add the nid to the
     // results object
-    $loc->fnid = chado_get_node_id('feature', $loc->feature_id);
-    $loc->snid = chado_get_node_id('feature', $loc->src_feature_id);
+    $loc->fnid = chado_get_nid_from_id('feature', $loc->feature_id);
+    $loc->snid = chado_get_nid_from_id('feature', $loc->src_feature_id);
     // add the result to the array
     $featurelocs[$i++] = $loc;
   }
@@ -977,7 +977,7 @@ function tripal_feature_job_describe_args($callback, $args) {
   $new_args = array();
   if ($callback == 'tripal_feature_load_fasta') {
     $new_args['FASTA file'] = $args[0];
-    $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[1]));
+    $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
     $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
     $new_args['Sequence Type'] = $args[2];
     $new_args['Name Match Type'] = $args[14];
@@ -991,7 +991,7 @@ function tripal_feature_job_describe_args($callback, $args) {
 
     // add in the database reference arguments
     if ($args[7]) {
-      $db = tripal_core_chado_select('db', array('name'), array('db_id' => $args[7]));
+      $db = chado_select_record('db', array('name'), array('db_id' => $args[7]));
     }
     $new_args['Database Reference'] = $db[0]->name;
     $new_args['Accession RE'] = $args[6];
@@ -999,13 +999,13 @@ function tripal_feature_job_describe_args($callback, $args) {
 
     // add in the analysis
     if ($args[13]) {
-      $analysis = tripal_core_chado_select('analysis', array('name'), array('analysis_id' => $args[13]));
+      $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[13]));
     }
     $new_args['Analysis'] = $analysis[0]->name;
   }
   if ($callback == 'tripal_feature_delete_features') {
     if ($args[0]) {
-      $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[0]));
+      $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[0]));
       $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
     }
     else {
@@ -1013,7 +1013,7 @@ function tripal_feature_job_describe_args($callback, $args) {
     }
 
     if ($args[1]) {
-      $analysis = tripal_core_chado_select('analysis', array('name'), array('analysis_id' => $args[1]));
+      $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[1]));
       $new_args['Analysis'] = $analysis[0]->name;
     }
     else {
@@ -1028,9 +1028,9 @@ function tripal_feature_job_describe_args($callback, $args) {
   elseif ($callback == 'tripal_feature_load_gff3') {
 
     $new_args['GFF File'] = $args[0];
-    $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[1]));
+    $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[1]));
     $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
-    $analysis = tripal_core_chado_select('analysis', array('name'), array('analysis_id' => $args[2]));
+    $analysis = chado_select_record('analysis', array('name'), array('analysis_id' => $args[2]));
     $new_args['Analysis'] = $analysis[0]->name;
     $new_args['Use a Transaction'] = ($args[7] == 1) ? "Yes" : "No";
     $new_args['Import only new features'] = ($args[3] == 1) ? "Yes" : "No";
@@ -1038,7 +1038,7 @@ function tripal_feature_job_describe_args($callback, $args) {
     $new_args['Import all and replace'] = ($args[5] == 1) ? "Yes" : "No";
     $new_args['Delete features'] = ($args[6] == 1) ? "Yes" : "No";
     if ($args[8]) {
-      $target_organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[8]));
+      $target_organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[8]));
       $new_args['Target organism'] = $target_organism[0]->genus . " " . $target_organism[0]->species;
     }
     else {

+ 8 - 8
tripal_featuremap/api/tripal_featuremap.api.inc

@@ -22,7 +22,7 @@
  * @ingroup tripal_featuremap_api
  */
 function tripal_featuremap_get_property($featuremap_id, $property) {
-  return tripal_core_get_property('featuremap', $featuremap_id, $property, 'featuremap_property');
+  return chado_get_property('featuremap', $featuremap_id, $property, 'featuremap_property');
 }
 
 /**
@@ -43,7 +43,7 @@ function tripal_featuremap_get_property($featuremap_id, $property) {
  * @ingroup tripal_featuremap_api
  */
 function tripal_featuremap_insert_property($featuremap_id, $property, $value, $update_if_present = 0) {
-  return tripal_core_insert_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $update_if_present);
+  return chado_insert_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $update_if_present);
 }
 
 /**
@@ -67,7 +67,7 @@ function tripal_featuremap_insert_property($featuremap_id, $property, $value, $u
  * @ingroup tripal_featuremap_api
  */
 function tripal_featuremap_update_property($featuremap_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $insert_if_missing);
+  return chado_update_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -86,7 +86,7 @@ function tripal_featuremap_update_property($featuremap_id, $property, $value, $i
  * @ingroup tripal_featuremap_api
  */
 function tripal_featuremap_delete_property($featuremap_id, $property) {
-  return tripal_core_delete_property('featuremap', $featuremap_id, $property, 'featuremap_property');
+  return chado_delete_property('featuremap', $featuremap_id, $property, 'featuremap_property');
 }
 
 /*
@@ -116,7 +116,7 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
     'featuremap_id' => $featuremap_id,
   );
   $options = array('statement_name' => 'sel_featuremapdbxref_dbpu');
-  $results = tripal_core_chado_select('featuremap_dbxref', array('*'), $values, $options);
+  $results = chado_select_record('featuremap_dbxref', array('*'), $values, $options);
 
   // if the featuremap_dbxref record  exist then we don't need to re-add it.
   if(count($results) > 0) {
@@ -132,7 +132,7 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
     'db_id' => $db->db_id,
   );
   $dbxoptions = array('statement_name' => 'sel_dbxref_acdb');
-  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
+  $results = chado_select_record('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
   // if the accession doesn't exist then add it
   if(count($results) == 0){
     $dbxref = tripal_db_add_dbxref($db->db_id, $accession);
@@ -143,9 +143,9 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
 
   // now add the record
   $options = array('statement_name' => 'ins_featuremapdbxref_dbpu');
-  $results = tripal_core_chado_insert('featuremap_dbxref', $values, $options);
+  $results = chado_insert_record('featuremap_dbxref', $values, $options);
   if (!$results) {
-    tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Cannot add map dbxref: %db:%accession.",
+    tripal_report_error('t_featuremap', TRIPAL_ERROR, "Cannot add map dbxref: %db:%accession.",
       array('%db' => $dbname, '%accession' => $accession));
     return FALSE;
   }

+ 24 - 24
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -57,7 +57,7 @@ function chado_featuremap_form($node, &$form_state) {
   // if we are editing an existing node then the featuremap is already part of the node
   if (property_exists($node, 'featuremap')) {
     $featuremap = $node->featuremap;
-    $featuremap = tripal_core_expand_chado_vars($featuremap, 'field', 'featuremap.description');
+    $featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description');
     $featuremap_id = $featuremap->featuremap_id;
 
     // get form defaults
@@ -110,7 +110,7 @@ function chado_featuremap_form($node, &$form_state) {
   );
   $columns = array('cvterm_id','name');
   $options = array('order_by' => array('name' => 'ASC'));
-  $featuremap_units = tripal_core_chado_select('cvterm', $columns, $values, $options);
+  $featuremap_units = chado_select_record('cvterm', $columns, $values, $options);
   $units = array();
   $units[''] = '';
   foreach($featuremap_units as $unit) {
@@ -136,7 +136,7 @@ function chado_featuremap_form($node, &$form_state) {
     'fieldset_name' => 'Additional Details',
     'additional_instructions' => $instructions
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -146,7 +146,7 @@ function chado_featuremap_form($node, &$form_state) {
     'base_key_value' => $featuremap_id       // the value of featuremap_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   return $form;
 }
@@ -270,19 +270,19 @@ function chado_featuremap_insert($node) {
       'description' => $node->description,
       'unittype_id' => $node->unittype_id
     );
-    $featuremap = tripal_core_chado_insert('featuremap', $values);
+    $featuremap = chado_insert_record('featuremap', $values);
     if(!$featuremap) {
       drupal_set_message(t('Unable to add featuremap.', 'warning'));
-      tripal_core_report_error('tripal_featuremap', TRIPAL_WARNING, 'Unable to create feature map where values: %values',
+      tripal_report_error('tripal_featuremap', TRIPAL_WARNING, 'Unable to create feature map where values: %values',
       array('%values' => print_r($values, TRUE)));
       return;
     }
     $featuremap_id = $featuremap['featuremap_id'];
 
     // now add in the properties
-    $properties = chado_node_properties_form_retreive($node);
+    $properties = chado_retrieve_node_form_properties($node);
     // We need to deal with the 'Map Dbxref' property specially
-    $cvterm = tripal_core_chado_select(
+    $cvterm = chado_select_record(
       'cvterm',
       array('cvterm_id'),
       array('name' => 'Map Dbxref', 'cv_id' => array('name' => 'featuremap_property'))
@@ -293,7 +293,7 @@ function chado_featuremap_insert($node) {
         $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap_id, $value);
         if (!$featuremap_dbxref) {
           drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
-          tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
+          tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
           array('%ref' => $value));
         }
       }
@@ -305,7 +305,7 @@ function chado_featuremap_insert($node) {
       'foreignkey_name' => 'featuremap_id',
       'foreignkey_value' => $featuremap_id
     );
-    chado_node_properties_form_update_properties($node, $details, $properties);
+    chado_update_node_form_properties($node, $details, $properties);
 
     // * Additional DBxrefs Form *
     $details = array(
@@ -313,7 +313,7 @@ function chado_featuremap_insert($node) {
       'foreignkey_name' => 'featuremap_id',     // the name of the key in your base table
       'foreignkey_value' => $featuremap_id      // the value of the featuremap_id key
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
 
   }
   else {
@@ -322,7 +322,7 @@ function chado_featuremap_insert($node) {
 
   // Make sure the entry for this featuremap doesn't already exist in the
   // chado_featuremap table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('featuremap', $node->nid);
+  $check_org_id = chado_get_id_from_nid('featuremap', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -341,7 +341,7 @@ function chado_featuremap_update($node) {
   $node->fmapname          = trim($node->fmapname);
   $node->description    = trim($node->description);
 
-  $featuremap_id = chado_get_id_for_node('featuremap', $node->nid) ;
+  $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid) ;
 
   // update the map record
   $match = array(
@@ -352,17 +352,17 @@ function chado_featuremap_update($node) {
     'description' => $node->description,
     'unittype_id' => $node->unittype_id
   );
-  $status = tripal_core_chado_update('featuremap', $match, $values);
+  $status = chado_update_record('featuremap', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating map", "error");
-    tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error updating map", array());
+    tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error updating map", array());
     return;
   }
 
   // Update the properties
-  $properties = chado_node_properties_form_retreive($node);
+  $properties = chado_retrieve_node_form_properties($node);
   // We need to deal with the 'Map Dbxref' property specially
-  $cvterm = tripal_core_chado_select(
+  $cvterm = chado_select_record(
     'cvterm',
     array('cvterm_id'),
     array('name' => 'Map Dbxref', 'cv_id' => array('name' => 'featuremap_property'))
@@ -373,7 +373,7 @@ function chado_featuremap_update($node) {
       $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap_id, $value);
       if (!$featuremap_dbxref) {
         drupal_set_message("Error cannot add featuremap cross reference: $value", "error");
-        tripal_core_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
+        tripal_report_error('t_featuremap', TRIPAL_ERROR, "Error cannot add featuremap cross reference: %ref",
         array('%ref' => $value));
       }
     }
@@ -385,7 +385,7 @@ function chado_featuremap_update($node) {
     'foreignkey_name' => 'featuremap_id',
     'foreignkey_value' => $featuremap_id
   );
-  chado_node_properties_form_update_properties($node, $details, $properties);
+  chado_update_node_form_properties($node, $details, $properties);
 
   // * Additional DBxrefs Form *
   $details = array(
@@ -393,7 +393,7 @@ function chado_featuremap_update($node) {
     'foreignkey_name' => 'featuremap_id',     // the name of the key in your base table
     'foreignkey_value' => $featuremap_id      // the value of the featuremap_id key
   );
-  chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+  chado_update_node_form_dbxrefs($node, $details);
 
 }
 /**
@@ -405,13 +405,13 @@ function chado_featuremap_update($node) {
 function chado_featuremap_load($nodes) {
   foreach ($nodes as $nid => $node) {
     // get the feature details from chado
-    $featuremap_id = chado_get_id_for_node('featuremap', $node->nid);
+    $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid);
 
     $values = array('featuremap_id' => $featuremap_id);
-    $featuremap = tripal_core_generate_chado_var('featuremap', $values);
+    $featuremap = chado_generate_var('featuremap', $values);
 
     // expand the description field as it is needed by the form
-    $featuremap = tripal_core_expand_chado_vars($featuremap, 'field', 'featuremap.description');
+    $featuremap = chado_expand_var($featuremap, 'field', 'featuremap.description');
 
     $nodes[$nid]->featuremap = $featuremap;
   }
@@ -423,7 +423,7 @@ function chado_featuremap_load($nodes) {
  */
 function chado_featuremap_delete(&$node) {
 
-  $featuremap_id = chado_get_id_for_node('featuremap', $node->nid);
+  $featuremap_id = chado_get_id_from_nid('featuremap', $node->nid);
 
   // if we don't have a map id for this node then this isn't a node of
   // type chado_featuremap or the entry in the chado_featuremap table was lost.

+ 4 - 4
tripal_featuremap/tripal_featuremap.install

@@ -43,7 +43,7 @@ function tripal_featuremap_requirements($phase) {
  */
 function tripal_featuremap_install() {
   // create the module's data directory
-  tripal_create_moddir('tripal_featuremap');
+  tripal_create_files_dir('tripal_featuremap');
 
   // add the featuremapprop table to Chado
   tripal_featuremap_add_custom_tables();
@@ -303,7 +303,7 @@ function tripal_featuremap_add_custom_tables(){
       ),
     ),
   );
-  tripal_core_create_custom_table('featuremapprop', $schema, TRUE);
+  chado_create_custom_table('featuremapprop', $schema, TRUE);
 
   // add the featuremap_dbxref table to Chado
   $schema = array (
@@ -355,7 +355,7 @@ function tripal_featuremap_add_custom_tables(){
     ),
     'referring_tables' => NULL,
   );
-  tripal_core_create_custom_table('featuremap_dbxref', $schema, TRUE);
+  chado_create_custom_table('featuremap_dbxref', $schema, TRUE);
 
   $schema = array (
     'table' => 'featureposprop',
@@ -415,5 +415,5 @@ function tripal_featuremap_add_custom_tables(){
       ),
     ),
   );
-  tripal_core_create_custom_table('featureposprop', $schema, TRUE);
+  chado_create_custom_table('featureposprop', $schema, TRUE);
 }

+ 4 - 4
tripal_library/api/tripal_library.api.inc

@@ -21,7 +21,7 @@
  * @ingroup tripal_library_api
  */
 function tripal_library_get_property($library_id, $property) {
-  return tripal_core_get_property('library', $library_id, $property, 'library_property');
+  return chado_get_property('library', $library_id, $property, 'library_property');
 }
 
 /**
@@ -42,7 +42,7 @@ function tripal_library_get_property($library_id, $property) {
  * @ingroup tripal_library_api
  */
 function tripal_library_insert_property($library_id, $property, $value, $update_if_present = 0) {
-  return tripal_core_insert_property('library', $library_id, $property, 'library_property', $value, $update_if_present);
+  return chado_insert_property('library', $library_id, $property, 'library_property', $value, $update_if_present);
 }
 
 /**
@@ -66,7 +66,7 @@ function tripal_library_insert_property($library_id, $property, $value, $update_
  * @ingroup tripal_library_api
  */
 function tripal_library_update_property($library_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('library', $library_id, $property, 'library_property', $value, $insert_if_missing);
+  return chado_update_property('library', $library_id, $property, 'library_property', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -85,5 +85,5 @@ function tripal_library_update_property($library_id, $property, $value, $insert_
  * @ingroup tripal_library_api
  */
 function tripal_library_delete_property($library_id, $property) {
-  return tripal_core_delete_property('library', $library_id, $property, 'library_property');
+  return chado_delete_property('library', $library_id, $property, 'library_property');
 }

+ 18 - 18
tripal_library/includes/tripal_library.chado_node.inc

@@ -120,7 +120,7 @@ function chado_library_form($node, &$form_state) {
   );
   $columns = array('cvterm_id','name');
   $options = array('order_by' => array('name' => 'ASC'));
-  $lib_types = tripal_core_chado_select('cvterm', $columns, $values, $options);
+  $lib_types = chado_select_record('cvterm', $columns, $values, $options);
   $types = array();
   $types[''] = '';
   foreach($lib_types as $type) {
@@ -168,7 +168,7 @@ function chado_library_form($node, &$form_state) {
   //---------------------------------------------
   // Generate our own select list so we can desclude the description since it has it's
   // own form element above
-  $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'library_property'));
+  $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'library_property'));
   $cv_id = $cv_result[0]->cv_id;
   $select_options = tripal_cv_get_cvterm_options($cv_id);
   $descrip_id = array_search('Library Description', $select_options);
@@ -182,7 +182,7 @@ function chado_library_form($node, &$form_state) {
     'select_options' => $select_options
   );
   // Adds the form elements to your current form
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -192,7 +192,7 @@ function chado_library_form($node, &$form_state) {
     'base_key_value' => $library_id       // the value of library_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   return $form;
 }
@@ -249,7 +249,7 @@ function chado_library_insert($node) {
       'organism_id' => $node->organism_id,
       'type_id' => $node->library_type,
     );
-    $library = tripal_core_chado_insert('library', $values);
+    $library = chado_insert_record('library', $values);
     if (!$library) {
       drupal_set_message(t('Unable to add library.', 'warning'));
       watchdog('tripal_library', 'Insert library: Unable to create library where values: %values',
@@ -260,7 +260,7 @@ function chado_library_insert($node) {
 
     // * Properties Form *
     // add the description property
-    $properties = chado_node_properties_form_retreive($node);
+    $properties = chado_retrieve_node_form_properties($node);
     $descrip_id = tripal_cv_get_cvterm_by_name('Library Description', NULL, 'library_property');
     $properties[$descrip_id->cvterm_id][0] = $node->description;
 
@@ -270,7 +270,7 @@ function chado_library_insert($node) {
       'foreignkey_name' => 'library_id',   // the name of the key in your base table
       'foreignkey_value' => $library_id    // the value of the library_id key
     );
-    chado_node_properties_form_update_properties($node, $details, $properties);
+    chado_update_node_form_properties($node, $details, $properties);
 
     // * Additional DBxrefs Form *
     $details = array(
@@ -278,7 +278,7 @@ function chado_library_insert($node) {
       'foreignkey_name' => 'library_id',     // the name of the key in your base table
       'foreignkey_value' => $library_id      // the value of the library_id key
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
 
   }
   else {
@@ -287,7 +287,7 @@ function chado_library_insert($node) {
 
   // Make sure the entry for this library doesn't already exist in the
   // chado_library table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('library', $node->nid);
+  $check_org_id = chado_get_id_from_nid('library', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -308,7 +308,7 @@ function chado_library_update($node) {
   $node->description = trim($node->description);
 
   // update the library record
-  $library_id = chado_get_id_for_node('library', $node->nid);
+  $library_id = chado_get_id_from_nid('library', $node->nid);
   $match = array(
     'library_id' => $library_id,
   );
@@ -319,7 +319,7 @@ function chado_library_update($node) {
     'organism_id' => $node->organism_id,
     'type_id'     => $node->library_type,
   );
-  $status = tripal_core_chado_update('library', $match, $values);
+  $status = chado_update_record('library', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update library.', 'warning'));
     watchdog('tripal_library', 'Update library: Unable to update library where values: %values',
@@ -328,7 +328,7 @@ function chado_library_update($node) {
 
   // * Properties Form *
   // add the description property
-  $properties = chado_node_properties_form_retreive($node);
+  $properties = chado_retrieve_node_form_properties($node);
   $descrip_id = tripal_cv_get_cvterm_by_name('Library Description', NULL, 'library_property');
   $properties[$descrip_id->cvterm_id][0] = $node->description;
 
@@ -338,7 +338,7 @@ function chado_library_update($node) {
     'foreignkey_name' => 'library_id',   // the name of the key in your base table
     'foreignkey_value' => $library_id    // the value of the library_id key
   );
-  chado_node_properties_form_update_properties($node, $details, $properties);
+  chado_update_node_form_properties($node, $details, $properties);
 
   // * Additional DBxrefs Form *
   $details = array(
@@ -346,7 +346,7 @@ function chado_library_update($node) {
     'foreignkey_name' => 'library_id',     // the name of the key in your base table
     'foreignkey_value' => $library_id      // the value of the library_id key
   );
-  chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+  chado_update_node_form_dbxrefs($node, $details);
 
 }
 /**
@@ -359,13 +359,13 @@ function chado_library_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // get the feature details from chado
-    $library_id = chado_get_id_for_node('library', $node->nid);
+    $library_id = chado_get_id_from_nid('library', $node->nid);
 
     $values = array('library_id' => $library_id);
-    $library = tripal_core_generate_chado_var('library', $values);
+    $library = chado_generate_var('library', $values);
 
     // the uniquename field is a text field so we need to expand it
-    $library = tripal_core_expand_chado_vars($library, 'field', 'library.uniquename');
+    $library = chado_expand_var($library, 'field', 'library.uniquename');
 
     $nodes[$nid]->library = $library;
   }
@@ -377,7 +377,7 @@ function chado_library_load($nodes) {
  */
 function chado_library_delete(&$node) {
 
-  $library_id = chado_get_id_for_node('library', $node->nid);
+  $library_id = chado_get_id_from_nid('library', $node->nid);
 
   // if we don't have a library id for this node then this isn't a node of
   // type chado_library or the entry in the chado_library table was lost.

+ 3 - 3
tripal_library/tripal_library.install

@@ -43,7 +43,7 @@ function tripal_library_requirements($phase) {
 function tripal_library_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_library');
+  tripal_create_files_dir('tripal_library');
 
   // add the materialized view
   tripal_library_add_mview_library_feature_count();
@@ -237,7 +237,7 @@ function tripal_library_update_7000() {
   $values = array(
     'name' => 'library_type'
   );
-  $success = tripal_core_chado_update('cv', $match, $values);
+  $success = chado_update_record('cv', $match, $values);
   if (!$success) {
     throw new DrupalUpdateException('Failed to rename tripal_library_types CV.');
   }
@@ -257,7 +257,7 @@ function tripal_library_update_7000() {
     'cv_id' => $cv->cv_id,
     'name' => 'Library Description',
   );
-  tripal_core_chado_update('cvterm', $match, $values);
+  chado_update_record('cvterm', $match, $values);
   if (!$success) {
     throw new DrupalUpdateException('Failed to move library properties to new library_property CV.');
   }

+ 1 - 1
tripal_natural_diversity/tripal_natural_diversity.install

@@ -42,7 +42,7 @@ function tripal_natural_diversity_requirements($phase) {
 function tripal_natural_diversity_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_natural_diversity');
+  tripal_create_files_dir('tripal_natural_diversity');
 
   // add cvterms
   tripal_natural_diversity_add_cvterms();

+ 1 - 1
tripal_organism/api/tripal_organism.api.inc

@@ -81,7 +81,7 @@ function tripal_organism_get_image_url($organism, $nid = NULL) {
   // then look for the image with the node ID in the name. If we don't find that then
   // no image tag is generated
   $base_path = realpath('.');
-  $image_dir = tripal_get_moddir('tripal_organism') . "/images";
+  $image_dir = tripal_get_files_dir('tripal_organism') . "/images";
   $image_name =  $organism->genus . "_" . $organism->species . ".jpg";
 
   if (file_exists("$base_path/$image_dir/$image_name")) {

+ 2 - 2
tripal_organism/includes/tripal_organism.admin.inc

@@ -124,7 +124,7 @@ function tripal_organism_reindex_features($organism_id = NULL, $job_id = NULL) {
   foreach ($ids as $feature_id) {
     // update the job status every 1% features
     if ($job_id and $i % $interval == 0) {
-      tripal_job_set_progress($job_id , intval(($i/$count)*100));
+      tripal_set_job_progress($job_id , intval(($i/$count)*100));
     }
     $i++;
   }
@@ -169,7 +169,7 @@ function tripal_organism_taxonify_features($organism_id = NULL, $job_id = NULL)
   foreach ($ids as $feature_id) {
     // update the job status every 1% features
     if ($job_id and $i % $interval == 0) {
-      tripal_job_set_progress($job_id, intval(($i/$count)*100));
+      tripal_set_job_progress($job_id, intval(($i/$count)*100));
     }
     $node = db_query($nsql, array(':feature_id' => $feature_id))->fetchObject();
     tripal_feature_set_taxonomy($node, $feature_id);

+ 22 - 21
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -122,7 +122,7 @@ function chado_organism_validate($node, $form, &$form_state) {
     if ($result) {
       form_set_error('genus', t("Update cannot proceed. The organism genus
         '$node->genus' and species '$node->species' is already present in the database."));
-      tripal_core_report_error('tripal_organism', TRIPAL_WARNING,
+      tripal_report_error('tripal_organism', TRIPAL_WARNING,
         'Update organism: genus and species already exists: %values',
         array('%values' => "genus = $node->genus, species = $node->species"));
     }
@@ -133,11 +133,11 @@ function chado_organism_validate($node, $form, &$form_state) {
       'genus' => $node->genus,
       'species' => $node->species,
     );
-    $organism = tripal_core_chado_select('organism', array('organism_id'), $values);
+    $organism = chado_select_record('organism', array('organism_id'), $values);
     if (sizeof($organism) > 0) {
       form_set_error('genus', 'Cannot add the organism with this genus and species.
         The organism already exists.');
-      tripal_core_report_error('tripal_organism', TRIPAL_WARNING,
+      tripal_report_error('tripal_organism', TRIPAL_WARNING,
         'Insert organism: genus and species already exists: %values',
         array('%values' => "genus = $node->genus, species = $node->species"));
     }
@@ -169,10 +169,10 @@ function chado_organism_insert($node) {
       'common_name'  => $node->common_name,
       'comment'      => $node->description
     );
-    $organism = tripal_core_chado_insert('organism', $values);
+    $organism = chado_insert_record('organism', $values);
     if (!$organism) {
       drupal_set_message(t('Unable to add organism.', 'warning'));
-      tripal_core_report_error('tripal_organism', TRIPAL_ERROR, 'Insert Organism: Unable to create organism where values:%values',
+      tripal_report_error('tripal_organism', TRIPAL_ERROR, 'Insert Organism: Unable to create organism where values:%values',
       array('%values' => print_r($values, TRUE)));
       return;
     }
@@ -186,7 +186,7 @@ function chado_organism_insert($node) {
         'foreignkey_name' => 'organism_id',   // the name of the key in your base table
         'foreignkey_value' => $organism_id    // the value of the example_id key
       );
-      chado_node_properties_form_update_properties($node, $details);
+      chado_update_node_form_properties($node, $details);
 
       // * Additional DBxrefs Form *
       $details = array(
@@ -194,7 +194,7 @@ function chado_organism_insert($node) {
         'foreignkey_name' => 'organism_id',     // the name of the key in your base table
         'foreignkey_value' => $organism_id      // the value of the organism_id key
       );
-      chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+      chado_update_node_form_dbxrefs($node, $details);
 
     }
   }
@@ -204,7 +204,7 @@ function chado_organism_insert($node) {
 
   // Make sure the entry for this organism doesn't already exist in the
   // chado_organism table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('organism', $node->nid);
+  $check_org_id = chado_get_id_from_nid('organism', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -229,7 +229,7 @@ function chado_organism_update($node) {
   $node->common_name  = trim($node->common_name);
   $node->description  = trim($node->description);
 
-  $organism_id = chado_get_id_for_node('organism', $node->nid);
+  $organism_id = chado_get_id_from_nid('organism', $node->nid);
 
   if ($node->revision) {
     // there is no way to handle revisions in Chado but leave
@@ -245,7 +245,7 @@ function chado_organism_update($node) {
     'common_name' => $node->common_name,
     'comment' => $node->description
   );
-  $org_status = tripal_core_chado_update('organism', $match, $values);
+  $org_status = chado_update_record('organism', $match, $values);
 
   // add the image
   chado_organism_add_image($node);
@@ -257,7 +257,7 @@ function chado_organism_update($node) {
     'foreignkey_name' => 'organism_id',   // the name of the key in your base table
     'foreignkey_value' => $organism_id    // the value of the example_id key
   );
-  chado_node_properties_form_update_properties($node, $details);
+  chado_update_node_form_properties($node, $details);
 
   // * Additional DBxrefs Form *
   $details = array(
@@ -265,7 +265,7 @@ function chado_organism_update($node) {
     'foreignkey_name' => 'organism_id',     // the name of the key in your base table
     'foreignkey_value' => $organism_id      // the value of the organism_id key
   );
-  chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+  chado_update_node_form_dbxrefs($node, $details);
 }
 /**
  * Delete organism from both drupal and chado databases. Check dependency before
@@ -274,7 +274,7 @@ function chado_organism_update($node) {
  * @ingroup tripal_organism
  */
 function chado_organism_delete($node) {
-  $organism_id = chado_get_id_for_node('organism', $node->nid);
+  $organism_id = chado_get_id_from_nid('organism', $node->nid);
 
   // if we don't have an organism id for this node then this isn't a node of
   // type chado_organism or the entry in the chado_organism table was lost.
@@ -301,7 +301,7 @@ function chado_organism_delete($node) {
   $check_stock = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
 
   if (!$check_lib && !$check_feature && !$check_stock) {
-    tripal_core_chado_delete('organism', array('organism_id' => $organism_id));
+    chado_delete_record('organism', array('organism_id' => $organism_id));
   }
   else {
     drupal_set_message(t("Warning: other data depends on this organism. The organism page was removed from this site but the organism was removed from Chado."), 'warning');
@@ -321,7 +321,7 @@ function chado_organism_add_image($node) {
   is_uploaded_file($_FILES['files']['tmp_name']['organism_image'])) {
 
     // make sure the destination directory exists
-    $dest = tripal_file_directory_path() . "/tripal_organism/images";
+    $dest = tripal_get_files_dir() . "/tripal_organism/images";
     file_prepare_directory($dest, FILE_CREATE_DIRECTORY);
 
     // now move the file
@@ -355,7 +355,7 @@ function chado_organism_form($node, $form_state) {
     $organism = $node->organism;
 
     // add in the comment since it is a text field and may not be included if too big
-    $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');
+    $organism = chado_expand_var($organism, 'field', 'organism.comment');
 
     // get form defaults
     $abbreviation   = property_exists($node, 'abbreviation')   ? property_exists($node, 'abbreviation')   : $organism->abbreviation;
@@ -430,7 +430,7 @@ function chado_organism_form($node, $form_state) {
     'cv_name' => 'organism_property'         // the cv.name of the cv governing organismprop.type_id
   );
   // Adds the form elements to your current form
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -440,7 +440,7 @@ function chado_organism_form($node, $form_state) {
     'base_key_value' => $organism_id       // the value of organism_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   return $form;
 }
@@ -455,15 +455,15 @@ function chado_organism_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // find the organism and add in the details
-    $organism_id = chado_get_id_for_node('organism', $nid);
+    $organism_id = chado_get_id_from_nid('organism', $nid);
 
     // build the organism variable
     $values = array('organism_id' => $organism_id);
-    $organism = tripal_core_generate_chado_var('organism', $values);
+    $organism = chado_generate_var('organism', $values);
 
 
     // add in the description field
-    $organism = tripal_core_expand_chado_vars($organism, 'field', 'organism.comment');
+    $organism = chado_expand_var($organism, 'field', 'organism.comment');
     $nodes[$nid]->organism = $organism;
   }
 }
@@ -473,6 +473,7 @@ function chado_organism_load($nodes) {
  * @param $node
  */
 function tripal_organism_node_presave($node) {
+ print_r($node->organism);
   switch ($node->type) {
     case 'chado_organism':
       // for a form submission the 'genus' field will be set,

+ 2 - 2
tripal_organism/tripal_organism.install

@@ -27,10 +27,10 @@ function tripal_organism_disable() {
 function tripal_organism_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_organism');
+  tripal_create_files_dir('tripal_organism');
 
   // create the directory where image files will be stored.  We create this
-  tripal_create_mod_subdir('tripal_organism', '/images');
+  tripal_create_files_dir('tripal_organism', '/images');
 
   // cvs & cvterms
   tripal_organism_add_cvs();

+ 1 - 1
tripal_organism/tripal_organism.module

@@ -226,7 +226,7 @@ function tripal_organism_job_describe_args($callback, $args) {
 
   $new_args = array();
   if ($callback == 'tripal_organism_sync_organisms') {
-    $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[0]));
+    $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $args[0]));
     $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
   }
   return $new_args;

+ 4 - 4
tripal_project/api/tripal_project.api.inc

@@ -26,7 +26,7 @@
  * @ingroup tripal_project_api
  */
 function tripal_project_get_property($project_id, $property) {
-  return tripal_core_get_property('project', $project_id, $property, 'project_property');
+  return chado_get_property('project', $project_id, $property, 'project_property');
 }
 
 /**
@@ -47,7 +47,7 @@ function tripal_project_get_property($project_id, $property) {
  * @ingroup tripal_project_api
  */
 function tripal_project_insert_property($project_id, $property, $value, $update_if_present = 0) {
-  return tripal_core_insert_property('project', $project_id, $property, 'project_property', $value, $update_if_present);
+  return chado_insert_property('project', $project_id, $property, 'project_property', $value, $update_if_present);
 }
 
 /**
@@ -71,7 +71,7 @@ function tripal_project_insert_property($project_id, $property, $value, $update_
  * @ingroup tripal_project_api
  */
 function tripal_project_update_property($project_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('project', $project_id, $property, 'project_property', $value, $insert_if_missing);
+  return chado_update_property('project', $project_id, $property, 'project_property', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -90,5 +90,5 @@ function tripal_project_update_property($project_id, $property, $value, $insert_
  * @ingroup tripal_project_api
  */
 function tripal_project_delete_property($project_id, $property) {
-  return tripal_core_delete_property('project', $project_id, $property, 'project_property');
+  return chado_delete_property('project', $project_id, $property, 'project_property');
 }

+ 18 - 18
tripal_project/includes/tripal_project.chado_node.inc

@@ -139,7 +139,7 @@ function chado_project_form(&$node, $form_state) {
   // because we want to use the property to replace the project.description field as it is
   // only 255 characters which isn't large enough. We don't want the user to set it
   // as a property even though it will be stored as a property.
-  $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'project_property'));
+  $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'project_property'));
   $cv_id = $cv_result[0]->cv_id;
   $select_options = tripal_cv_get_cvterm_options($cv_id);
   $descrip_id = array_search('Project Description', $select_options);
@@ -154,17 +154,17 @@ function chado_project_form(&$node, $form_state) {
     'additional_instructions' => $instructions,
     'select_options' => $select_options
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
   // We want to use the contact_relationship_types cv if there are any terms available
   // and if not, to default to the relationship ontology
-  $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'project_relationship_types'));
+  $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'project_relationship_types'));
   $cv_id = $cv_result[0]->cv_id;
   $select_options = tripal_cv_get_cvterm_options($cv_id);
   if (empty($select_options)) {
-    $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'relationship'));
+    $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'relationship'));
     $cv_id = $cv_result[0]->cv_id;
     $select_options = tripal_cv_get_cvterm_options($cv_id);
   }
@@ -183,7 +183,7 @@ function chado_project_form(&$node, $form_state) {
     'select_options' => $select_options
   );
   // Adds the form elements to your current form
-  chado_node_relationships_form($form, $form_state, $details);
+  chado_add_node_form_relationships($form, $form_state, $details);
 
   return $form;
 
@@ -246,7 +246,7 @@ function chado_project_insert($node) {
       'name' => $node->title,
       'description' => '',
     );
-    $project = tripal_core_chado_insert('project', $values);
+    $project = chado_insert_record('project', $values);
     if (!$project) {
       drupal_set_message(t('Unable to add project.', 'warning'));
       watchdog('tripal_project', 'Insert project: Unable to create project where values:%values',
@@ -257,7 +257,7 @@ function chado_project_insert($node) {
 
     // * Properties Form *
     // Add the description property
-    $properties = chado_node_properties_form_retreive($node);
+    $properties = chado_retrieve_node_form_properties($node);
     $descrip_id = tripal_cv_get_cvterm_by_name('Project Description', NULL, 'project_property');
     $properties[$descrip_id->cvterm_id][0] = $node->description;
 
@@ -267,14 +267,14 @@ function chado_project_insert($node) {
       'foreignkey_name' => 'project_id',
       'foreignkey_value' => $project_id
     );
-    chado_node_properties_form_update_properties($node, $details, $properties);
+    chado_update_node_form_properties($node, $details, $properties);
 
     // * Relationships Form *
     $details = array(
       'relationship_table' => 'project_relationship',  // name of the _relationship table
       'foreignkey_value' => $project_id                // value of the example_id key
     );
-    chado_node_relationships_form_update_relationships($node, $details);
+    chado_update_node_form_relationships($node, $details);
 
   }
   else {
@@ -283,7 +283,7 @@ function chado_project_insert($node) {
 
   // Make sure the entry for this project doesn't already exist in the
   // chado_project table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('project', $node->nid);
+  $check_org_id = chado_get_id_from_nid('project', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -306,7 +306,7 @@ function chado_project_insert($node) {
  */
 function chado_project_delete($node) {
 
-  $project_id = chado_get_id_for_node('project', $node->nid);
+  $project_id = chado_get_id_from_nid('project', $node->nid);
 
   // if we don't have a project id for this node then this isn't a node of
   // type chado_project or the entry in the chado_project table was lost.
@@ -344,13 +344,13 @@ function chado_project_update($node) {
   $node->description = trim($node->description);
 
   // update the project and the description
-  $project_id = chado_get_id_for_node('project', $node->nid) ;
+  $project_id = chado_get_id_from_nid('project', $node->nid) ;
   $match = array('project_id' => $project_id);
   $values = array(
     'name' => $node->title,
     'description' => '',
   );
-  $status = tripal_core_chado_update('project', $match, $values);
+  $status = chado_update_record('project', $match, $values);
   if (!$status) {
     drupal_set_message(t('Unable to update project.', 'warning'));
     watchdog('tripal_project', 'Update project: Unable to update project where values: %values',
@@ -359,7 +359,7 @@ function chado_project_update($node) {
 
   // * Properties Form *
   // Add the description property
-  $properties = chado_node_properties_form_retreive($node);
+  $properties = chado_retrieve_node_form_properties($node);
   $descrip_id = tripal_cv_get_cvterm_by_name('Project Description', NULL, 'project_property');
   $properties[$descrip_id->cvterm_id][0] = $node->description;
 
@@ -369,14 +369,14 @@ function chado_project_update($node) {
     'foreignkey_name' => 'project_id',
     'foreignkey_value' => $project_id
   );
-  chado_node_properties_form_update_properties($node, $details, $properties);
+  chado_update_node_form_properties($node, $details, $properties);
 
   // * Relationships Form *
   $details = array(
     'relationship_table' => 'project_relationship',  // name of the _relationship table
     'foreignkey_value' => $project_id                // value of the example_id key
   );
-  chado_node_relationships_form_update_relationships($node, $details);
+  chado_update_node_form_relationships($node, $details);
 }
 
 /**
@@ -395,10 +395,10 @@ function chado_project_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // get the feature details from chado
-    $project_id = chado_get_id_for_node('project', $node->nid);
+    $project_id = chado_get_id_from_nid('project', $node->nid);
 
     $values = array('project_id' => $project_id);
-    $project = tripal_core_generate_chado_var('project', $values);
+    $project = chado_generate_var('project', $values);
 
     $nodes[$nid]->project = $project;
   }

+ 1 - 1
tripal_project/theme/tripal_project.theme.inc

@@ -18,7 +18,7 @@ function tripal_project_preprocess_tripal_project_relationships(&$variables) {
       'subject_project_id' => 1,
     ),
   );
-  $project = tripal_core_expand_chado_vars($project, 'table', 'project_relationship', $options);
+  $project = chado_expand_var($project, 'table', 'project_relationship', $options);
   
   // get the subject relationships
   $srelationships = $project->project_relationship->subject_project_id;

+ 2 - 2
tripal_project/tripal_project.install

@@ -48,7 +48,7 @@ function tripal_project_requirements($phase) {
 function tripal_project_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_project');
+  tripal_create_files_dir('tripal_project');
 
   tripal_project_add_cvs();
   tripal_project_add_cvterms();
@@ -149,7 +149,7 @@ function tripal_project_update_7000() {
   $values = array(
     'name'  => 'Project Description',
   );
-  tripal_core_chado_update('cvterm', $match, $values);
+  chado_update_record('cvterm', $match, $values);
   if (!$success) {
     throw new DrupalUpdateException('Failed to move project properties to new project_property CV.');
   }

+ 42 - 42
tripal_pub/api/tripal_pub.api.inc

@@ -232,7 +232,7 @@ function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL)
       print "Syncing contacts with Drupal...\n";
       tripal_contact_sync_contacts();
     }
-    tripal_job_set_progress($job_id, '100');
+    tripal_set_job_progress($job_id, '100');
   }
   catch (Exception $e) {
     print "\n"; // make sure we start errors on new line
@@ -466,7 +466,7 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
     'pub_id' => $pub_id,
   );
   $options = array('statement_name' => 'sel_pubdbxref_dbpu');
-  $results = tripal_core_chado_select('pub_dbxref', array('*'), $values, $options);
+  $results = chado_select_record('pub_dbxref', array('*'), $values, $options);
 
   // if the pub_dbxref record  exist then we don't need to re-add it.
   if(count($results) > 0) {
@@ -482,7 +482,7 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
     'db_id' => $db->db_id,
   );
   $dbxoptions = array('statement_name' => 'sel_dbxref_acdb');
-  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
+  $results = chado_select_record('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
   // if the accession doesn't exist then add it
   if(count($results) == 0){
     $dbxref = tripal_db_add_dbxref($db->db_id, $accession);
@@ -493,9 +493,9 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
 
   // now add the record
   $options = array('statement_name' => 'ins_pubdbxref_dbpu');
-  $results = tripal_core_chado_insert('pub_dbxref', $values, $options);
+  $results = chado_insert_record('pub_dbxref', $values, $options);
   if (!$results) {
-    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add publication dbxref: %db:%accession.",
+    tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add publication dbxref: %db:%accession.",
     array('%db' => $dbname, '%accession' => $accession));
     return FALSE;
   }
@@ -535,7 +535,7 @@ function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
     ),
     );
     $options = array('statement_name' => 'sel_pubdbxref_db');
-    $results = tripal_core_chado_select('pub_dbxref', array('pub_id'), $values, $options);
+    $results = chado_select_record('pub_dbxref', array('pub_id'), $values, $options);
     foreach ($results as $index => $pub) {
       $return[] = $pub->pub_id;
     }
@@ -593,7 +593,7 @@ function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $p
     'statement_name' => 'sel_pub_' . $stmnt_suffix,
     'case_insensitive_columns' => array('title', 'series_name'),
   );
-  $results = tripal_core_chado_select('pub', array('pub_id'), $values, $options);
+  $results = chado_select_record('pub', array('pub_id'), $values, $options);
 
   // iterate through any matches and pull out the pub_id
   foreach ($results as $index => $pub) {
@@ -634,7 +634,7 @@ function tripal_pub_get_pub_by_uniquename($name) {
     'statement_name' => 'sel_pub_un',
     'case_insensitive_columns' => array('uniquename'),
   );
-  $results = tripal_core_chado_select('pub', array('pub_id'), $values, $options);
+  $results = chado_select_record('pub', array('pub_id'), $values, $options);
 
   // iterate through any matches and pull out the pub_id
   foreach ($results as $index => $pub) {
@@ -692,7 +692,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
       }
     }
     elseif (count($results) > 1) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
       array('%db' => $dbname, '%accession' => $accession));
       $action = 'error';
       return FALSE;
@@ -708,7 +708,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     if (count($results) == 1) {
       $pub_id = $results[0];
       if ($pub_id and !$update_if_exists) {
-        tripal_core_report_error('tripal_pub', TRIPAL_WARNING, "The publication with the same title, type and year already exists. Skipping. ".
+        tripal_report_error('tripal_pub', TRIPAL_WARNING, "The publication with the same title, type and year already exists. Skipping. ".
           " Title: '%title'. Type: '%type'. Year: '%year'",
           array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']));
         $action = 'skipped';
@@ -716,7 +716,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
       }
     }
     elseif (count($results) > 1) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "The publication with the same title, type and year is present multiple times. Cannot ".
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "The publication with the same title, type and year is present multiple times. Cannot ".
         "determine which to use.  Title: '%title'. Type: '%type'. Year: '%year'",
       array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']));
       $action = 'error';
@@ -733,12 +733,12 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     }
   }
   else {
-    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "The Publication Type is a required property but is missing", array());
+    tripal_report_error('tripal_pub', TRIPAL_ERROR, "The Publication Type is a required property but is missing", array());
     $action = 'error';
     return FALSE;
   }
   if (!$pub_type) {
-    tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find publication type: '%type'",
+    tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find publication type: '%type'",
     array('%type' => $pub_details['Publication Type'][0]));
     $action = 'error';
     return FALSE;
@@ -759,9 +759,9 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
   // if there is no pub_id then we need to do an insert.
   if (!$pub_id) {
     $options = array('statement_name' => 'ins_pub_tivoseispypaunty');
-    $pub = tripal_core_chado_insert('pub', $values, $options);
+    $pub = chado_insert_record('pub', $values, $options);
     if (!$pub) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot insert the publication with title: %title",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot insert the publication with title: %title",
       array('%title' => $pub_details['Title']));
       $action = 'error';
       return FALSE;
@@ -774,9 +774,9 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
   if ($pub_id and $update_if_exists) {
     $match = array('pub_id' => $pub_id);
     $options = array('statement_name' => 'up_pub_tivoseispypaunty');
-    $success = tripal_core_chado_update('pub', $match, $values, $options);
+    $success = chado_update_record('pub', $match, $values, $options);
     if (!$success) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot update the publication with title: %title",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot update the publication with title: %title",
       array('%title' => $pub_details['Title']));
       $action = 'error';
       return FALSE;
@@ -812,7 +812,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
       $cvterm = tripal_cv_get_cvterm_by_synonym($key, NULL, 'tripal_pub');
     }
     if (!$cvterm) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find term: '%prop'. Skipping.", array('%prop' => $key));
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot find term: '%prop'. Skipping.", array('%prop' => $key));
       continue;
     }
 
@@ -832,18 +832,18 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
         // if the key is an integer then this array is a simple list and
         // we will insert using the primary key. Otheriwse, use the new key
         if(is_int($subkey)) {
-          $success = tripal_core_insert_property('pub', $pub_id, $key, 'tripal_pub', $subvalue, FALSE);
+          $success = chado_insert_property('pub', $pub_id, $key, 'tripal_pub', $subvalue, FALSE);
         }
         else {
-          $success = tripal_core_insert_property('pub', $pub_id, $subkey, 'tripal_pub', $subvalue, FALSE);
+          $success = chado_insert_property('pub', $pub_id, $subkey, 'tripal_pub', $subvalue, FALSE);
         }
       }
     }
     else {
-      $success = tripal_core_insert_property('pub', $pub_id, $key, 'tripal_pub', $value, TRUE);
+      $success = chado_insert_property('pub', $pub_id, $key, 'tripal_pub', $value, TRUE);
     }
     if (!$success) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add property '%prop' to publication. Skipping.",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot add property '%prop' to publication. Skipping.",
       array('%prop' => $key));
       continue;
     }
@@ -899,7 +899,7 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
       'suffix' => $author['Suffix'],
     );
     $options = array('statement_name' => 'ins_pubauthor_idrasugisu');
-    $pubauthor = tripal_core_chado_insert('pubauthor', $values, $options);
+    $pubauthor = chado_insert_record('pubauthor', $values, $options);
 
     // if the user wants us to create a contact for each author then do it.
     if ($do_contact) {
@@ -916,9 +916,9 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
           'contact_id' => $contact['contact_id'],
         );
         $options = array('statement_name' => 'ins_pubauthorcontact_puco');
-        $pubauthor_contact = tripal_core_chado_insert('pubauthor_contact', $values, $options);
+        $pubauthor_contact = chado_insert_record('pubauthor_contact', $values, $options);
         if (!$pubauthor_contact) {
-          tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot link pub authro and contact.", array());
+          tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot link pub authro and contact.", array());
         }
       }
     }
@@ -940,7 +940,7 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
  * @ingroup tripal_pub_api
  */
 function tripal_pub_get_property($pub_id, $property) {
-  return tripal_core_get_property('pub', $pub_id, $property, 'tripal_pub');
+  return chado_get_property('pub', $pub_id, $property, 'tripal_pub');
 }
 
 /**
@@ -961,7 +961,7 @@ function tripal_pub_get_property($pub_id, $property) {
  * @ingroup tripal_pub_api
  */
 function tripal_pub_insert_property($pub_id, $property, $value, $update_if_present = 0) {
-  return tripal_core_insert_property('pub', $pub_id, $property, 'tripal_pub', $value, $update_if_present);
+  return chado_insert_property('pub', $pub_id, $property, 'tripal_pub', $value, $update_if_present);
 }
 
 /**
@@ -985,7 +985,7 @@ function tripal_pub_insert_property($pub_id, $property, $value, $update_if_prese
  * @ingroup tripal_pub_api
  */
 function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('pub', $pub_id, $property, 'tripal_pub', $value, $insert_if_missing);
+  return chado_update_property('pub', $pub_id, $property, 'tripal_pub', $value, $insert_if_missing);
 }
 /**
  * Delete a given property
@@ -1004,7 +1004,7 @@ function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missi
  * @ingroup tripal_pub_api
  */
 function tripal_pub_delete_property($pub_id, $property) {
-  return tripal_core_delete_property('pub', $pub_id, $property, 'tripal_pub');
+  return chado_delete_property('pub', $pub_id, $property, 'tripal_pub');
 }
 
 
@@ -1034,12 +1034,12 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   // get the publication
   // ---------------------------------
   $values = array('pub_id' => $pub_id);
-  $pub = tripal_core_generate_chado_var('pub', $values);
+  $pub = chado_generate_var('pub', $values);
 
   // expand the title
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.volumetitle');
-  $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.uniquename');
+  $pub = chado_expand_var($pub, 'field', 'pub.title');
+  $pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
+  $pub = chado_expand_var($pub, 'field', 'pub.uniquename');
   $pub_array = array();
   if (trim($pub->title)) {
     $pub_array['Title'] = $pub->title;
@@ -1079,11 +1079,11 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
       'name' => 'Citation',
     ),
   );
-  $citation = tripal_core_generate_chado_var('pubprop', $values);
+  $citation = chado_generate_var('pubprop', $values);
   if ($citation) {
-    $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value', $options);
+    $citation = chado_expand_var($citation, 'field', 'pubprop.value', $options);
     if (count($citation) > 1) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple citations already: %pub_id",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple citations already: %pub_id",
       array('%pub_id' => $pubid));
       return FALSE;
     }
@@ -1102,9 +1102,9 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
       'name' => 'Publication Type',
     ),
   );
-  $ptypes = tripal_core_generate_chado_var('pubprop', $values, $options);
+  $ptypes = chado_generate_var('pubprop', $values, $options);
   if ($ptypes) {
-    $ptypes = tripal_core_expand_chado_vars($ptypes, 'field', 'pubprop.value', $options);
+    $ptypes = chado_expand_var($ptypes, 'field', 'pubprop.value', $options);
     foreach ($ptypes as $ptype) {
      $pub_array['Publication Type'][] = $ptype->value;
     }
@@ -1119,10 +1119,10 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
       'name' => 'Authors',
     ),
   );
-  $authors = tripal_core_generate_chado_var('pubprop', $values);
-  $authors = tripal_core_expand_chado_vars($authors, 'field', 'pubprop.value', $options);
+  $authors = chado_generate_var('pubprop', $values);
+  $authors = chado_expand_var($authors, 'field', 'pubprop.value', $options);
   if (count($authors) > 1) {
-   tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple author lists. It should have only one list: %pub_id",
+   tripal_report_error('tripal_pub', TRIPAL_ERROR, "Publication has multiple author lists. It should have only one list: %pub_id",
    array('%pub_id' => $pubid));
    return FALSE;
   }
@@ -1261,7 +1261,7 @@ function tripal_pub_create_citation($pub) {
       }
     }
     if (!$pub_type) {
-      tripal_core_report_error('tripal_pub', TRIPAL_ERROR, "Cannot generate citation for publication type: %types",
+      tripal_report_error('tripal_pub', TRIPAL_ERROR, "Cannot generate citation for publication type: %types",
         array('%types' => print_r($pub['Publication Type'], TRUE)));
       return FALSE;
     }

+ 4 - 4
tripal_pub/includes/importers/tripal_pub.PMID.inc

@@ -162,7 +162,7 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
   $rfh = fopen($query_url, "r");
   if (!$rfh) {
     drupal_set_message('Could not perform Pubmed query. Cannot connect to Entrez.', 'error');
-    tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform Pubmed query. Cannot connect to Entrez.",
+    tripal_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform Pubmed query. Cannot connect to Entrez.",
               array());
     return 0;
   }
@@ -241,7 +241,7 @@ $retmod = 'null', $start = 0, $limit = 10, $args = array()){
   $rfh = fopen($fetch_url, "r");
   if (!$rfh) {
     drupal_set_message('ERROR: Could not perform PubMed query.', 'error');
-    tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform PubMed query: %fetch_url.",
+    tripal_report_error('tpub_pubmed', TRIPAL_ERROR, "Could not perform PubMed query: %fetch_url.",
               array('%fetch_url' => $fetch_url));
     return '';
   }
@@ -285,7 +285,7 @@ function tripal_pub_PMID_parse_pubxml($pub_xml) {
       switch ($element) {
         case 'ERROR':
           $xml->read(); // get the value for this element
-          tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, "Error: %err", array('%err' => $xml->value));
+          tripal_report_error('tpub_pubmed', TRIPAL_ERROR, "Error: %err", array('%err' => $xml->value));
           break;
         case 'PMID':
           // thre are multiple places where a PMID is present in the XML and
@@ -507,7 +507,7 @@ function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
             // see if this we can find the name using a synonym
             $pub_cvterm = tripal_cv_get_cvterm_by_synonym($value, NULL, 'tripal_pub');
             if (!$pub_cvterm) {
-              tripal_core_report_error('tpub_pubmed', TRIPAL_ERROR, 'Cannot find a valid vocabulary term for the publication type: "%term".',
+              tripal_report_error('tpub_pubmed', TRIPAL_ERROR, 'Cannot find a valid vocabulary term for the publication type: "%term".',
               array('%term' => $value));
             }
           }

+ 32 - 32
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -65,9 +65,9 @@ function chado_pub_form($node, $form_state) {
   // if we are editing an existing node then the pub is already part of the node
   if (property_exists($node, 'pub')) {
     $pub = $node->pub;
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.volumetitle');
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.uniquename');
+    $pub = chado_expand_var($pub, 'field', 'pub.title');
+    $pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
+    $pub = chado_expand_var($pub, 'field', 'pub.uniquename');
     $pub_id = $pub->pub_id;
 
     $title       = $pub->title;
@@ -252,17 +252,17 @@ function chado_pub_form($node, $form_state) {
     'cv_name' => 'tripal_pub',
     'select_options' => $select_options,
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
   // We want to use the contact_relationship_types cv if there are any terms available
   // and if not, to default to the relationship ontology
-  $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'pub_relationship_types'));
+  $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'pub_relationship_types'));
   $cv_id = $cv_result[0]->cv_id;
   $select_options = tripal_cv_get_cvterm_options($cv_id);
   if (empty($select_options)) {
-    $cv_result = tripal_core_chado_select('cv',array('cv_id'),array('name' => 'relationship'));
+    $cv_result = chado_select_record('cv',array('cv_id'),array('name' => 'relationship'));
     $cv_id = $cv_result[0]->cv_id;
     $select_options = tripal_cv_get_cvterm_options($cv_id);
   }
@@ -279,7 +279,7 @@ function chado_pub_form($node, $form_state) {
     'select_options' => $select_options
   );
   // Adds the form elements to your current form
-  chado_node_relationships_form($form, $form_state, $details);
+  chado_add_node_form_relationships($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -289,7 +289,7 @@ function chado_pub_form($node, $form_state) {
     'base_key_value' => $pub_id       // the value of pub_id for this record
   );
   // Adds the form elements to your current form
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   return $form;
 
@@ -328,7 +328,7 @@ function chado_pub_validate($node, $form, &$form_state) {
   // get the type of publication
   $values = array('cvterm_id' => $type_id);
   $options = array('statement_name' => 'sel_pub_ty');
-  $cvterm = tripal_core_chado_select('cvterm', array('name'), $values, $options);
+  $cvterm = chado_select_record('cvterm', array('name'), $values, $options);
   if (count($cvterm) == 0) {
     $message = t('Invalid publication type.');
     form_set_error('type_id', $message);
@@ -391,7 +391,7 @@ function chado_pub_validate($node, $form, &$form_state) {
     $values = array('pub_id' => $pub_id);
     $columns = array('title', 'pyear', 'type_id', 'series_name');
     $options = array('statement_name' => 'sel_pub_id');
-    $pub = tripal_core_chado_select('pub', $columns, $values, $options);
+    $pub = chado_select_record('pub', $columns, $values, $options);
 
     // if the title, type,  year or series_name have changed then check the pub
     // to see if it is a duplicate of another
@@ -569,7 +569,7 @@ function chado_pub_insert($node) {
     $cross_refs = array(); // stores any cross references for this publication
 
     // get the properties from the form
-    $properties = chado_node_properties_form_retreive($node);
+    $properties = chado_retrieve_node_form_properties($node);
 
     // get the list of properties for easy lookup (without doing lots of database queries
     $properties_list = array();
@@ -677,7 +677,7 @@ function chado_pub_insert($node) {
       'publisher'   => substr($publisher, 0, 255),
       'pubplace'    => substr($pubplace, 0, 255),
     );
-    $pub = tripal_core_chado_insert('pub', $values);
+    $pub = chado_insert_record('pub', $values);
     if (!$pub) {
       drupal_set_message("Error inserting publication", "error");
       watchdog('tripal_pub', "Error inserting publication", array(), WATCHDOG_ERROR);
@@ -693,14 +693,14 @@ function chado_pub_insert($node) {
       'foreignkey_name' => 'pub_id',
       'foreignkey_value' => $pub_id
     );
-    chado_node_properties_form_update_properties($node, $details, $properties);
+    chado_update_node_form_properties($node, $details, $properties);
 
     // * Relationships Form *
     $details = array(
       'relationship_table' => 'pub_relationship',  // name of the _relationship table
       'foreignkey_value' => $pub_id                // value of the pub_id key
     );
-    chado_node_relationships_form_update_relationships($node, $details);
+    chado_update_node_form_relationships($node, $details);
 
     // add in any database cross-references
     foreach ($cross_refs as $index => $ref) {
@@ -718,7 +718,7 @@ function chado_pub_insert($node) {
       'foreignkey_name' => 'pub_id',     // the name of the key in your base table
       'foreignkey_value' => $pub_id      // the value of the pub_id key
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
   }
   else {
     $pub_id = $node->pub_id;
@@ -726,7 +726,7 @@ function chado_pub_insert($node) {
 
   // Make sure the entry for this pub doesn't already exist in the
   // chado_pub table if it doesn't exist then we want to add it.
-  $check_org_id = chado_get_id_for_node('pub', $node->nid);
+  $check_org_id = chado_get_id_from_nid('pub', $node->nid);
   if (!$check_org_id) {
     $record = new stdClass();
     $record->nid = $node->nid;
@@ -762,13 +762,13 @@ function chado_pub_update($node) {
   $pub_arr = array();
 
   // get the publication ID for this publication
-  $pub_id = chado_get_id_for_node('pub', $node->nid) ;
+  $pub_id = chado_get_id_from_nid('pub', $node->nid) ;
 
   $properties = array(); // stores all of the properties we need to add
   $cross_refs = array(); // stores any cross references for this publication
 
   // get the properties from the form
-  $properties = chado_node_properties_form_retreive($node);
+  $properties = chado_retrieve_node_form_properties($node);
 
   // get the list of properties for easy lookup (without doing lots of database queries
   $properties_list = array();
@@ -880,7 +880,7 @@ function chado_pub_update($node) {
     'publisher'   => substr($publisher, 0, 255),
     'pubplace'    => substr($pubplace, 0, 255),
   );
-  $status = tripal_core_chado_update('pub', $match, $values);
+  $status = chado_update_record('pub', $match, $values);
   if (!$status) {
     drupal_set_message("Error updating publication", "error");
     watchdog('tripal_pub', "Error updating publication", array(), WATCHDOG_ERROR);
@@ -895,17 +895,17 @@ function chado_pub_update($node) {
     'foreignkey_name' => 'pub_id',
     'foreignkey_value' => $pub_id
   );
-  chado_node_properties_form_update_properties($node, $details, $properties);
+  chado_update_node_form_properties($node, $details, $properties);
 
   // * Relationships Form *
   $details = array(
     'relationship_table' => 'pub_relationship',  // name of the _relationship table
     'foreignkey_value' => $pub_id                // value of the pub_id key
   );
-  chado_node_relationships_form_update_relationships($node, $details);
+  chado_update_node_form_relationships($node, $details);
 
   // add in any database cross-references after first removing
-  tripal_core_chado_delete('pub_dbxref', array('pub_id' => $pub_id));
+  chado_delete_record('pub_dbxref', array('pub_id' => $pub_id));
   foreach ($cross_refs as $index => $ref) {
     $pub_dbxref = tripal_pub_add_pub_dbxref($pub_id, trim($ref));
     if (!$pub_dbxref) {
@@ -921,7 +921,7 @@ function chado_pub_update($node) {
     'foreignkey_name' => 'pub_id',     // the name of the key in your base table
     'foreignkey_value' => $pub_id      // the value of the pub_id key
   );
-  chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+  chado_update_node_form_dbxrefs($node, $details);
 }
 
 
@@ -940,17 +940,17 @@ function chado_pub_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
     // find the pub and add in the details
-    $pub_id = chado_get_id_for_node('pub', $nid);
+    $pub_id = chado_get_id_from_nid('pub', $nid);
 
     // get the pub
     $values = array('pub_id' => $pub_id);
-    $pub = tripal_core_generate_chado_var('pub', $values);
+    $pub = chado_generate_var('pub', $values);
 
     // expand the 'text' fields as those aren't included by default
     // and they really shouldn't be so large to cause problems
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.title');
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.volumetitle');
-    $pub = tripal_core_expand_chado_vars($pub, 'field', 'pub.uniquename');
+    $pub = chado_expand_var($pub, 'field', 'pub.title');
+    $pub = chado_expand_var($pub, 'field', 'pub.volumetitle');
+    $pub = chado_expand_var($pub, 'field', 'pub.uniquename');
 
     // set the URL path
     $nodes[$nid]->path = "pub/$pub_id";
@@ -971,7 +971,7 @@ function chado_pub_load($nodes) {
  */
 function chado_pub_delete(&$node) {
 
-  $pub_id = chado_get_id_for_node('pub', $node->nid);
+  $pub_id = chado_get_id_from_nid('pub', $node->nid);
 
   // if we don't have a pub id for this node then this isn't a node of
   // type chado_pub or the entry in the chado_pub table was lost.
@@ -1076,7 +1076,7 @@ function tripal_pub_node_insert($node) {
   // so the nodeapi function ensures that the URL path is set after insert or update
   // of the node and when the node is loaded if it hasn't yet been set.
   if ($node->type == 'chado_pub') {
-    $pub_id = chado_get_id_for_node('pub', $node->nid);
+    $pub_id = chado_get_id_from_nid('pub', $node->nid);
     tripal_pub_set_pub_url($node, $pub_id);
   }
 }
@@ -1096,7 +1096,7 @@ function tripal_pub_node_load($nodes, $types) {
   if (count(array_intersect(array('chado_pub'), $types))) {
     foreach ($nodes as $nid => $node) {
       if ($node->type == 'chado_pub' and !property_exists($node, 'path')) {
-        $pub_id = chado_get_id_for_node('pub', $node->nid);
+        $pub_id = chado_get_id_from_nid('pub', $node->nid);
         $path = tripal_pub_set_pub_url($node, $pub_id);
       }
     }
@@ -1114,7 +1114,7 @@ function tripal_pub_node_update($node) {
   // so the nodeapi function ensures that the URL path is set after insert or update
   // of the node and when the node is loaded if it hasn't yet been set.
   if ($node->type == 'chado_pub') {
-    $pub_id = chado_get_id_for_node('pub', $node->nid);
+    $pub_id = chado_get_id_from_nid('pub', $node->nid);
     tripal_pub_set_pub_url($node, $pub_id);
   }
 }

+ 3 - 3
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -76,12 +76,12 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
   
   // make sure the tripal_pub and tripal_contact ontologies are loaded
   $values = array('name' => 'tripal_pub');
-  $tpub_cv = tripal_core_chado_select('cv', array('cv_id'), $values);
+  $tpub_cv = chado_select_record('cv', array('cv_id'), $values);
   if (count($tpub_cv) == 0) {
     drupal_set_message(t('Before importing publications you must first ') . l(t('load the Tripal Pub Ontology'), 'admin/tripal/tripal_cv/obo_loader'), 'error');
   }
   $values = array('name' => 'tripal_contact');
-  $tpub_cv = tripal_core_chado_select('cv', array('cv_id'), $values);
+  $tpub_cv = chado_select_record('cv', array('cv_id'), $values);
   if (count($tpub_cv) == 0) {
     drupal_set_message(t('If you want to create contact pages for authors, you must first ') . l(t('load the Tripal Contact Ontology'), 'admin/tripal/tripal_cv/obo_loader'), 'error');
   }
@@ -313,7 +313,7 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
   $values = array(
     'name' => $supported_dbs,
   );
-  $dbs = tripal_core_chado_select('db', array('*'), $values);
+  $dbs = chado_select_record('db', array('*'), $values);
   foreach ($dbs as $index => $db) {
     $remote_dbs[$db->name] = $db->description;
   };

+ 3 - 3
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -45,8 +45,8 @@ function tripal_pub_search_page() {
           'name' => 'Citation',
         ),
       );
-      $citation_rec = tripal_core_generate_chado_var('pubprop', $values);
-      $citation_rec = tripal_core_expand_chado_vars($citation_rec, 'field', 'pubprop.value');
+      $citation_rec = chado_generate_var('pubprop', $values);
+      $citation_rec = chado_expand_var($citation_rec, 'field', 'pubprop.value');
 
       // if we have the citation then use it, otherwise, just use the title
       $title = htmlspecialchars($pub->title);
@@ -499,7 +499,7 @@ function tripal_pub_get_search_results($search_array, $limit) {
 
     // get the scope type
     $values = array('cvterm_id' => $type_id);
-    $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
+    $cvterm = chado_select_record('cvterm', array('name'), $values);
     $type_name = '';
     if (count($cvterm) > 0) {
       $type_name = $cvterm[0]->name;

+ 1 - 1
tripal_pub/theme/tripal_pub.theme.inc

@@ -22,7 +22,7 @@ function tripal_pub_preprocess_tripal_pub_relationships(&$variables) {
       ),
     ),
   );
-  $pub = tripal_core_expand_chado_vars($pub, 'table', 'pub_relationship', $options);
+  $pub = chado_expand_var($pub, 'table', 'pub_relationship', $options);
 
   // get the subject relationships
   $srelationships = $pub->pub_relationship->subject_id;

+ 2 - 2
tripal_pub/tripal_pub.install

@@ -49,7 +49,7 @@ function tripal_pub_install() {
   global $base_path;
 
   // create the module's data directory
-  tripal_create_moddir('tripal_pub');
+  tripal_create_files_dir('tripal_pub');
 
   // add loading of the the tripal pub ontology to the job queue
   $obo_path =  drupal_realpath(drupal_get_path('module', 'tripal_pub') . '/files/tpub.obo');
@@ -206,7 +206,7 @@ function tripal_pub_add_custom_tables() {
       ),
     ),
   );
-  tripal_core_create_custom_table('pubauthor_contact', $schema, TRUE);
+  chado_create_custom_table('pubauthor_contact', $schema, TRUE);
 }
 
 /**

+ 8 - 8
tripal_stock/api/tripal_stock.api.inc

@@ -45,7 +45,7 @@ function tripal_stock_get_stock_by_stock_id($stock_id) {
     return node_load($r->nid);
   }
   else {
-    tripal_core_report_error('tripal_stock', TRIPAL_WARNING, 'tripal_stock_get_stock_by_stock_id(!stock_id): no stock with that stock_id is sync\'d with drupal', array('!stock_id' => $stock_id));
+    tripal_report_error('tripal_stock', TRIPAL_WARNING, 'tripal_stock_get_stock_by_stock_id(!stock_id): no stock with that stock_id is sync\'d with drupal', array('!stock_id' => $stock_id));
   }
 
   return 0;
@@ -111,7 +111,7 @@ function tripal_stock_get_all_stocks() {
  */
 function tripal_stock_get_stocks($values) {
 
-  $stock_ids = tripal_core_chado_select('stock', array('stock_id'), $values);
+  $stock_ids = chado_select_record('stock', array('stock_id'), $values);
 
   // Change from stock_ids to nodes-----------------------------------
   $stock_ids = array_filter($stock_ids);
@@ -176,7 +176,7 @@ function tripal_stock_get_stocks_by_stockprop($stockprop_values, $stock_values)
   }
 
   //get stock_ids from stockprop table
-  $stock_ids = tripal_core_chado_select('stockprop', array('stock_id'), $stockprop_values);
+  $stock_ids = chado_select_record('stockprop', array('stock_id'), $stockprop_values);
 
   // Change from stock_ids to nodes-----------------------------------
   $stock_ids = array_filter($stock_ids);
@@ -216,7 +216,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
   );
 
   // where name_identifier = stock.name-------------------------------
-  $current_stocks = tripal_core_chado_select('stock', array('stock_id'),
+  $current_stocks = chado_select_record('stock', array('stock_id'),
     array(
       'name' => $name,
       'organism_id' => $organism_id,
@@ -231,7 +231,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
   }
 
   // where name_identifier = stock.uniquename-------------------------------
-  $current_stocks = tripal_core_chado_select('stock', array('stock_id'),
+  $current_stocks = chado_select_record('stock', array('stock_id'),
     array(
       'uniquename' => $name,
       'organism_id' => $organism_id,
@@ -247,7 +247,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
 
   // where name_identifier = dbxref.accession-------------------------------
   // linked to stock through stock.dbxref
-  $current_stocks = tripal_core_chado_select('stock', array('stock_id'),
+  $current_stocks = chado_select_record('stock', array('stock_id'),
     array(
       'dbxref_id' => array(
         'accession' => $name,
@@ -264,7 +264,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
   }
 
   // linked to stock through stock_dbxref?
-  $current_stocks = tripal_core_chado_select('stock_dbxref', array('stock_id'),
+  $current_stocks = chado_select_record('stock_dbxref', array('stock_id'),
     array(
       'dbxref_id' => array(
         'accession' => $name,
@@ -285,7 +285,7 @@ function tripal_stock_get_stock_by_name_identifier($name, $organism_id) {
 
   // where name_identifier = stockprop.value-------------------------------
   // where type='synonym'
-  $current_stocks = tripal_core_chado_select('stockprop', array('stock_id'),
+  $current_stocks = chado_select_record('stockprop', array('stock_id'),
     array(
       'stock_id' => array(
         'organism_id' => $organism_id,

+ 28 - 28
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -54,9 +54,9 @@ function chado_stock_load($nodes) {
   $new_nodes = array();
   foreach ($nodes as $nid => $node) {
     // get the stock details from chado
-    $stock_id = chado_get_id_for_node('stock', $node->nid);
+    $stock_id = chado_get_id_from_nid('stock', $node->nid);
     if (empty($stock_id)) {
-      tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
+      tripal_report_error('tripal_stock', TRIPAL_ERROR,
         'Unable to retrieve stock_id for %title (NID = %nid).',
         array('%title' => $node->title, '%nid' => $node->nid)
       );
@@ -65,7 +65,7 @@ function chado_stock_load($nodes) {
 
       // build the variable with all the stock details
       $values = array('stock_id' => $stock_id);
-      $stock = tripal_core_generate_chado_var('stock', $values);
+      $stock = chado_generate_var('stock', $values);
 
       // by default, the titles are saved using the unique constraint.  We will
       // keep it the same, but remove the duplicate name if the unique name and name
@@ -131,7 +131,7 @@ function chado_stock_form($node, $form_state) {
       // Check to see if it's excluded and expand it if so
       if (isset($node->expandable_fields)) {
         if (in_array($field_name, $node->expandable_fields)) {
-          $node = tripal_core_expand_chado_vars($node, 'field', $field_name);
+          $node = chado_expand_var($node, 'field', $field_name);
         }
       }
     }
@@ -303,7 +303,7 @@ function chado_stock_form($node, $form_state) {
     'base_key_value' => $stock_id,
     'cv_id' => variable_get('chado_stock_prop_types_cv', FALSE)
   );
-  chado_node_properties_form($form, $form_state, $details);
+  chado_add_node_form_properties($form, $form_state, $details);
 
   // ADDITIONAL DBXREFS FORM
   //---------------------------------------------
@@ -313,7 +313,7 @@ function chado_stock_form($node, $form_state) {
     'base_foreign_key' => 'stock_id',
     'base_key_value' => $stock_id
   );
-  chado_node_additional_dbxrefs_form($form, $form_state, $details);
+  chado_add_node_form_dbxrefs($form, $form_state, $details);
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
@@ -326,7 +326,7 @@ function chado_stock_form($node, $form_state) {
     'nodetype' => 'stock',
     'cv_id' => variable_get('chado_stock_relationship_cv', 0)
   );
-  chado_node_relationships_form($form, $form_state, $details);
+  chado_add_node_form_relationships($form, $form_state, $details);
 
   return $form;
 }
@@ -479,10 +479,10 @@ function chado_stock_insert($node) {
         if (!tripal_core_chado_select('dbxref', array('dbxref_id'), $values)) {
           $values['description'] = $node->db_description;
           $values['version'] = '1';
-          $dbxref_status = tripal_core_chado_insert('dbxref', $values);
+          $dbxref_status = chado_insert_record('dbxref', $values);
           if (!$dbxref_status) {
             drupal_set_message(t('Unable to add database reference to this stock.'), 'warning');
-            tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
+            tripal_report_error('tripal_stock', TRIPAL_WARNING,
               'Insert Stock: Unable to create dbxref where values:%values',
               array('%values' => print_r($values, TRUE)));
           }
@@ -507,7 +507,7 @@ function chado_stock_insert($node) {
         'description' => $node->stock_description,
         'type_id' => $node->type_id
       );
-      $stock = tripal_core_chado_insert('stock', $values);
+      $stock = chado_insert_record('stock', $values);
     }
     // create a stock without a dbxref
     else {
@@ -518,7 +518,7 @@ function chado_stock_insert($node) {
         'description' => $node->stock_description,
         'type_id'     => $node->type_id
       );
-      $stock = tripal_core_chado_insert('stock', $values);
+      $stock = chado_insert_record('stock', $values);
     }
 
     if (is_array($stock)) {
@@ -538,7 +538,7 @@ function chado_stock_insert($node) {
         'foreignkey_name' => 'stock_id',
         'foreignkey_value' => $stock_id
       );
-      chado_node_properties_form_update_properties($node, $details);
+      chado_update_node_form_properties($node, $details);
 
       // Now add the additional references
       $details = array(
@@ -546,14 +546,14 @@ function chado_stock_insert($node) {
         'foreignkey_name' => 'stock_id',
         'foreignkey_value' => $stock_id
       );
-      chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+      chado_update_node_form_dbxrefs($node, $details);
 
       // Now add in relationships
       $details = array(
         'relationship_table' => 'stock_relationship',
         'foreignkey_value' => $node->stock_id
       );
-      chado_node_relationships_form_update_relationships($node, $details);
+      chado_update_node_form_relationships($node, $details);
     }
   } //end of adding stock to chado
   else {
@@ -576,7 +576,7 @@ function chado_stock_insert($node) {
   }
   else {
     drupal_set_message(t('Error during stock creation.'), 'error');
-    tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
+    tripal_report_error('tripal_stock', TRIPAL_WARNING,
       'Insert Stock: Unable to create stock where values:%values',
       array('%values' => print_r($values, TRUE)));
     return FALSE;
@@ -610,7 +610,7 @@ function chado_stock_update($node) {
     $dbxref_present = TRUE;
     if ($node->accession) {
       $dbxref_mode = '';
-      $stock = tripal_core_chado_select(
+      $stock = chado_select_record(
         'stock',
         array('dbxref_id', 'type_id'),
         array('stock_id' => $node->stock_id)
@@ -622,7 +622,7 @@ function chado_stock_update($node) {
           'accession' => $node->accession,
           'description' => $node->db_description
         );
-        $dbxref_status = tripal_core_chado_update(
+        $dbxref_status = chado_update_record(
           'dbxref',
           array('dbxref_id' => $stock[0]->dbxref_id),
           $values
@@ -639,7 +639,7 @@ function chado_stock_update($node) {
             'description' => $node->db_description,
             'version' => '1',
           );
-          $dbxref_status = tripal_core_chado_insert(
+          $dbxref_status = chado_insert_record(
             'dbxref',
             $values
           );
@@ -647,7 +647,7 @@ function chado_stock_update($node) {
         }
         else {
           drupal_set_message(t('Unable to find stock to Update'), 'error');
-          tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
+          tripal_report_error('tripal_stock', TRIPAL_ERROR,
             'Stock Update: Unable to find stock to update using values: %values',
             array('%values', print_r($values, TRUE))
           );
@@ -657,7 +657,7 @@ function chado_stock_update($node) {
     }
 
     if (!$dbxref_status) {
-      tripal_core_report_error('tripal_stock', TRIPAL_WARNING,
+      tripal_report_error('tripal_stock', TRIPAL_WARNING,
         'Stock Update: Unable to %mode main stock dbxref with values: %values',
         array('%values' => print_r($values, TRUE), '%mode' => $dbxref_mode));
     }
@@ -679,12 +679,12 @@ function chado_stock_update($node) {
       );
     }
   }
-  $status = tripal_core_chado_update('stock', array('stock_id' => $node->stock_id), $update_values);
+  $status = chado_update_record('stock', array('stock_id' => $node->stock_id), $update_values);
 
 
   if (!$status) {
     drupal_set_message(t('Unable to update stock'), 'error');
-    tripal_core_report_error('tripal_stock', TRIPAL_ERROR,
+    tripal_report_error('tripal_stock', TRIPAL_ERROR,
       'Stock Update: Unable to update stock using match values: %mvalues and update values: %uvalues',
       array('%mvalues' => print_r(array('stock_id' => $node->stock_id), TRUE), '%uvalues' => print_r($update_values, TRUE))
     );
@@ -692,7 +692,7 @@ function chado_stock_update($node) {
   else {
     // set the URL for this stock page
     $values = array('stock_id' => $node->stock_id);
-    $stock = tripal_core_chado_select('stock', array('*'), $values);
+    $stock = chado_select_record('stock', array('*'), $values);
   }
 
   // now update the properties
@@ -704,7 +704,7 @@ function chado_stock_update($node) {
       'foreignkey_name' => 'stock_id',
       'foreignkey_value' => $node->stock_id
     );
-    chado_node_properties_form_update_properties($node, $details);
+    chado_update_node_form_properties($node, $details);
 
   }
 
@@ -715,7 +715,7 @@ function chado_stock_update($node) {
       'foreignkey_name' => 'stock_id',
       'foreignkey_value' => $node->stock_id
     );
-    chado_node_additional_dbxrefs_form_update_dbxrefs($node, $details);
+    chado_update_node_form_dbxrefs($node, $details);
   }
 
   // now update relationships
@@ -724,7 +724,7 @@ function chado_stock_update($node) {
       'relationship_table' => 'stock_relationship',
       'foreignkey_value' => $node->stock_id
     );
-    chado_node_relationships_form_update_relationships($node, $details);
+    chado_update_node_form_relationships($node, $details);
   }
 }
 
@@ -782,7 +782,7 @@ function tripal_stock_node_presave($node) {
         $uniquename  = $node->uniquename;
         $type_id     = $node->type_id;
         $values = array('cvterm_id' => $node->type_id);
-        $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
+        $cvterm = chado_select_record('cvterm', array('name'), $values);
         $type = $cvterm[0]->name;
       }
       else {
@@ -792,7 +792,7 @@ function tripal_stock_node_presave($node) {
         $type        = $node->stock->type_id->name;
       }
       $values = array('organism_id' => $organism_id);
-      $organism = tripal_core_chado_select('organism', array('genus','species'), $values);
+      $organism = chado_select_record('organism', array('genus','species'), $values);
       $node->title = "$sname, $uniquename ($type) " . $organism[0]->genus . ' ' . $organism[0]->species;
       if ($name == $uname) {
         $node->title = "$sname ($type) " . $organism[0]->genus . ' ' . $organism[0]->species;

+ 12 - 12
tripal_stock/includes/tripal_stock.sync_stocks.inc

@@ -103,7 +103,7 @@ function tripal_stock_sync_form_submit($form, &$form_state) {
   $job_args = array(0, $organism_id, $stock_types);
 
   if ($organism_id) {
-    $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $organism_id));
+    $organism = chado_select_record('organism', array('genus', 'species'), array('organism_id' => $organism_id));
     $title = "Sync stocks for " .  $organism[0]->genus . " " . $organism[0]->species;
   }
   else {
@@ -186,7 +186,7 @@ function tripal_stock_set_urls($na = NULL, $job = NULL) {
       db_query('DEALLOCATE "del_url_alias_by_src"');
       db_query('DEALLOCATE "ins_url_alias_nisrds"');
       db_query("ROLLBACK");
-      tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Failed Removing URL Alias: %src", array('%src' => $src));
+      tripal_report_error('trp-seturl', TRIPAL_ERROR, "Failed Removing URL Alias: %src", array('%src' => $src));
       return;
     }
     $success = db_query("EXECUTE ins_url_alias_nisrds(:src, :dst)", array(':src' => $src, ':dst' => $dst));
@@ -194,14 +194,14 @@ function tripal_stock_set_urls($na = NULL, $job = NULL) {
       db_query('DEALLOCATE "del_url_alias_by_src"');
       db_query('DEALLOCATE "ins_url_alias_nisrds"');
       db_query("ROLLBACK");
-      tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Failed Adding URL Alias: %dst", array('%dst' => $dst));
+      tripal_report_error('trp-seturl', TRIPAL_ERROR, "Failed Adding URL Alias: %dst", array('%dst' => $dst));
       return;
     }
 
     // update the job status every 1% stocks
     if ($job and $num_set % $num_per_interval == 0) {
       $percent = ($num_set / $num_nodes) * 100;
-      tripal_job_set_progress($job, intval($percent));
+      tripal_set_job_progress($job, intval($percent));
       $percent = sprintf("%.2f", $percent);
       print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
 
@@ -209,7 +209,7 @@ function tripal_stock_set_urls($na = NULL, $job = NULL) {
     $num_set++;
   }
   $percent = ($num_set / $num_nodes) * 100;
-  tripal_job_set_progress($job, intval($percent));
+  tripal_set_job_progress($job, intval($percent));
   $percent = sprintf("%.2f", $percent);
   print "Setting URLs (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes.\r";
   print "\nDone. Set " . number_format($num_set) . " URLs\n";
@@ -245,9 +245,9 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   // get the stock
   $values = array('stock_id' => $node->stock_id);
   $options = array('statement_name' => 'sel_stock_id');
-  $stock = tripal_core_chado_select('stock', array('*'), $values, $options);
+  $stock = chado_select_record('stock', array('*'), $values, $options);
   if (!$stock) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find stock when setting URL alias for stock: %id", array('%id' => $node->stock_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find stock when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $stock = (object) $stock[0];
@@ -255,9 +255,9 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   // get the organism
   $values = array('organism_id' => $stock->organism_id);
   $options = array('statement_name' => 'sel_organism_id');
-  $organism  = tripal_core_chado_select('organism', array('*'), $values, $options);
+  $organism  = chado_select_record('organism', array('*'), $values, $options);
   if (!$organism) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for stock: %id", array('%id' => $node->stock_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find organism when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $genus = preg_replace('/\s/', '_', strtolower($organism[0]->genus));
@@ -266,9 +266,9 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   // get the type
   $values = array('cvterm_id' => $stock->type_id);
   $options = array('statement_name' => 'sel_cvterm_id');
-  $cvterm = tripal_core_chado_select('cvterm', array('name'), $values, $options);
+  $cvterm = chado_select_record('cvterm', array('name'), $values, $options);
   if (!$cvterm) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for stock: %id", array('%id' => $node->stock_id));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot find type when setting URL alias for stock: %id", array('%id' => $node->stock_id));
     return FALSE;
   }
   $type = preg_replace('/\s/', '_', $cvterm[0]->name);
@@ -284,7 +284,7 @@ function tripal_stock_get_stock_url($node, $url_alias = NULL) {
   // the dst field of the url_alias table is only 128 characters long.
   // if this is the case then simply return the node URL, we can't set this one
   if (strlen($url_alias) > 128) {
-    tripal_core_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
+    tripal_report_error('trp-seturl', TRIPAL_ERROR, "Cannot set alias longer than 128 characters: %alias.", array('%alias' => $url_alias));
     return "node/" . $node->nid;
   }
 

+ 1 - 1
tripal_stock/tripal_stock.install

@@ -44,7 +44,7 @@ function tripal_stock_requirements($phase) {
  */
 function tripal_stock_install() {
   // create the module's data directory
-  tripal_create_moddir('tripal_stock');
+  tripal_create_files_dir('tripal_stock');
 }
 
 /**

+ 1 - 1
tripal_stock/tripal_stock.module

@@ -459,7 +459,7 @@ function tripal_stock_preprocess_tripal_stock_relationships(&$variables) {
       ),
     ),
   );
-  $stock = tripal_core_expand_chado_vars($stock, 'table', 'stock_relationship', $options);
+  $stock = chado_expand_var($stock, 'table', 'stock_relationship', $options);
 
   // get the subject relationships
   $srelationships = $stock->stock_relationship->subject_id;

+ 6 - 6
tripal_views/api/tripal_views.api.inc

@@ -289,7 +289,7 @@ function tripal_views_integration_add_entry($defn_array) {
   $no_errors = TRUE;
 
   if (empty($defn_array['table'])) {
-    tripal_core_report_error('tripal_views', TRIPAL_WARNING, 'Recieved integration with no tablename: %defn', array('%defn' => print_r($defn_array,TRUE)));
+    tripal_report_error('tripal_views', TRIPAL_WARNING, 'Recieved integration with no tablename: %defn', array('%defn' => print_r($defn_array,TRUE)));
     $no_errors = FALSE;
     return $no_errors;
   }
@@ -590,7 +590,7 @@ function tripal_views_integration_remove_entry_by_setup_id($setup_id) {
  */
 function tripal_views_integrate_all_chado_tables() {
 
-  $tables = tripal_core_get_chado_tables(TRUE);
+  $tables = chado_get_table_names(TRUE);
 
   $base_tables = array(
     'acquisition', 'analysis', 'assay', 'biomaterial', 'contact', 'cv', 'cvterm',
@@ -631,7 +631,7 @@ function tripal_views_integrate_all_chado_tables() {
 function tripal_views_get_integration_array_for_chado_table($table_name, $base_table = TRUE, $priority = 9) {
 
   // Get the schema for this table (via the chado schema api)
-  $schema = tripal_core_get_chado_table_schema($table_name);
+  $schema = chado_get_schema($table_name);
 
   // Base definition array
   $defn_array = array(
@@ -645,7 +645,7 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
   );
   // Add fields
   if (!isset($schema['fields'])) {
-    tripal_core_report_error('tripal_views', TRIPAL_NOTICE, 
+    tripal_report_error('tripal_views', TRIPAL_NOTICE, 
       'There are no fields defined for %table in the Chado Schema API.', array('%table' => $table_name));
     return FALSE;
   }
@@ -781,7 +781,7 @@ function tripal_views_get_integration_array_for_chado_table($table_name, $base_t
     foreach ($schema['referring_tables'] as $referring_table) {
 
       // D7 @todo: fix referring_tables in schema to list the keys like foreign keys does
-      $referring_schema = tripal_core_get_chado_table_schema($referring_table);
+      $referring_schema = chado_get_schema($referring_table);
       $referring_schema_fk_columns = $referring_schema['foreign keys'][$table_name]['columns'];
       foreach ($referring_schema_fk_columns as $left_field => $right_field) {
         $defn_array['fields'][$right_field]['joins'][ $referring_table ] = array(
@@ -842,7 +842,7 @@ function tripal_views_clone_integration($table_name, $new_priority = NULL, $temp
   $setup_id = $setup_id->fetchObject();
 
   if (empty($setup_id)) {
-    tripal_core_report_error('tripal_views', TRIPAL_ERROR, 'Unable to clone the setup for %table in order to add the following field to the integration: %field.',
+    tripal_report_error('tripal_views', TRIPAL_ERROR, 'Unable to clone the setup for %table in order to add the following field to the integration: %field.',
       array('%table' => $table_name, '%field' => print_r($field_array,TRUE)));
     return FALSE;
   }

+ 6 - 6
tripal_views/includes/tripal_views_integration.inc

@@ -303,7 +303,7 @@ function tripal_views_integration_form($form, $form_state, $arg) {
   );
 
   // build the form element for the Chado tables
-  $chado_tables = tripal_core_get_chado_tables(TRUE);
+  $chado_tables = chado_get_table_names(TRUE);
   $chado_tables = array_merge(array('Select'), $chado_tables);
   $default = '';
   if ($setup_id) {
@@ -479,7 +479,7 @@ function tripal_views_integration_form($form, $form_state, $arg) {
       $columns = explode(",", $mview->mv_specs);
     }
     else {
-      $table_desc = tripal_core_get_chado_table_schema($table_name);
+      $table_desc = chado_get_schema($table_name);
       if ($table_desc) {
         $fields = $table_desc['fields'];
         // iterate through the columns and build the format
@@ -535,7 +535,7 @@ function tripal_views_integration_form($form, $form_state, $arg) {
     );
 
     // get the list of chado tables to join on
-    $chado_join_tables = tripal_core_get_chado_tables(TRUE);
+    $chado_join_tables = chado_get_table_names(TRUE);
     $chado_join_tables = array_merge(array('Select a Join Table'), $chado_join_tables);
 
     // get list of all handlers
@@ -844,7 +844,7 @@ function tripal_views_integration_form($form, $form_state, $arg) {
     );
 
     $base_field_options = array('Select the Base Column');
-    $table_desc = tripal_core_get_chado_table_schema($table_name);
+    $table_desc = chado_get_schema($table_name);
     foreach ($table_desc['fields'] as $column => $def) {
       $base_field_options[$column] = $column;
     }
@@ -938,7 +938,7 @@ function tripal_views_integration_form($form, $form_state, $arg) {
       $columns = array();
       if ($result->left_table) {
         // get the table description
-        $table_desc = tripal_core_get_chado_table_schema($result->left_table);
+        $table_desc = chado_get_schema($result->left_table);
         foreach ($table_desc['fields'] as $column => $def) {
           $columns[$column] = $column;
         }
@@ -1292,7 +1292,7 @@ function tripal_views_integration_ajax_join_field($form, $form_state) {
     return $form['view_setup_table'][$field]['column-3'][$join_field];
   }
   else {
-    tripal_core_report_error('tripal_views', TRIPAL_ERROR, 
+    tripal_report_error('tripal_views', TRIPAL_ERROR, 
       'Tripal Views Integration Ajax failed due to being unable to determine which row needs updating', array());
     return $form;
   }

+ 1 - 1
tripal_views/tripal_views.install

@@ -33,7 +33,7 @@ function tripal_views_requirements($phase) {
 function tripal_views_install() {
 
   // create the module's data directory
-  tripal_create_moddir('tripal_views');
+  tripal_create_files_dir('tripal_views');
 
   // we want views to pick up our changes
   views_invalidate_cache();

+ 2 - 2
tripal_views/tripal_views.views.inc

@@ -235,7 +235,7 @@ function tripal_views_views_data() {
       $base_table = $tvi_row->table_name;
 
       // get the table description
-      $table_desc = tripal_core_get_chado_table_schema($base_table);
+      $table_desc = chado_get_schema($base_table);
 
       $fields = $table_desc['fields'];
       if (!is_array($fields)) {
@@ -342,7 +342,7 @@ function tripal_views_views_data() {
 
         // warn if deprecated method of relationship addition was used (ie: through handlers)
         if (isset($data[$base_table][$base_field]['relationship'])) {
-          tripal_core_report_error('tripal_views', TRIPAL_NOTICE,
+          tripal_report_error('tripal_views', TRIPAL_NOTICE,
             'DEPRECATED: Currently using tripal_views_handlers to store relationship for %base => %left when you should be using tripal_views_joins.',
             array('%base' => $base_table, '%left' => $left_table));
         }

+ 2 - 2
tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc

@@ -24,7 +24,7 @@ class tripal_views_handler_filter_select_cvterm extends tripal_views_handler_fil
     if (isset($this->options['show_all'])) {
       $cv_id = variable_get('chado_' . $this->view->base_table . '_cv', NULL);
       if ($cv_id) {
-        $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
+        $results = chado_select_record('cvterm', array('cvterm_id', 'name'), array('cv_id' => $cv_id));
         if (empty($results)) {
           $results = array();
         }
@@ -47,7 +47,7 @@ class tripal_views_handler_filter_select_cvterm extends tripal_views_handler_fil
         $resource = chado_query($sql);
         $cvterms = array();
         foreach ($resource as $r) {
-          $results = tripal_core_chado_select('cvterm', array('cvterm_id', 'name'), array('cv_id' => $r->cv_id));
+          $results = chado_select_record('cvterm', array('cvterm_id', 'name'), array('cv_id' => $r->cv_id));
           if (empty($results)) {
             $results = array();
           }