Преглед изворни кода

Fixed Drupal formatting standards

spficklin пре 12 година
родитељ
комит
cd87d5a56a
45 измењених фајлова са 911 додато и 899 уклоњено
  1. 2 2
      tripal_analysis/tripal_analysis.install
  2. 2 2
      tripal_analysis/tripal_analysis.module
  3. 1 1
      tripal_analysis/tripal_analysis.views.inc
  4. 24 24
      tripal_bulk_loader/tripal_bulk_loader.admin.templates.inc
  5. 3 2
      tripal_bulk_loader/tripal_bulk_loader.coder_ignores.txt
  6. 25 24
      tripal_bulk_loader/tripal_bulk_loader.loader.inc
  7. 4 1
      tripal_contact/tripal_contact.api.inc
  8. 1 1
      tripal_contact/tripal_contact.views.inc
  9. 113 111
      tripal_core/api/tripal_core.api.inc
  10. 144 144
      tripal_core/api/tripal_core.schema_v1.11.api.inc
  11. 173 173
      tripal_core/api/tripal_core.schema_v1.2.api.inc
  12. 4 4
      tripal_core/tripal_core.drush.inc
  13. 2 2
      tripal_core/tripal_core.module
  14. 75 75
      tripal_cv/api/tripal_cv.api.inc
  15. 12 12
      tripal_cv/includes/obo_loader.inc
  16. 1 1
      tripal_cv/tripal_cv.views.inc
  17. 9 9
      tripal_db/tripal_db.api.inc
  18. 1 1
      tripal_db/tripal_db.views.inc
  19. 2 2
      tripal_feature/api/tripal_feature.api.inc
  20. 56 56
      tripal_feature/includes/fasta_loader.inc
  21. 92 92
      tripal_feature/includes/gff_loader.inc
  22. 3 3
      tripal_feature/includes/syncFeatures.inc
  23. 3 2
      tripal_feature/tripal_feature.coder_ignores.txt
  24. 2 2
      tripal_feature/tripal_feature.drush.inc
  25. 89 88
      tripal_feature/tripal_feature.module
  26. 5 5
      tripal_feature/tripal_feature.views.inc
  27. 17 17
      tripal_featuremap/tripal_featuremap.install
  28. 16 16
      tripal_featuremap/tripal_featuremap.module
  29. 1 1
      tripal_featuremap/tripal_featuremap.views.inc
  30. 1 1
      tripal_genetic/tripal_genetic.views.inc
  31. 1 1
      tripal_library/tripal_library.module
  32. 1 1
      tripal_library/tripal_library.views.inc
  33. 1 1
      tripal_natural_diversity/tripal_natural_diversity.views.inc
  34. 1 1
      tripal_organism/tripal_organism.module
  35. 1 1
      tripal_organism/tripal_organism.views.inc
  36. 6 6
      tripal_phenotype/tripal_phenotype.views.inc
  37. 1 1
      tripal_project/tripal_project.views.inc
  38. 1 1
      tripal_stock/tripal_stock.views.inc
  39. 3 3
      tripal_views/api/tripal_views.api.inc
  40. 1 1
      tripal_views/includes/tripal_views_integration.inc
  41. 4 4
      tripal_views/includes/tripal_views_integration_port.inc
  42. 1 1
      tripal_views/tripal_views.views.inc
  43. 4 1
      tripal_views/views/handlers/chado_views_handler_relationship_to_node.inc
  44. 1 1
      tripal_views/views/handlers/chado_wrapper_functions.inc
  45. 1 1
      tripal_views/views/handlers/views_handler_join_chado_aggregator.inc

+ 2 - 2
tripal_analysis/tripal_analysis.install

@@ -44,12 +44,12 @@ function tripal_analysis_install() {
     'name' => 'analysis_date', 
     'def' => 'The date that an analysis was performed.'
   );
-  tripal_cv_add_cvterm($term,'tripal', 0, 1, 'tripal');
+  tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal');
   $term = array(
     'name' => 'analysis_short_name', 
     'def' => 'A computer legible (no spaces or special characters) abbreviation for the analysis.'
   );     
-  tripal_cv_add_cvterm($term,'tripal', 0, 1 , 'tripal');
+  tripal_cv_add_cvterm($term, 'tripal', 0, 1 , 'tripal');
 }
 
 /**

+ 2 - 2
tripal_analysis/tripal_analysis.module

@@ -202,7 +202,7 @@ function chado_analysis_delete($node) {
   
   // 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.
-  if (!$analysis_id){
+  if (!$analysis_id) {
     return;
   }
 
@@ -880,7 +880,7 @@ function tripal_analysis_nodeapi(&$node,  $op, $teaser, $page) {
         return '';
       }
       // Abort if this node is not one of the types we should show.
-      if (strcmp($node->type,'chado_feature')==0) {
+      if (strcmp($node->type, 'chado_feature') == 0) {
         if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
            // return results for searching
         } 

+ 1 - 1
tripal_analysis/tripal_analysis.views.inc

@@ -66,7 +66,7 @@ function tripal_analysis_views_data()  {
       'analysisprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = tripal_views_get_table_lightest_priority($tablename);     
+      $priority = tripal_views_get_table_lightest_priority($tablename);     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 24 - 24
tripal_bulk_loader/tripal_bulk_loader.admin.templates.inc

@@ -141,16 +141,16 @@ function tripal_bulk_loader_modify_template_base_form($form_state = NULL, $mode)
 
         // for backwards compatibility we want to convert insert_unique to be 'insert'
         // and optional to 'insert'
-        if (strcmp($table_array['mode'],'insert_unique')==0) {
+        if (strcmp($table_array['mode'], 'insert_unique')==0) {
           $mode_value .= 'insert or select if duplicate';
         } 
-        elseif (strcmp($table_array['mode'],'optional')==0) {
+        elseif (strcmp($table_array['mode'], 'optional')==0) {
           $mode_value .= 'optional insert';
         } 
-        elseif (strcmp($table_array['mode'],'insert_once')==0) {
+        elseif (strcmp($table_array['mode'], 'insert_once')==0) {
           $mode_value .= 'insert once';
         } 
-         elseif (strcmp($table_array['mode'],'select_once')==0) {
+         elseif (strcmp($table_array['mode'], 'select_once')==0) {
           $mode_value .= 'select once';
         } 
         elseif ($table_array['mode']) {
@@ -238,7 +238,7 @@ function tripal_bulk_loader_modify_template_base_form($form_state = NULL, $mode)
               $tbl_description = tripal_core_get_chado_table_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']){                  
+                  if ($key_table == $fk_table and $left_field == $field['field']) {                  
                     $fk_value = $field['foreign key'] . " ($right_field)";
                   }
                 }
@@ -609,10 +609,10 @@ function tripal_bulk_loader_import_export_template_form_submit($form, &$form_sta
       $record = db_fetch_object(db_query("SELECT * FROM {tripal_bulk_loader_template} WHERE template_id=%d", $form_state['values']['template_id']));
       //$form_state['storage']['template_array'] = $record->template_array;
       $t = var_export(unserialize($record->template_array), TRUE);
-      $t = preg_replace("/\n\s+array/","array", $t); // move array( to previous line
-      $t = preg_replace("/true/","TRUE", $t); // upper case true
-      $t = preg_replace("/false/","FALSE", $t); // upper case false
-      $t = preg_replace("/array\(/","array (", $t); // put a space between array and paren      
+      $t = preg_replace("/\n\s+array/", "array", $t); // move array( to previous line
+      $t = preg_replace("/true/", "TRUE", $t); // upper case true
+      $t = preg_replace("/false/", "FALSE", $t); // upper case false
+      $t = preg_replace("/array\(/", "array (", $t); // put a space between array and paren      
     
       $form_state['storage']['template_array'] = $t; 
       $form_state['storage']['template_id'] = $form_state['values']['template_id'];
@@ -703,31 +703,31 @@ function tripal_bulk_loader_edit_template_record_form(&$form_state = NULL) {
   
   // get the default mode
   $mode = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['mode'];
-  if(!$mode){
+  if (!$mode) {
      $mode = 'insert';
   }
   
   // get default for the select optional
   $select_optional = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['select_optional'];
-  if(!isset($select_optional)){
+  if (!isset($select_optional)) {
     $select_optional = 0;
   }
   
   // get default for the select if duplicate
   $select_if_duplicate = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['select_if_duplicate'];
-  if(!isset($select_if_duplicate)){
+  if (!isset($select_if_duplicate)) {
     $select_if_duplicate = 1;
   }
   
   // get default for the update if duplicate
   $update_if_duplicate = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['update_if_duplicate'];
-  if(!isset($update_if_duplicate)){
+  if (!isset($update_if_duplicate)) {
     $update_if_duplicate = 0;
   }
   
   // get default for the select if duplicate
   $optional = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['optional'];
-  if(!isset($optional)){
+  if (!isset($optional)) {
     $optional = 0;
   }
   
@@ -735,13 +735,13 @@ function tripal_bulk_loader_edit_template_record_form(&$form_state = NULL) {
   $disable = $form_state['storage']['template_array'][$form_state['storage']['original_priority']]['disable'];
 
   // this is just for backwards compatibility. the insert_unique mode type is no longer available
-  if(strcmp($mode,'insert_unique')==0){
+  if (strcmp($mode, 'insert_unique')==0) {
      $mode = 'insert';
      $select_if_duplicate = 1;
   }
   
   // this is just for backwards compatibility. the insert_unique mode type is no longer available
-  if(strcmp($mode,'optional')==0){
+  if (strcmp($mode, 'optional')==0) {
      $mode = 'insert';
      $optional = 1;
   }
@@ -1086,14 +1086,14 @@ function tripal_bulk_loader_add_template_field_form(&$form_state = NULL) {
       $fk_table = $form_state['storage']['template_array'][$fk_priority]['table'];
       foreach ($table_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){                  
+          if ($key_table == $fk_table and $left_field == $field) {                  
             $ref_chado_fields['Foreign Key'][$right_field] = $right_field;
           }
         }
       }      
       // now add in the remaining fields of the referring record's table.
       $fk_description = tripal_core_get_chado_table_schema($fk_table);
-      foreach ($fk_description['fields'] as $fk_field_name => $fk_farray){
+      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)) {
           if (in_array($fk_field_name, $ref_chado_fields['Foreign Key'])) {
@@ -1484,7 +1484,7 @@ function tripal_bulk_loader_add_template_field_form_validate($form, $form_state)
     );
     $new_record = ($form_state['values']['field_group'] == 'NEW') ? TRUE : FALSE;
     if ((!$is_unique) AND $new_record) {
-      form_set_error('record_name', "New Record Name must be unique. '".$form_state['values']['record_name']."' is not unique.");
+      form_set_error('record_name', "New Record Name must be unique. '" . $form_state['values']['record_name'] . "' is not unique.");
     }
   }
 
@@ -1773,15 +1773,15 @@ function tripal_bulk_loader_edit_template_field_form(&$form_state = NULL) {
       $fk_table = $form_state['storage']['template_array'][$fk_priority]['table'];
       foreach ($table_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){                  
+          if ($key_table == $fk_table and $left_field == $field) {                  
             $ref_chado_fields['Foreign Key'][$right_field] = $right_field;
           }
         }
       }      
       $fk_description = tripal_core_get_chado_table_schema($fk_table);
-      foreach ($fk_description['fields'] as $fk_field_name => $fk_farray){
+      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) and 
+         if (in_array('Foreign Key', $ref_chado_fields) and 
              in_array($fk_field_name, $ref_chado_fields['Foreign Key'])) {
            continue;
          }
@@ -2171,7 +2171,7 @@ function tripal_bulk_loader_edit_template_field_form_validate($form, $form_state
     );
     $new_record = ($form_state['values']['field_group'] == 'NEW') ? TRUE : FALSE;
     if ((!$is_unique) AND $new_record) {
-      form_set_error('record_name', "New Record Name must be unique. '".$form_state['values']['record_name']."' is not unique.");
+      form_set_error('record_name', "New Record Name must be unique. '" . $form_state['values']['record_name'] . "' is not unique.");
     }
   }
 
@@ -2425,7 +2425,7 @@ function tripal_bulk_loader_is_record_name_unique($new_record_name, $template_id
 
   // get the template array if it's not supplied
   if (empty($template_array)) {
-    $template = db_fetch_object(db_query("SELECT * FROM {tripal_bulk_loader_template} WHERE template_id=%d",$template_id));
+    $template = db_fetch_object(db_query("SELECT * FROM {tripal_bulk_loader_template} WHERE template_id=%d", $template_id));
     $template_array = unserialize($template->template_array);
     if (!is_array($template_array)) {
       watchdog(

+ 3 - 2
tripal_bulk_loader/tripal_bulk_loader.coder_ignores.txt

@@ -3,9 +3,10 @@
 ; where warning-type is one of security, style, sql, i18n, comment, etc.
 
 ; all variables are filtered
-tripal_bulk_loader.admin.inc:398:security
-tripal_bulk_loader.constants.inc::260:security
+tripal_bulk_loader.admin.inc:381:security
+tripal_bulk_loader.constants.inc::261:security
 
 ; doesn't need to be filtered b/c all variables set in code and not subjected to
 ; user input
+tripal_bulk_loader.constants.inc:241:security
 tripal_bulk_loader.constants.inc:376:security

+ 25 - 24
tripal_bulk_loader/tripal_bulk_loader.loader.inc

@@ -282,7 +282,7 @@ function tripal_bulk_loader_load_data($nid, $job_id) {
     print "\t\tOpen File...\n";
     $file = new SplFileObject($node->file, 'r'); 
     if (!$file) { 
-      watchdog('T_bulk_loader','Could not open file %file', 
+      watchdog('T_bulk_loader', 'Could not open file %file', 
         array($node->file), WATCHDOG_ERROR);
       return;
     }
@@ -502,7 +502,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     if ($required) {
       // check if the field has no value (or array is empty)
       if (!isset($values[$field]) or 
-          (is_array($values[$field]) and count($values[$field]) == 0)){
+          (is_array($values[$field]) and count($values[$field]) == 0)) {
         // check if the record is optional.  For backwards compatiblity we need to
         // check if the 'mode' is set to 'optional'
         if ($table_data['optional'] or preg_match('/optional/', $table_data['mode']) or 
@@ -531,7 +531,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
        preg_match('/optional/', $table_data['mode']))) {
     // Check all database table required fields are set
     $fields = $table_desc['fields'];
-    foreach ($fields as $field => $def) { 	
+    foreach ($fields as $field => $def) {   
       // a field is considered missing if it cannot be null and there is no default
       // value for it or it is not of type 'serial'
       if (array_key_exists('not null', $def) and $def['not null'] == 1 and   // field must have a value
@@ -567,13 +567,13 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
   // check if it is already selected, if so, just get the value stored in
   // the default_data array
   if (array_key_exists('selected', $table_data) and $table_data['selected']) {
-  	$data[$priority]['values_array'] = $default_data[$priority]['values_array'];
+    $data[$priority]['values_array'] = $default_data[$priority]['values_array'];
     return $no_errors;
   }
 
   // make sure we have some value in the select_if_duplicate and update_if_duplicate options
   if (!array_key_exists('select_if_duplicate', $table_data)) {
-  	$table_data['select_if_duplicate'] = 0;
+    $table_data['select_if_duplicate'] = 0;
   } 
   if (!array_key_exists('update_if_duplicate', $table_data)) {
     $table_data['update_if_duplicate'] = 0;
@@ -591,17 +591,17 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     // if this is a duplicate then substitute the values in the table_data array so
     // that for future records that my depend on this one, they can get the values needed
     if ($duplicate and is_array($duplicate) and count($duplicate) == 1) {
-    	$dup_record = $duplicate[0];
-    	// save the duplicate record for later.  If this is an update_if_duplicate
-    	// then we'll need this record as the match
-    	$data[$priority]['is_duplicate'] = (array) $dup_record;
+      $dup_record = $duplicate[0];
+      // save the duplicate record for later.  If this is an update_if_duplicate
+      // then we'll need this record as the match
+      $data[$priority]['is_duplicate'] = (array) $dup_record;
 
       // if all we have is one field then we will just use the value returned
       // rather than create an array of values. This way it will prevent 
       // the tripal_core_chado_(select|insert|update) from recursing on 
       // foreign keys and make the loader go faster.
       if (count((array) $dup_record) == 1) {
-        foreach($dup_record as $key => $value){ 
+        foreach ($dup_record as $key => $value) { 
           $data[$priority]['values_array'] = $value;
         } 
       }
@@ -610,7 +610,7 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
       else {
         // convert object to array
         $new_values = array();
-        foreach($dup_record as $key => $value){ 
+        foreach ($dup_record as $key => $value) { 
           $new_values[$key] = $value;
         } 
         $data[$priority]['values_array'] = $new_values;        
@@ -622,8 +622,8 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     } 
   }
   else {
-  	# TODO: what to do if there are more than one value returned when
-  	# checking for a duplicate?
+    # TODO: what to do if there are more than one value returned when
+    # checking for a duplicate?
   }
 
   if (!preg_match('/select/', $table_data['mode'])) {
@@ -699,12 +699,13 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
     
       // substitute the values array for the primary key if it exists
       // and is a single field
-      if(array_key_exists('primary key',$table_desc)){
-        if(count($table_desc['primary key']) == 1){
+      if (array_key_exists('primary key', $table_desc)) {
+        if (count($table_desc['primary key']) == 1) {
           $pkey_field = $table_desc['primary key'][0];
           $data[$priority]['values_array'] = $record[$pkey_field];
         }
-      } else {
+      } 
+      else {
         //add changes back to values array
         $data[$priority]['values_array'] = $record;
         $values = $record;
@@ -715,11 +716,11 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
   else {
     // get the matches for this select
     $matches = array();
-    if(is_array($values) and count($values) > 0){
+    if (is_array($values) and count($values) > 0) {
       $matches = tripal_core_chado_select($table, array_keys($table_desc['fields']), $values);
     }
     // if the record doesn't exist and it's not optional then generate an error
-    if (count($matches) == 0){
+    if (count($matches) == 0) {
       // No record on select
       if ($table_data['select_optional'] != 1) {        
         $msg = "\nLine " . $addt->line_num . ' ' . $table_data['record_id'] . ' (' . $table_data['mode'] . ') No Matching record in ' . $table . ' where values:' . print_r($values, TRUE);
@@ -752,9 +753,9 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
       $default_data[$priority]['selected'] = TRUE;
       
       // save the pkey
-      if(array_key_exists('primary key',$table_desc)){
-      	$new_values = array();
-        foreach($matches[0] as $key => $value){ 
+      if (array_key_exists('primary key', $table_desc)) {
+        $new_values = array();
+        foreach ($matches[0] as $key => $value) { 
           $new_values[$key] = $value;
         } 
         $default_data[$priority]['values_default'] = $new_values;   
@@ -841,7 +842,7 @@ function tripal_bulk_loader_add_foreignkey_to_values($table_array, $values, $dat
           array_key_exists('foreign keys', $tbl_description) and 
           array_key_exists($foreign_table, $tbl_description['foreign keys']) and 
           array_key_exists($field, $tbl_description['foreign keys'][$foreign_table]['columns']) and
-          $foreign_field == $tbl_description['foreign keys'][$foreign_table]['columns'][$field]){
+          $foreign_field == $tbl_description['foreign keys'][$foreign_table]['columns'][$field]) {
          $values[$field] = $foreign_values; 
       } 
       // if the field in the Referral records is not in an FK relationship
@@ -878,7 +879,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);        
           $record  = tripal_core_chado_select($foreign_table, $columns, $fvalues, $options);
-          if ($record){
+          if ($record) {
             $values[$field] = $record[0]->$foreign_field; 
           } 
           else {
@@ -979,7 +980,7 @@ function tripal_bulk_loader_flatten_array($values) {
 function tripal_bulk_loader_progress_bar($current=0, $total=100, $size=50) {
   $new_bar = FALSE;
   $mem = memory_get_usage();       
-	
+  
   // First iteration
   if ($current == 0) {
     $new_bar = TRUE;

+ 4 - 1
tripal_contact/tripal_contact.api.inc

@@ -1,3 +1,6 @@
 <?php
 
-
+/**
+ * @file
+ * @todo Add file header description
+ */

+ 1 - 1
tripal_contact/tripal_contact.views.inc

@@ -46,7 +46,7 @@ function tripal_contact_views_data()  {
       'contact_relationship',
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         $status = tripal_views_integration_add_entry($table_integration_array);

+ 113 - 111
tripal_core/api/tripal_core.api.inc

@@ -125,10 +125,10 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
   if (!array_key_exists('is_prepared', $options)) {
     $options['is_prepared'] = FALSE;
   }
-  if (!array_key_exists('statement_name',$options)) {
+  if (!array_key_exists('statement_name', $options)) {
     $options['statement_name'] = FALSE;
   }
-  if (!array_key_exists('skip_validation',$options)) {
+  if (!array_key_exists('skip_validation', $options)) {
     $options['skip_validation'] = FALSE;
   }
 
@@ -145,7 +145,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
     $connection = tripal_db_persistent_chado();
     
     // if we cannot get a connection the abandon the prepared statement
-    if(!$connection){
+    if (!$connection) {
        $prepared = FALSE;
        unset($options['statement_name']);
     }
@@ -174,10 +174,10 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
   foreach ($values as $field => $value) {
     // make sure the field is in the table description. If not then return an error 
     // message
-    if(!array_key_exists($field, $table_desc['fields'])){
+    if (!array_key_exists($field, $table_desc['fields'])) {
       watchdog('tripal_core', "tripal_core_chado_insert: The field '%field' does not exist ".
         "for the table '%table'.  Cannot perform insert. Values: %array", 
-        array('%field' => $field, '%table' => $table, '%array' => print_r($values,1)), WATCHDOG_ERROR);
+        array('%field' => $field, '%table' => $table, '%array' => print_r($values, 1)), WATCHDOG_ERROR);
       return FALSE;
     }
     
@@ -188,7 +188,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
         // we can prepare the selects run by the recrusive tripal_core_chado_get_foreign_key
         // function.
         $fk_sname = "fk_" . $table . "_" . $field;
-        foreach ($value as $k => $v){
+        foreach ($value as $k => $v) {
           $fk_sname .= substr($k, 0, 2);
         }
         $foreign_options['statement_name'] = $fk_sname;
@@ -215,7 +215,7 @@ function tripal_core_chado_insert($table, $values, $options = array()) {
 
     // check for violation of any unique constraints
     $ukeys = array();
-    if(array_key_exists('unique keys', $table_desc)){
+    if (array_key_exists('unique keys', $table_desc)) {
       $ukeys = $table_desc['unique keys'];
     }
     $ukselect_cols = array();
@@ -436,7 +436,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
   if (!array_key_exists('is_prepared', $options)) {
     $options['is_prepared'] = FALSE;
   }
-  if (!array_key_exists('statement_name',$options)) {
+  if (!array_key_exists('statement_name', $options)) {
     $options['statement_name'] = FALSE;
   }
 
@@ -454,7 +454,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
     $connection = tripal_db_persistent_chado();
     
     // if we cannot get a connection the abandon the prepared statement
-    if(!$connection){
+    if (!$connection ) {
        $prepared = FALSE;
        unset($options['statement_name']);
     }
@@ -476,7 +476,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
         // we can prepare the selects run by the recrusive tripal_core_chado_get_foreign_key
         // function.
         $fk_sname = "fk_" . $table . "_" . $field;
-        foreach ($value as $k => $v){
+        foreach ($value as $k => $v) {
           $fk_sname .= substr($k, 0, 2);
         }
         $foreign_options['statement_name'] = $fk_sname;
@@ -507,7 +507,7 @@ function tripal_core_chado_update($table, $match, $values, $options = NULL) {
         // we can prepare the selects run by the recrusive tripal_core_chado_get_foreign_key
         // function.
         $fk_sname = "fk_" . $table . "_" . $field;
-        foreach ($value as $k => $v){
+        foreach ($value as $k => $v) {
           $fk_sname .= substr($k, 0, 2);
         }
         $foreign_options['statement_name'] = $fk_sname;
@@ -947,10 +947,10 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
   if (!array_key_exists('has_record', $options)) {
     $options['has_record'] = FALSE;
   }
-  if (!array_key_exists('statement_name',$options)) {
+  if (!array_key_exists('statement_name', $options)) {
     $options['statement_name'] = FALSE;
   }
-  if (!array_key_exists('is_duplicate',$options)) {
+  if (!array_key_exists('is_duplicate', $options)) {
     $options['is_duplicate'] = FALSE;
   }
 
@@ -964,9 +964,9 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
     $connection = tripal_db_persistent_chado();
     
     // if we cannot get a connection the abandon the prepared statement
-    if(!$connection){
-       $prepared = FALSE;
-       unset($options['statement_name']);
+    if (!$connection) {
+      $prepared = FALSE;
+      unset($options['statement_name']);
     }
   }
   else {
@@ -1000,9 +1000,9 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
     // iterate through the unique constraints and reset the values and columns
     // arrays to only include these fields
     foreach ($ukeys as $cname => $fields) {
-    	if ($has_results) {
-    	   continue;
-    	}
+      if ($has_results) {
+         continue;
+      }
       $new_values = array();
       $new_columns = array();
       $new_options = array();
@@ -1011,15 +1011,15 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
       
       
       // include the primary key in the results returned
-	    if (array_key_exists('primary key', $table_desc)){
-	      $has_pkey = 1;
-	      $pkeys = $table_desc['primary key'];
-	      foreach ($pkeys as $index => $key) {
-	        array_push($new_columns, $key);
-	      }
-	    }
-	    
-	    // recreate the $values and $columns arrays 
+      if (array_key_exists('primary key', $table_desc)) {
+        $has_pkey = 1;
+        $pkeys = $table_desc['primary key'];
+        foreach ($pkeys as $index => $key) {
+          array_push($new_columns, $key);
+        }
+      }
+      
+      // recreate the $values and $columns arrays 
       foreach ($fields as $field) {
         if (array_key_exists($field, $values)) {
           $new_values[$field] = $values[$field];
@@ -1034,7 +1034,7 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
         elseif (array_key_exists('default', $table_desc['fields'][$field])) {
           $new_values[$field] = $table_desc['fields'][$field]['default'];
           $uq_sname .= substr($field, 0, 2);
-          if (!$has_pkey){
+          if (!$has_pkey) {
             array_push($new_columns, $field);
           }
         }
@@ -1048,15 +1048,15 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
       $new_options['statement_name'] = $uq_sname;
       $results = tripal_core_chado_select($table, $new_columns, $new_values, $new_options);
       // if we have a duplicate record then return the results
-			if (count($results) > 0) {
+      if (count($results) > 0) {
         $has_results = 1;
       } 
       unset($new_columns);
       unset($new_values);
       unset($new_options);
     }
-    if($options['has_record'] and $has_results){
-    	return TRUE;
+    if ($options['has_record'] and $has_results) {
+      return TRUE;
     } 
     else {
       return $results;
@@ -1064,15 +1064,15 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
   }
 
   foreach ($values as $field => $value) {
-  	// make sure the field is in the table description. If not then return an error 
-  	// message
-  	if(!array_key_exists($field, $table_desc['fields'])){
-  	  watchdog('tripal_core', "tripal_core_chado_select: The field '%field' does not exist ".
-  	    "for the table '%table'.  Cannot perform query. Values: %array", 
-  	    array('%field' => $field, '%table' => $table, '%array' => print_r($values,1)), WATCHDOG_ERROR);
-  	  return array();
-  	}
-  	
+    // make sure the field is in the table description. If not then return an error 
+    // message
+    if (!array_key_exists($field, $table_desc['fields'])) {
+      watchdog('tripal_core', "tripal_core_chado_select: The field '%field' does not exist ".
+        "for the table '%table'.  Cannot perform query. Values: %array", 
+        array('%field' => $field, '%table' => $table, '%array' => print_r($values, 1)), WATCHDOG_ERROR);
+      return array();
+    }
+    
     $select[] = $field;
     if (is_array($value)) {
       // if the user has specified multiple values for matching then this we
@@ -1092,7 +1092,7 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
           // we can prepare the selects run by the recrusive tripal_core_chado_get_foreign_key
           // function. we need the statement name to be unique so take the first two characters of each column
           $fk_sname = "fk_" . $table . "_" . $field;
-          foreach ($value as $k => $v){
+          foreach ($value as $k => $v) {
             $fk_sname .= substr($k, 0, 2);
           }
           $foreign_options['statement_name'] = $fk_sname;
@@ -1472,11 +1472,11 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
   $all = new stdClass();
   
   $return_array = 0;
-  if(array_key_exists('return_array', $base_options)){
-  	$return_array = 1;
+  if (array_key_exists('return_array', $base_options)) {
+    $return_array = 1;
   }
   $include_fk = 0;
-  if(array_key_exists('include_fk', $base_options)){
+  if (array_key_exists('include_fk', $base_options)) {
     $include_fk = $base_options['include_fk'];
   }
 
@@ -1487,7 +1487,7 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
              "and cannot be expanded. If this is a custom table, please add it using the Tripal ".
              "custom table interface.", array('%table' => $table), WATCHDOG_ERROR);
     if ($return_array) {
-    	return array();
+      return array();
     }
     return FALSE;
   }
@@ -1624,20 +1624,20 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
             }
             
             if ($include_fk) {
-            	// don't recurse if the callee has supplied an $fk_include list and this 
+              // don't recurse if the callee has supplied an $fk_include list and this 
               // FK table is not in the list.
-            	if(is_array($include_fk) and !array_key_exists($foreign_key, $include_fk)){
+              if (is_array($include_fk) and !array_key_exists($foreign_key, $include_fk)) {
                 continue;
-            	}
-            	// if we have the option but it is not an array then we don't recurse any furutehr
-            	if (!is_array($include_fk)) {
-            		continue;
-            	}	
+              }
+              // if we have the option but it is not an array then we don't recurse any furutehr
+              if (!is_array($include_fk)) {
+                continue;
+              }  
             } 
             // get the record from the foreign table
             $foreign_values = array($primary_key => $object->{$foreign_key});
             $options = array();
-            if(is_array($include_fk)){            	
+            if (is_array($include_fk)) {              
               $options['include_fk'] = $include_fk[$foreign_key];
             }
             $foreign_object = tripal_core_generate_chado_var($foreign_table, $foreign_values, $options);
@@ -1673,27 +1673,27 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
   }
 
   // check only one result returned
-  if(!$return_array){
-	  if (sizeof($results) == 1) {
-	    // add results to object
-	    return $results[0];
-	  }
-	  elseif (!empty($results)) {
-	    return $results;
-	  }
-	  else {
-	    // no results returned
-	  }
+  if (!$return_array) {
+    if (sizeof($results) == 1) {
+      // add results to object
+      return $results[0];
+    }
+    elseif (!empty($results)) {
+      return $results;
+    }
+    else {
+      // no results returned
+    }
   }
   // the caller has requested results are always returned as
   // an array
   else {
-  	if(!$results) {
-  		return array();
-  	}
-  	else {
+    if (!$results) {
+      return array();
+    }
+    else {
       return $results;
-  	}
+    }
   }
 }
 
@@ -1789,8 +1789,8 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
       $foreign_table = $to_expand;
       
       // don't expand the table it already is expanded
-      if(array_key_exists($foreign_table, $object)){
-      	return $object;
+      if (array_key_exists($foreign_table, $object)) {
+        return $object;
       }
       $foreign_table_desc = tripal_core_get_chado_table_schema($foreign_table);
       // If it's connected to the base table
@@ -1807,7 +1807,7 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
           }
           // if a prepared statement is provide then generate a new name
           $new_options = $table_options;
-          if(array_key_exists('statement_name', $table_options)){
+          if (array_key_exists('statement_name', $table_options)) {
              $new_options['statement_name'] = "exp_" . $foreign_table . "_" . substr($left, 0, 2) . substr($right, 0, 2); 
           }
           $foreign_object = tripal_core_generate_chado_var($foreign_table, array($left => $object->{$right}), $new_options);
@@ -1829,12 +1829,12 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
           }
           // if the object returned is NULL then handle that
           else {
-          	if (count($foreign_table_desc['foreign keys'][$base_table]['columns']) > 1) {
+            if (count($foreign_table_desc['foreign keys'][$base_table]['columns']) > 1) {
               $object->{$foreign_table}->{$left} = NULL;                 
-          	}
-          	else {
-          		$object->{$foreign_table} = NULL;
-          	}
+            }
+            else {
+              $object->{$foreign_table} = NULL;
+            }
           }
         }
       }
@@ -1844,14 +1844,14 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
         foreach ((array) $object as $field_name => $field_value) {
           // if we have a nested object ->expand the table in it
           if (is_object($field_value)) {
-          	$did_expansion = 1;
+            $did_expansion = 1;
             $object->{$field_name} = tripal_core_expand_chado_vars($field_value, 'table', $foreign_table);
           }
         }
         // if we did not expand this table we should return a message that the foreign table
         // could not be expanded
         if (!$did_expansion) {
-          watchdog('tripal_core','tripal_core_expand_chado_vars: Could not expand table, %table. It is ',
+          watchdog('tripal_core', 'tripal_core_expand_chado_vars: Could not expand table, %table. It is ',
             'not in a foreign key relationship with the base object nor with any other expanded table. ' .
             'Check the table definition to ensure that a proper foreign key relationship is present.',
             array('%table' => $foreign_table), WATCHDOG_ERROR);   
@@ -1874,8 +1874,8 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
           $object = $node;
         }
         else {
-          watchdog('tripal_core','tripal_core_expand_chado_vars: No node matches the nid (%nid) supplied.',
-            array('%nid' => $object->nid),WATCHDOG_ERROR);
+          watchdog('tripal_core', 'tripal_core_expand_chado_vars: No node matches the nid (%nid) supplied.',
+            array('%nid' => $object->nid), WATCHDOG_ERROR);
         } //end of if node
       }
       else {
@@ -1892,7 +1892,7 @@ function tripal_core_expand_chado_vars($object, $type, $to_expand, $table_option
       }
       break;
     default:
-      watchdog('tripal_core','tripal_core_expand_chado_vars: Unrecognized type (%type). Should be one of "field", "table", "node".',
+      watchdog('tripal_core', 'tripal_core_expand_chado_vars: Unrecognized type (%type). Should be one of "field", "table", "node".',
         array('%type' => $type), WATCHDOG_ERROR);
       return FALSE;
   }
@@ -2054,7 +2054,7 @@ function chado_query($sql) {
     }
     // END COPY FROM _db_query in database.pgsql.inc
   }
-  else {  	
+  else {    
     $previous_db = tripal_db_set_active('chado');
     $results = _db_query($sql);
     tripal_db_set_active($previous_db);
@@ -2483,12 +2483,12 @@ function tripal_db_set_active($dbname  = 'default') {
     // fails then do nothing.
     else {
       if (tripal_db_set_chado_search_path($dbname)) {
-      	 // if the chado schema is local to Drupal then 
-      	 // just return the active database.
+         // if the chado schema is local to Drupal then 
+         // just return the active database.
          return 'default';
       }
       else {
-        watchdog('tripal_core',"Cannot set 'search_path' variable for Postgres to %dbname",
+        watchdog('tripal_core', "Cannot set 'search_path' variable for Postgres to %dbname",
           array('%dbname' => $dbname), WATCHDOG_ERROR);
       }
     }
@@ -2511,7 +2511,7 @@ function tripal_db_set_chado_search_path($dbname) {
 
   // check to make sure the chado schema exists
   $chado_exists = variable_get('chado_schema_exists', FALSE);
-  if(!$chado_exists){
+  if (!$chado_exists) {
     $chado_exists = tripal_core_chado_schema_exists();
   }
 
@@ -2559,7 +2559,7 @@ function tripal_core_is_sql_prepared($statement_name) {
   if (!isset($_SESSION[$connection])) {
     $_SESSION[$connection] = array();
   }
-  if(in_array($statement_name,$_SESSION[$connection])){
+  if (in_array($statement_name, $_SESSION[$connection])) {
     //print "Is Prepared and in Session var: $statement_name\n";
     return TRUE;
   }
@@ -2594,7 +2594,7 @@ function tripal_core_is_sql_prepared($statement_name) {
 function tripal_core_chado_prepare($statement_name, $psql, $args) {
   $connection = variable_get('tripal_persistent_chado', NULL);
   
-  if(!$connection){
+  if (!$connection) {
     watchdog('tripal_core', "chado_prepare: not able to prepare '%name' statement as no persistent connection is available", array('%name' => $statement_name, '%sql' => $psql), WATCHDOG_ERROR);
     return FALSE;
   }
@@ -2610,7 +2610,9 @@ function tripal_core_chado_prepare($statement_name, $psql, $args) {
     }
     else {
       // Although a statement with this name is already prepared it is not the same!
-      watchdog('tripal_core', "chado_prepare: '%name' statement already prepared with different arguments! You want to prepare %sql with %values and the existing statement is %esql with %existing", array('%name' => $statement_name, '%sql' => $psql, '%values' => print_r($args,TRUE), '%esql' => $prepared_sql, '%existing' => print_r($prepared_args,TRUE)), WATCHDOG_ERROR);
+      watchdog('tripal_core', "chado_prepare: '%name' statement already prepared with different arguments! You want to prepare %sql with %values and the existing statement is %esql with %existing", 
+        array('%name' => $statement_name, '%sql' => $psql, '%values' => print_r($args, TRUE), '%esql' => $prepared_sql, 
+          '%existing' => print_r($prepared_args, TRUE)), WATCHDOG_ERROR);
       return FALSE;
     }
   }
@@ -2650,7 +2652,7 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
 
   // Before Executing, Ensure that all the values are supplied
   $required_values = $_SESSION['prepared_args'][$connection][$statement_name];
-  if (!$required_values){
+  if (!$required_values) {
     watchdog('tripal_core', "tripal_core_chado_execute_prepared: missing prepare arguments for this statement: '%name'", array('%name' => $statement_name), WATCHDOG_ERROR);
     return FALSE;
   }
@@ -2665,7 +2667,7 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
             $check = is_string($v);
             if ($v != '' and !$check) {
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement, field %k. Expected %required but recieved '%value'",
-                array('%name' => $statement_name, '%k' => $k, '%required' => $required_values[$k], '%value' => print_r($v,TRUE)), WATCHDOG_ERROR);
+                array('%name' => $statement_name, '%k' => $k, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
               return FALSE;
             }
             break;
@@ -2673,14 +2675,14 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
             $check = is_numeric($v);
             if (!$check) {
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement. Expected %required but recieved '%value'",
-                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v,TRUE)), WATCHDOG_ERROR);
+                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
               return FALSE;
             }
             break;
           case 'bool':
-            if($v != 'TRUE' and $v != 'FALSE'){
+            if ($v != 'TRUE' and $v != 'FALSE') {
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement. Expected %required but recieved '%value'",
-                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v,TRUE)), WATCHDOG_ERROR);
+                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
               return FALSE;
             }
             break;
@@ -2688,7 +2690,7 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
             $check = is_numeric($v);
             if (!$check) {
               watchdog('tripal_core', "chado_execute_prepared: wrong argument type supplied for '%name' statement. Expected %required but recieved '%value'",
-                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v,TRUE)), WATCHDOG_ERROR);
+                array('%name' => $statement_name, '%required' => $required_values[$k], '%value' => print_r($v, TRUE)), WATCHDOG_ERROR);
               return FALSE;
             }
             break;
@@ -2701,7 +2703,7 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
       }
       else {
         watchdog('tripal_core', "chado_execute_prepared: wrong number of arguments supplied for '%name' statement. Expected %required but recieved %values",
-          array('%name' => $statement_name, '%required' => print_r($required_values,TRUE), '%values' => print_r($values,TRUE)), WATCHDOG_ERROR);
+          array('%name' => $statement_name, '%required' => print_r($required_values, TRUE), '%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
         return FALSE;
       }
     }
@@ -2712,7 +2714,7 @@ function tripal_core_chado_execute_prepared($statement_name, $sql, $values) {
   }
   else {
     watchdog('tripal_core', "chado_execute_prepared: wrong number of arguments supplied for '%name' statement. Expected %required but recieved %values",
-      array('%name' => $statement_name, '%required' => print_r($required_values,TRUE), '%values' => print_r($values,TRUE)), WATCHDOG_ERROR);
+      array('%name' => $statement_name, '%required' => print_r($required_values, TRUE), '%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
     return FALSE;
   }
 }
@@ -2745,14 +2747,14 @@ function tripal_db_persistent_chado() {
       variable_set('tripal_persistent_chado', $connection);
     }
     else {
-    	if (is_array($db_url)) {
-    		$connection = db_connect($db_url['default']);
-    	}
+      if (is_array($db_url)) {
+        $connection = db_connect($db_url['default']);
+      }
       else {
         $connection = db_connect($db_url);
-    	}      
+      }      
       if (!$connection) {
-      	variable_set('tripal_persistent_chado', NULL);
+        variable_set('tripal_persistent_chado', NULL);
         watchdog('tripal_core', "Could not create persistant connection", array(), WATCHDOG_ERROR);
         return FALSE;
       }
@@ -2913,7 +2915,7 @@ function tripal_core_chado_schema_exists() {
 
   $exists = variable_get('chado_schema_exists', FALSE);
 
-  if(!$exists) {
+  if (!$exists) {
     // This is postgresql-specific code to check the existence of the chado schema
     // @coder-ignore: acting on pg_catalog schema rather then drupal schema therefore, table prefixing does not apply
     $sql = "SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname = 'chado'";
@@ -2970,8 +2972,8 @@ function tripal_core_schema_exists($schema) {
  */
 function tripal_core_get_chado_tables($include_custom = NULL) {
 
-	
-	// first get the chado version that is installed
+  
+  // first get the chado version that is installed
   $v = tripal_core_get_chado_version();
   
   $tables = array();
@@ -3088,7 +3090,7 @@ function tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FA
   // we'll return the version 1.11 so the schema API will work.
   if (strcmp($exact_version, '1.11 or older') == 0) {
     $exact_version = "1.11";
-    if($warn_if_unsupported){
+    if ($warn_if_unsupported) {
       drupal_set_message(t("WARNING: Tripal does not fully support Chado version less than v1.1.  If you are certain this is v1.1
          of if Chado was installed using an earlier version of Tripal then all is well. If not please upgrade to v1.1 or later"),
          'warning');
@@ -3098,11 +3100,11 @@ function tripal_core_get_chado_version($exact = FALSE, $warn_if_unsupported = FA
   // if not returing an exact version, return the version to the nearest 10th.
   // return 1.2 for all versions of 1.2x
   $effective_version = $exact_version;
-  if (preg_match('/^1\.2\d+$/', $effective_version)){
+  if (preg_match('/^1\.2\d+$/', $effective_version)) {
     $effective_version = "1.2";
   }
   if ($warn_if_unsupported and ($effective_version != 1.11 and $effective_version != 1.2)) {
-    drupal_set_message(t("WARNING: The currently installed version of Chado, v$exact_version, is not fully compatible with Tripal."),'warning');
+    drupal_set_message(t("WARNING: The currently installed version of Chado, v$exact_version, is not fully compatible with Tripal."), 'warning');
   }
   // if the callee has requested the exact version then return it
   if ($exact) {
@@ -3133,7 +3135,7 @@ function tripal_core_get_chado_table_schema($table) {
   $table_arr = module_invoke_all("chado_schema_v" . $v . "_" . $table);
 
   // if the table_arr is empty then maybe this is a custom table
-  if(!is_array($table_arr) or count($table_arr) == 0){
+  if (!is_array($table_arr) or count($table_arr) == 0) {
     $table_arr = tripal_get_chado_custom_schema($table);
   }
 

+ 144 - 144
tripal_core/api/tripal_core.schema_v1.11.api.inc

@@ -10763,149 +10763,149 @@ function tripal_core_chado_schema_v1_11_treatment() {
  */
 function tripal_core_chado_get_v1_11_tables() {
   $tables = array(
-		'acquisition',
-		'acquisition_relationship',
-		'acquisitionprop',
-		'analysis',
-		'analysisfeature',
-		'analysisfeatureprop',
-		'analysisprop',
-		'arraydesign',
-		'arraydesignprop',
-		'assay',
-		'assay_biomaterial',
-		'assay_project',
-		'assayprop',
-		'biomaterial',
-		'biomaterial_dbxref',
-		'biomaterial_relationship',
-		'biomaterial_treatment',
-		'biomaterialprop',
-		'cell_line',
-		'cell_line_cvterm',
-		'cell_line_cvtermprop',
-		'cell_line_dbxref',
-		'cell_line_feature',
-		'cell_line_library',
-		'cell_line_pub',
-		'cell_line_relationship',
-		'cell_line_synonym',
-		'cell_lineprop',
-		'cell_lineprop_pub',
-		'channel',
-		'contact',
-		'contact_relationship',
-		'control',
-		'cv',
-		'cvterm',
-		'cvterm_dbxref',
-		'cvterm_relationship',
-		'cvtermpath',
-		'cvtermprop',
-		'cvtermsynonym',
-		'db',
-		'dbxref',
-		'dbxrefprop',
-		'eimage',
-		'element',
-		'element_relationship',
-		'elementresult',
-		'elementresult_relationship',
-		'environment',
-		'environment_cvterm',
-		'expression',
-		'expression_cvterm',
-		'expression_cvtermprop',
-		'expression_image',
-		'expression_pub',
-		'expressionprop',
-		'feature',
-		'feature_cvterm',
-		'feature_cvterm_dbxref',
-		'feature_cvterm_pub',
-		'feature_cvtermprop',
-		'feature_dbxref',
-		'feature_expression',
-		'feature_expressionprop',
-		'feature_genotype',
-		'feature_phenotype',
-		'feature_pub',
-		'feature_pubprop',
-		'feature_relationship',
-		'feature_relationship_pub',
-		'feature_relationshipprop',
-		'feature_relationshipprop_pub',
-		'feature_synonym',
-		'featureloc',
-		'featureloc_pub',
-		'featuremap',
-		'featuremap_pub',
-		'featurepos',
-		'featureprop',
-		'featureprop_pub',
-		'featurerange',
-		'genotype',
-		'library',
-		'library_cvterm',
-		'library_dbxref',
-		'library_feature',
-		'library_pub',
-		'library_synonym',
-		'libraryprop',
-		'libraryprop_pub',
-		'magedocumentation',
-		'mageml',
-		'materialized_view',
-		'organism',
-		'organism_dbxref',
-		'organismprop',
-		'phendesc',
-		'phenotype',
-		'phenotype_comparison',
-		'phenotype_comparison_cvterm',
-		'phenotype_cvterm',
-		'phenstatement',
-		'phylonode',
-		'phylonode_dbxref',
-		'phylonode_organism',
-		'phylonode_pub',
-		'phylonode_relationship',
-		'phylonodeprop',
-		'phylotree',
-		'phylotree_pub',
-		'project',
-		'protocol',
-		'protocolparam',
-		'pub',
-		'pub_dbxref',
-		'pub_relationship',
-		'pubauthor',
-		'pubprop',
-		'quantification',
-		'quantification_relationship',
-		'quantificationprop',
-		'stock',
-		'stock_cvterm',
-		'stock_dbxref',
-		'stock_genotype',
-		'stock_pub',
-		'stock_relationship',
-		'stock_relationship_pub',
-		'stockcollection',
-		'stockcollection_stock',
-		'stockcollectionprop',
-		'stockprop',
-		'stockprop_pub',
-		'study',
-		'study_assay',
-		'studydesign',
-		'studydesignprop',
-		'studyfactor',
-		'studyfactorvalue',
-		'studyprop',
-		'studyprop_feature',
-		'synonym',
-		'tableinfo',
-		'treatment'
+    'acquisition',
+    'acquisition_relationship',
+    'acquisitionprop',
+    'analysis',
+    'analysisfeature',
+    'analysisfeatureprop',
+    'analysisprop',
+    'arraydesign',
+    'arraydesignprop',
+    'assay',
+    'assay_biomaterial',
+    'assay_project',
+    'assayprop',
+    'biomaterial',
+    'biomaterial_dbxref',
+    'biomaterial_relationship',
+    'biomaterial_treatment',
+    'biomaterialprop',
+    'cell_line',
+    'cell_line_cvterm',
+    'cell_line_cvtermprop',
+    'cell_line_dbxref',
+    'cell_line_feature',
+    'cell_line_library',
+    'cell_line_pub',
+    'cell_line_relationship',
+    'cell_line_synonym',
+    'cell_lineprop',
+    'cell_lineprop_pub',
+    'channel',
+    'contact',
+    'contact_relationship',
+    'control',
+    'cv',
+    'cvterm',
+    'cvterm_dbxref',
+    'cvterm_relationship',
+    'cvtermpath',
+    'cvtermprop',
+    'cvtermsynonym',
+    'db',
+    'dbxref',
+    'dbxrefprop',
+    'eimage',
+    'element',
+    'element_relationship',
+    'elementresult',
+    'elementresult_relationship',
+    'environment',
+    'environment_cvterm',
+    'expression',
+    'expression_cvterm',
+    'expression_cvtermprop',
+    'expression_image',
+    'expression_pub',
+    'expressionprop',
+    'feature',
+    'feature_cvterm',
+    'feature_cvterm_dbxref',
+    'feature_cvterm_pub',
+    'feature_cvtermprop',
+    'feature_dbxref',
+    'feature_expression',
+    'feature_expressionprop',
+    'feature_genotype',
+    'feature_phenotype',
+    'feature_pub',
+    'feature_pubprop',
+    'feature_relationship',
+    'feature_relationship_pub',
+    'feature_relationshipprop',
+    'feature_relationshipprop_pub',
+    'feature_synonym',
+    'featureloc',
+    'featureloc_pub',
+    'featuremap',
+    'featuremap_pub',
+    'featurepos',
+    'featureprop',
+    'featureprop_pub',
+    'featurerange',
+    'genotype',
+    'library',
+    'library_cvterm',
+    'library_dbxref',
+    'library_feature',
+    'library_pub',
+    'library_synonym',
+    'libraryprop',
+    'libraryprop_pub',
+    'magedocumentation',
+    'mageml',
+    'materialized_view',
+    'organism',
+    'organism_dbxref',
+    'organismprop',
+    'phendesc',
+    'phenotype',
+    'phenotype_comparison',
+    'phenotype_comparison_cvterm',
+    'phenotype_cvterm',
+    'phenstatement',
+    'phylonode',
+    'phylonode_dbxref',
+    'phylonode_organism',
+    'phylonode_pub',
+    'phylonode_relationship',
+    'phylonodeprop',
+    'phylotree',
+    'phylotree_pub',
+    'project',
+    'protocol',
+    'protocolparam',
+    'pub',
+    'pub_dbxref',
+    'pub_relationship',
+    'pubauthor',
+    'pubprop',
+    'quantification',
+    'quantification_relationship',
+    'quantificationprop',
+    'stock',
+    'stock_cvterm',
+    'stock_dbxref',
+    'stock_genotype',
+    'stock_pub',
+    'stock_relationship',
+    'stock_relationship_pub',
+    'stockcollection',
+    'stockcollection_stock',
+    'stockcollectionprop',
+    'stockprop',
+    'stockprop_pub',
+    'study',
+    'study_assay',
+    'studydesign',
+    'studydesignprop',
+    'studyfactor',
+    'studyfactorvalue',
+    'studyprop',
+    'studyprop_feature',
+    'synonym',
+    'tableinfo',
+    'treatment'
   );
 }

+ 173 - 173
tripal_core/api/tripal_core.schema_v1.2.api.inc

@@ -14006,178 +14006,178 @@ function tripal_core_chado_schema_v1_2_treatment() {
 function tripal_core_chado_get_v1_2_tables() {
   $tables = array(
     'acquisition',
-		'acquisition_relationship',
-		'acquisitionprop',
-		'analysis',
-		'analysisfeature',
-		'analysisfeatureprop',
-		'analysisprop',
-		'arraydesign',
-		'arraydesignprop',
-		'assay',
-		'assay_biomaterial',
-		'assay_project',
-		'assayprop',
-		'biomaterial',
-		'biomaterial_dbxref',
-		'biomaterial_relationship',
-		'biomaterial_treatment',
-		'biomaterialprop',
-		'cell_line',
-		'cell_line_cvterm',
-		'cell_line_cvtermprop',
-		'cell_line_dbxref',
-		'cell_line_feature',
-		'cell_line_library',
-		'cell_line_pub',
-		'cell_line_relationship',
-		'cell_line_synonym',
-		'cell_lineprop',
-		'cell_lineprop_pub',
-		'chadoprop',
-		'channel',
-		'contact',
-		'contact_relationship',
-		'control',
-		'cv',
-		'cvprop',
-		'cvterm',
-		'cvterm_dbxref',
-		'cvterm_relationship',
-		'cvtermpath',
-		'cvtermprop',
-		'cvtermsynonym',
-		'db',
-		'dbxref',
-		'dbxrefprop',
-		'eimage',
-		'element',
-		'element_relationship',
-		'elementresult',
-		'elementresult_relationship',
-		'environment',
-		'environment_cvterm',
-		'expression',
-		'expression_cvterm',
-		'expression_cvtermprop',
-		'expression_image',
-		'expression_pub',
-		'expressionprop',
-		'feature',
-		'feature_cvterm',
-		'feature_cvterm_dbxref',
-		'feature_cvterm_pub',
-		'feature_cvtermprop',
-		'feature_dbxref',
-		'feature_expression',
-		'feature_expressionprop',
-		'feature_genotype',
-		'feature_phenotype',
-		'feature_pub',
-		'feature_pubprop',
-		'feature_relationship',
-		'feature_relationship_pub',
-		'feature_relationshipprop',
-		'feature_relationshipprop_pub',
-		'feature_synonym',
-		'featureloc',
-		'featureloc_pub',
-		'featuremap',
-		'featuremap_pub',
-		'featurepos',
-		'featureprop',
-		'featureprop_pub',
-		'featurerange',
-		'genotype',
-		'genotypeprop',
-		'library',
-		'library_cvterm',
-		'library_dbxref',
-		'library_feature',
-		'library_pub',
-		'library_synonym',
-		'libraryprop',
-		'libraryprop_pub',
-		'magedocumentation',
-		'mageml',
-		'nd_experiment',
-		'nd_experiment_contact',
-		'nd_experiment_dbxref',
-		'nd_experiment_genotype',
-		'nd_experiment_phenotype',
-		'nd_experiment_project',
-		'nd_experiment_protocol',
-		'nd_experiment_pub',
-		'nd_experiment_stock',
-		'nd_experiment_stock_dbxref',
-		'nd_experiment_stockprop',
-		'nd_experimentprop',
-		'nd_geolocation',
-		'nd_geolocationprop',
-		'nd_protocol',
-		'nd_protocol_reagent',
-		'nd_protocolprop',
-		'nd_reagent',
-		'nd_reagent_relationship',
-		'nd_reagentprop',
-		'organism',
-		'organism_dbxref',
-		'organismprop',
-		'phendesc',
-		'phenotype',
-		'phenotype_comparison',
-		'phenotype_comparison_cvterm',
-		'phenotype_cvterm',
-		'phenstatement',
-		'phylonode',
-		'phylonode_dbxref',
-		'phylonode_organism',
-		'phylonode_pub',
-		'phylonode_relationship',
-		'phylonodeprop',
-		'phylotree',
-		'phylotree_pub',
-		'project',
-		'project_contact',
-		'project_pub',
-		'project_relationship',
-		'projectprop',
-		'protocol',
-		'protocolparam',
-		'pub',
-		'pub_dbxref',
-		'pub_relationship',
-		'pubauthor',
-		'pubprop',
-		'quantification',
-		'quantification_relationship',
-		'quantificationprop',
-		'stock',
-		'stock_cvterm',
-		'stock_cvtermprop',
-		'stock_dbxref',
-		'stock_dbxrefprop',
-		'stock_genotype',
-		'stock_pub',
-		'stock_relationship',
-		'stock_relationship_cvterm',
-		'stock_relationship_pub',
-		'stockcollection',
-		'stockcollection_stock',
-		'stockcollectionprop',
-		'stockprop',
-		'stockprop_pub',
-		'study',
-		'study_assay',
-		'studydesign',
-		'studydesignprop',
-		'studyfactor',
-		'studyfactorvalue',
-		'studyprop',
-		'studyprop_feature',
-		'synonym',
-		'tableinfo',
-		'treatment'
-   );	
+    'acquisition_relationship',
+    'acquisitionprop',
+    'analysis',
+    'analysisfeature',
+    'analysisfeatureprop',
+    'analysisprop',
+    'arraydesign',
+    'arraydesignprop',
+    'assay',
+    'assay_biomaterial',
+    'assay_project',
+    'assayprop',
+    'biomaterial',
+    'biomaterial_dbxref',
+    'biomaterial_relationship',
+    'biomaterial_treatment',
+    'biomaterialprop',
+    'cell_line',
+    'cell_line_cvterm',
+    'cell_line_cvtermprop',
+    'cell_line_dbxref',
+    'cell_line_feature',
+    'cell_line_library',
+    'cell_line_pub',
+    'cell_line_relationship',
+    'cell_line_synonym',
+    'cell_lineprop',
+    'cell_lineprop_pub',
+    'chadoprop',
+    'channel',
+    'contact',
+    'contact_relationship',
+    'control',
+    'cv',
+    'cvprop',
+    'cvterm',
+    'cvterm_dbxref',
+    'cvterm_relationship',
+    'cvtermpath',
+    'cvtermprop',
+    'cvtermsynonym',
+    'db',
+    'dbxref',
+    'dbxrefprop',
+    'eimage',
+    'element',
+    'element_relationship',
+    'elementresult',
+    'elementresult_relationship',
+    'environment',
+    'environment_cvterm',
+    'expression',
+    'expression_cvterm',
+    'expression_cvtermprop',
+    'expression_image',
+    'expression_pub',
+    'expressionprop',
+    'feature',
+    'feature_cvterm',
+    'feature_cvterm_dbxref',
+    'feature_cvterm_pub',
+    'feature_cvtermprop',
+    'feature_dbxref',
+    'feature_expression',
+    'feature_expressionprop',
+    'feature_genotype',
+    'feature_phenotype',
+    'feature_pub',
+    'feature_pubprop',
+    'feature_relationship',
+    'feature_relationship_pub',
+    'feature_relationshipprop',
+    'feature_relationshipprop_pub',
+    'feature_synonym',
+    'featureloc',
+    'featureloc_pub',
+    'featuremap',
+    'featuremap_pub',
+    'featurepos',
+    'featureprop',
+    'featureprop_pub',
+    'featurerange',
+    'genotype',
+    'genotypeprop',
+    'library',
+    'library_cvterm',
+    'library_dbxref',
+    'library_feature',
+    'library_pub',
+    'library_synonym',
+    'libraryprop',
+    'libraryprop_pub',
+    'magedocumentation',
+    'mageml',
+    'nd_experiment',
+    'nd_experiment_contact',
+    'nd_experiment_dbxref',
+    'nd_experiment_genotype',
+    'nd_experiment_phenotype',
+    'nd_experiment_project',
+    'nd_experiment_protocol',
+    'nd_experiment_pub',
+    'nd_experiment_stock',
+    'nd_experiment_stock_dbxref',
+    'nd_experiment_stockprop',
+    'nd_experimentprop',
+    'nd_geolocation',
+    'nd_geolocationprop',
+    'nd_protocol',
+    'nd_protocol_reagent',
+    'nd_protocolprop',
+    'nd_reagent',
+    'nd_reagent_relationship',
+    'nd_reagentprop',
+    'organism',
+    'organism_dbxref',
+    'organismprop',
+    'phendesc',
+    'phenotype',
+    'phenotype_comparison',
+    'phenotype_comparison_cvterm',
+    'phenotype_cvterm',
+    'phenstatement',
+    'phylonode',
+    'phylonode_dbxref',
+    'phylonode_organism',
+    'phylonode_pub',
+    'phylonode_relationship',
+    'phylonodeprop',
+    'phylotree',
+    'phylotree_pub',
+    'project',
+    'project_contact',
+    'project_pub',
+    'project_relationship',
+    'projectprop',
+    'protocol',
+    'protocolparam',
+    'pub',
+    'pub_dbxref',
+    'pub_relationship',
+    'pubauthor',
+    'pubprop',
+    'quantification',
+    'quantification_relationship',
+    'quantificationprop',
+    'stock',
+    'stock_cvterm',
+    'stock_cvtermprop',
+    'stock_dbxref',
+    'stock_dbxrefprop',
+    'stock_genotype',
+    'stock_pub',
+    'stock_relationship',
+    'stock_relationship_cvterm',
+    'stock_relationship_pub',
+    'stockcollection',
+    'stockcollection_stock',
+    'stockcollectionprop',
+    'stockprop',
+    'stockprop_pub',
+    'study',
+    'study_assay',
+    'studydesign',
+    'studydesignprop',
+    'studyfactor',
+    'studyfactorvalue',
+    'studyprop',
+    'studyprop_feature',
+    'synonym',
+    'tableinfo',
+    'treatment'
+   );  
    return $tables;
 }

+ 4 - 4
tripal_core/tripal_core.drush.inc

@@ -101,7 +101,7 @@ function drush_tripal_core_tripal_launch_jobs($username) {
   $parallel = drush_get_option('parallel');
   $job_id = drush_get_option('job_id');
 
-  if($username){
+  if ($username) {
     global $user;
     $user = user_load(array('name' => $username));
   }
@@ -114,13 +114,13 @@ function drush_tripal_core_tripal_launch_jobs($username) {
     drush_print("Tripal Job Launcher (in parallel)");
     drush_print("Running as user '$username'");
     drush_print("-------------------");
-    tripal_jobs_launch($parallel,$job_id);
+    tripal_jobs_launch($parallel, $job_id);
   }
   else {
     drush_print("Tripal Job Launcher");
     drush_print("Running as user '$username'");
     drush_print("-------------------");
-    tripal_jobs_launch(0,$job_id);
+    tripal_jobs_launch(0, $job_id);
   }
 }
 
@@ -130,7 +130,7 @@ function drush_tripal_core_tripal_launch_jobs($username) {
  * NOTE: The following code is executed when drush 'trpjob-run' or 'drush tripal-launch-jobs' is called
  */
 function drush_tripal_core_tripal_rerun_job($username, $job_id) {
-	
+  
   $new_job_id = tripal_jobs_rerun($job_id, FALSE);
   drush_tripal_core_tripal_launch_jobs($username, $new_job_id);
  

+ 2 - 2
tripal_core/tripal_core.module

@@ -28,8 +28,8 @@ function tripal_core_init() {
   // create the 'tripal' controlled volcabulary in chado but only if it doesn't already exist, and
   // only if the chado database is present.
   if (tripal_core_is_chado_installed()) {
-  	
-  	// make sure the current version of chado is set
+  
+    // make sure the current version of chado is set
     tripal_core_set_chado_version();  
   
     if (!db_fetch_object(chado_query("SELECT * FROM {cv} WHERE name = 'tripal'"))) {

+ 75 - 75
tripal_cv/api/tripal_cv.api.inc

@@ -259,21 +259,21 @@ function tripal_cv_get_cvterm_options($cv_id = 0) {
  * @ingroup tripal_cv_api
  */
 function tripal_cv_add_cv($name, $definition) {
-	
-	$ins_values = array(
-	  'name'       => $name,
-	  'definition' => $definition
-	);
-	
+  
+  $ins_values = array(
+    'name'       => $name,
+    'definition' => $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);
 
   // if it does not exists then add it
-  if (count($results) == 0) {  	
+  if (count($results) == 0) {    
     $ins_options = array('statement_name' => 'ins_cv_nade');
-  	$success = tripal_core_chado_insert('cv', $ins_values, $ins_options);
+    $success = tripal_core_chado_insert('cv', $ins_values, $ins_options);
     if (!$success) {
       watchdog('tripal_cv', "Failed to create the CV record", NULL, WATCHDOG_WARNING);
       return FALSE;
@@ -283,7 +283,7 @@ function tripal_cv_add_cv($name, $definition) {
   // 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 = tripal_core_chado_update('cv', $sel_values, $ins_values, $upd_options);
     if (!$success) {
       watchdog('tripal_cv', "Failed to update the CV record", NULL, WATCHDOG_WARNING);
       return FALSE;
@@ -339,9 +339,9 @@ function tripal_cv_add_cv($name, $definition) {
  */
 function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship = 0, 
   $update = 1, $dbname = 'internal') {
-  	
+    
   $connection = tripal_db_persistent_chado();
-  	
+    
   // get the term properties
   $id = $term['id'];
   $name = $term['name'];
@@ -398,19 +398,19 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   // but accessions don't change, the following SQL finds cvterms based on
   // their accession rather than the name
   if (!tripal_core_is_sql_prepared('sel_cvterm_by_accession')) {
-	  $pcvtermsql = "
-	    PREPARE sel_cvterm_by_accession(text, text) AS
-	    SELECT CVT.name, CVT.cvterm_id, CV.cv_id, CV.name as cvname, 
-	      DB.name as dbname, DB.db_id, DBX.accession 
-	    FROM cvterm CVT
-	      INNER JOIN dbxref DBX on CVT.dbxref_id = DBX.dbxref_id
-	      INNER JOIN db DB on DBX.db_id = DB.db_id
-	      INNER JOIN cv CV on CV.cv_id = CVT.cv_id
-	    WHERE DBX.accession = $1 and DB.name = $2";
-	  if(!chado_query($pcvtermsql)){
-	    watchdog('tripal_cv', "Cannot prepare statement 'sel_cvterm_by_accession'", NULL, WATCHDOG_WARNING);
+    $pcvtermsql = "
+      PREPARE sel_cvterm_by_accession(text, text) AS
+      SELECT CVT.name, CVT.cvterm_id, CV.cv_id, CV.name as cvname, 
+        DB.name as dbname, DB.db_id, DBX.accession 
+      FROM cvterm CVT
+        INNER JOIN dbxref DBX on CVT.dbxref_id = DBX.dbxref_id
+        INNER JOIN db DB on DBX.db_id = DB.db_id
+        INNER JOIN cv CV on CV.cv_id = CVT.cv_id
+      WHERE DBX.accession = $1 and DB.name = $2";
+    if (!chado_query($pcvtermsql)) {
+      watchdog('tripal_cv', "Cannot prepare statement 'sel_cvterm_by_accession'", NULL, WATCHDOG_WARNING);
       return 0; 
-	  }
+    }
   } 
   $cvtermsql = "EXECUTE sel_cvterm_by_accession('%s','%s')";  
   
@@ -437,9 +437,9 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   // if the constraint is met then let's check it to see if
   // the database name matches the one we have been provided
   if (count($result) == 1) {
-  	$cvterm = $result[0];
-  	
-  	// get the dbxref
+    $cvterm = $result[0];
+    
+    // get the dbxref
     $values = array('dbxref_id' => $cvterm->dbxref_id);
     $options = array('statement_name' => 'sel_dbxref_id');
     $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
@@ -456,35 +456,35 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // wouldn't have made it this far. So, let's swap the database for
     // this term
     if ($db_check->name != $db->name) {
-    	
-    	// look to see if the correct dbxref record already exists for 
-    	// this database
-    	$values = array(
-    	  'db_id' => $db->db_id,
-    	  'accession' => $accession,    	 
-    	);
-    	$options = array('staement_name' => 'sel_dbxref_idac');
-    	$result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
-    	
-    	// if we already have a good dbxref then we want to update our cvterm to use this dbxref
-    	if (count($result) > 0) {
-    		$dbxref = $result[0];
-    	  $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); 
-	      if (!$success) {
-	        watchdog('tripal_cv', "Failed to correct the dbxref id for the $cvterm, " .
-	          "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
-	        return 0;
-	      }
-    	}
-    	// if we don't have the record then we want to delete our cvterm and let the code
-    	// below recreate it with the correct info 
-    	else {
+      
+      // look to see if the correct dbxref record already exists for 
+      // this database
+      $values = array(
+        'db_id' => $db->db_id,
+        'accession' => $accession,       
+      );
+      $options = array('staement_name' => 'sel_dbxref_idac');
+      $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
+      
+      // if we already have a good dbxref then we want to update our cvterm to use this dbxref
+      if (count($result) > 0) {
+        $dbxref = $result[0];
         $match = array('cvterm_id' => $cvterm->cvterm_id);
-    		tripal_core_chado_delete('cvterm', $match);
-    	}    	
+        $values = array('dbxref_id' => $dbxref->dbxref_id);
+        $options = array('statement_name' => 'upd_cvterm_db');
+        $success = tripal_core_chado_update('cvterm', $match, $values, $options); 
+        if (!$success) {
+          watchdog('tripal_cv', "Failed to correct the dbxref id for the $cvterm, " .
+            "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+          return 0;
+        }
+      }
+      // if we don't have the record then we want to delete our cvterm and let the code
+      // below recreate it with the correct info 
+      else {
+        $match = array('cvterm_id' => $cvterm->cvterm_id);
+        tripal_core_chado_delete('cvterm', $match);
+      }      
     }
     
     // check that the accession matches.  Sometimes an OBO can define the same term 
@@ -492,8 +492,8 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     // can't do an insert or it will violate the constraint in the cvterm table.
     // so we'll need to add the record to the cvterm_dbxref table instead
     if ($dbxref->accession != $accession) {
-    	
-    	// get/add the dbxref fort his term
+      
+      // get/add the dbxref fort his term
       $dbxref_new =  tripal_db_add_dbxref($db->db_id, $accession);
       if (!$dbxref_new) {
         watchdog('tripal_cv', "Failed to find or insert the dbxref record for cvterm, " .
@@ -512,17 +512,17 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       
       // if the cvterm_dbxref record does not exists then add it 
       if (count($result)==0) {
-      	$options = array('statement_name' => 'ins_cvtermdbxref_cvdbis');
-	      $success = tripal_core_chado_insert('cvterm_dbxref', $values, $options);
-	      if(!$success){
-	        watchdog('tripal_cv', "Failed to find or insert the cvterm_dbxref record for a ". 
-	          "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
-	        return 0;
-	      }
-      }	      
-	    // get the original cvterm with the same name and return that.
-	    $cvterm = db_fetch_object(chado_query($cvtermsql, $dbxref->accession, $dbname));
-	    return $cvterm;
+        $options = array('statement_name' => 'ins_cvtermdbxref_cvdbis');
+        $success = tripal_core_chado_insert('cvterm_dbxref', $values, $options);
+        if (!$success) {
+          watchdog('tripal_cv', "Failed to find or insert the cvterm_dbxref record for a " . 
+            "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
+          return 0;
+        }
+      }        
+      // get the original cvterm with the same name and return that.
+      $cvterm = db_fetch_object(chado_query($cvtermsql, $dbxref->accession, $dbname));
+      return $cvterm;
     }
     
     // continue on, we've fixed the record if the db_id did not match, 
@@ -536,7 +536,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   //print_r($cvterm);
   if (!$cvterm) {
 
-  	// check to see if the dbxref exists if not, add it
+    // check to see if the dbxref exists if not, add it
     $dbxref =  tripal_db_add_dbxref($db->db_id, $accession);
     if (!$dbxref) {
       watchdog('tripal_cv', "Failed to find or insert the dbxref record for cvterm, " .
@@ -549,7 +549,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     $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);
-    if (count($check) == 0) {    	
+    if (count($check) == 0) {      
       // now add the cvterm
       $ins_values = array(
         'cv_id'                => $cv->cv_id,
@@ -581,12 +581,12 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   }
   // upate the cvterm
   elseif ($update) { 
-  	$match = array('cvterm_id' => $cvterm->cvterm_id);
-  	$upd_values = array(
-        'name'                => $name,
-        'definition'          => $definition,
-        'is_obsolete'         => $is_obsolete,
-        'is_relationshiptype' => $is_relationship, 
+    $match = array('cvterm_id' => $cvterm->cvterm_id);
+    $upd_values = array(
+      'name'                => $name,
+      'definition'          => $definition,
+      'is_obsolete'         => $is_obsolete,
+      'is_relationshiptype' => $is_relationship, 
     );
     $upd_options = array('statement_name' => 'upd_cvterm_nadeisis');
     $success = tripal_core_chado_update('cvterm', $match, $upd_values, $upd_options);    

+ 12 - 12
tripal_cv/includes/obo_loader.inc

@@ -158,11 +158,11 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
   // add any typedefs to the vocabulary first
   $typedefs = $obo['Typedef'];
   foreach ($typedefs as $typedef) {
-  	$t = array();
-  	$t['id']     = $typedef['id'][0];
-  	$t['name']   = $typedef['name'][0];
-  	$t['def']    = $typedef['def'][0];
-  	$t['subset'] = $typedef['subset'][0];
+    $t = array();
+    $t['id']     = $typedef['id'][0];
+    $t['name']   = $typedef['name'][0];
+    $t['def']    = $typedef['def'][0];
+    $t['subset'] = $typedef['subset'][0];
     tripal_cv_obo_process_term($t, $defaultcv->name, $obo, 1, $newcvs, $default_db);
   }
   
@@ -205,7 +205,7 @@ function tripal_cv_obo_process_terms($terms, $defaultcv, $obo, $jobid = NULL, &$
 
     // update the job status every 1% terms
     if ($jobid and $i % $interval == 0) {
-    	$complete = ($i / $count) * 100;
+      $complete = ($i / $count) * 100;
       tripal_job_set_progress($jobid, intval($complete)); 
       printf("%d of %d records. (%0.2f%%) memory: %d\r", $i, $count, $complete, memory_get_usage());                                                             
     }                                 
@@ -410,7 +410,7 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $obo, $rel, $objnam
   $options = array('statement_name' => 'sel_cvtermrelationship_tysuob');
   $result = tripal_core_chado_select('cvterm_relationship', array('*'), $values, $options);
   if (count($result) == 0) {
-  	$options = array('statement_name' => 'ins_cvtermrelationship_tysuob');
+    $options = array('statement_name' => 'ins_cvtermrelationship_tysuob');
     $sql = "INSERT INTO {cvterm_relationship} ".
            "(type_id,subject_id,object_id) VALUES (%d,%d,%d)";
     $success = tripal_core_chado_insert('cvterm_relationship', $values, $options);
@@ -451,7 +451,7 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
   // now add the synonyms
   if (isset($term['synonym'])) {
     foreach ($term['synonym'] as $synonym) {
-    	
+      
       // separate out the synonym definition and the synonym type
       $def = preg_replace('/^\s*"(.*)"\s*.*$/', '\1', $synonym);
       $type = drupal_strtolower(preg_replace('/^.*"\s+(.*?)\s+.*$/', '\1', $synonym));
@@ -489,13 +489,13 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
       $options = array('statement_name' => 'sel_cvtermsynonym_cvsy');
       $results = tripal_core_chado_select('cvtermsynonym', array('*'), $values, $options);
       if (count($results) == 0) {
-      	$values = array(
+        $values = array(
           'cvterm_id' => $cvterm->cvterm_id, 
           'synonym' => $def,
-      	  'type_id' => $syntype->cvterm_id
+          'type_id' => $syntype->cvterm_id
         );
-      	$options = array('statement_name' => 'ins_cvtermsynonym_cvsy');
-      	$success = tripal_core_chado_insert('cvtermsynonym', $values, $options);
+        $options = array('statement_name' => 'ins_cvtermsynonym_cvsy');
+        $success = tripal_core_chado_insert('cvtermsynonym', $values, $options);
         if (!$success) {
           tripal_cv_obo_quiterror("Failed to insert the synonym for term: $name ($def)");
         }

+ 1 - 1
tripal_cv/tripal_cv.views.inc

@@ -70,7 +70,7 @@ function tripal_cv_views_data() {
       'cvtermsynonym'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 9 - 9
tripal_db/tripal_db.api.inc

@@ -302,23 +302,23 @@ function tripal_db_get_dbxref_by_accession($accession, $db_id=0) {
 function tripal_db_add_db($dbname, $description = '', $url = '', 
   $urlprefix = '', $update = 0) {
 
-	// build the values array for inserting/updating
+  // build the values array for inserting/updating
   $ins_values = array(
     'name' => $dbname,
     'description' => $description,
     'url' => $url,
     'urlprefix' => $urlprefix
   );
-	
-	// get the database record if it already exists
-	$sel_values = array('name' => $dbname);
+  
+  // 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);
   
   // 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); 
+  if (count($result) == 0) {    
+    $ins_options = array('statement_name' => 'ins_db_nadeurur');   
+    $success = tripal_core_chado_insert('db', $ins_values, $ins_options); 
     if (!$success) {
       watchdog('tripal_db', "Cannot create db '$dbname'.", NULL, WATCHDOG_WARNING);
       return 0;
@@ -327,8 +327,8 @@ function tripal_db_add_db($dbname, $description = '', $url = '',
   }
   // 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);
+    $upd_options = array('statement_name' => 'upd_db_nadeurur');
+    $success = tripal_core_chado_update('db', $sel_values, $ins_values, $upd_options);
     if (!$success) {
       watchdog('tripal_db', "Cannot update db '$dbname'.", NULL, WATCHDOG_WARNING);
       return 0;

+ 1 - 1
tripal_db/tripal_db.views.inc

@@ -58,7 +58,7 @@ function tripal_db_views_data()  {
       'dbxrefprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 2 - 2
tripal_feature/api/tripal_feature.api.inc

@@ -719,7 +719,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
           // if the callee has specified that only certain sub features should be
           // included then continue of this child is not one of those allowed
           // subfeatures
-          if (count($sub_features) > 0 and !in_array($child->type_name, $sub_features)){
+          if (count($sub_features) > 0 and !in_array($child->type_name, $sub_features)) {
              continue;
           }
         
@@ -825,7 +825,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
   // use what comes through from the feature record
   else {
     $sql = "SELECT * FROM feature F WHERE feature_id = %d";
-    $values = db_fetch_object(chado_query($sql,$feature_id));
+    $values = db_fetch_object(chado_query($sql, $feature_id));
     $residues = $values->residues;
     if ($output_format == 'fasta_html') {
        $residues = wordwrap($residues, $num_bases_per_line, "<br>", TRUE);  

+ 56 - 56
tripal_feature/includes/fasta_loader.inc

@@ -478,7 +478,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
   //$lines = file($dfile, FILE_SKIP_EMPTY_LINES);
   $fh = fopen($dfile, 'r');
   if (!$fh) {
-    watchdog('T_fasta_loader',"cannot open file: %dfile", array('%dfile' => $dfile), WATCHDOG_ERROR);
+    watchdog('T_fasta_loader', "cannot open file: %dfile", array('%dfile' => $dfile), WATCHDOG_ERROR);
     return 0;
   }
   $filesize = filesize($dfile);
@@ -563,7 +563,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
           print "Parsing Line $i (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes. Parsing: $name\r";
         }
         else {
-          print "Parsing Line $i (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes. Parsing: $uname\r";	
+          print "Parsing Line $i (" . $percent . "%). Memory: " . number_format(memory_get_usage()) . " bytes. Parsing: $uname\r";  
         }
         tripal_job_set_progress($job, intval(($num_read / $filesize) * 100));
       }
@@ -590,19 +590,19 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
 
   // check to see if this feature already exists if the match_type is 'Name'
   if (strcmp($match_type, 'Name')==0) {
-  	$values = array(
-  	  'organism_id' => $organism_id,
-  	  'name' => $name,
-  	  'type_id' => $cvterm->cvterm_id,  	
-  	);
-  	$options = array('statement_name' => 'sel_feature_ornaty');
-  	$results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
+    $values = array(
+      'organism_id' => $organism_id,
+      'name' => $name,
+      'type_id' => $cvterm->cvterm_id,    
+    );
+    $options = array('statement_name' => 'sel_feature_ornaty');
+    $results = tripal_core_chado_select('feature', array('feature_id'), $values, $options);
     if (count($results) > 1) {
       watchdog('T_fasta_loader', "Multiple features exist with the name '%name' of type 
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
-    if(count($results) == 1){  
+    if (count($results) == 1) {  
       $reature = $results[0];
     } 
   }
@@ -620,7 +620,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
                '%type' for the organism.  skipping", array('%name' => $name, '%type' => $type));
       return 0;
     } 
-    if(count($results) == 1){  
+    if (count($results) == 1) {  
       $reature = $results[0];
     } 
   }
@@ -672,13 +672,13 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     else {
       watchdog('T_fasta_loader', "Failed to retreive newly inserted feature '%name (%uname)'", 
         array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
-      return 0;	
+      return 0;  
     }   
   }
   
   // if we don't have a feature and the uesr wants to do an update then fail
   if (!$feature and (strcmp($method, 'Update only')==0 or drupal_strcmp($method, 'Insert and update')==0)) {
-    watchdog('T_fasta_loader',"Failed to find feature '%name' ('%name') while matching on " . 
+    watchdog('T_fasta_loader', "Failed to find feature '%name' ('%name') while matching on " . 
       drupal_strtolower($match_type), array('%name' => $name, '%uiname' => $uname), WATCHDOG_ERROR);
     return 0;
   }
@@ -689,19 +689,19 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       // if we're matching on the name but do not have a new unique name then we don't want to update the uniquename.  
       $values = array();
       if ($uname) {
-		    $values = array(
-		      'residues' => $residues,
-		      'seqlen' => drupal_strlen($residues),
-		      'md5checksum' => md5($residues),
-		      'is_analysis' => 'false',
-		      'is_obsolete' => 'false',
-		    );
-		    $match = array(
+        $values = array(
+          'residues' => $residues,
+          'seqlen' => drupal_strlen($residues),
+          'md5checksum' => md5($residues),
+          'is_analysis' => 'false',
+          'is_obsolete' => 'false',
+        );
+        $match = array(
           'organism_id' => $organism_id,
           'name' => $name,
-          'type_id' => $cvterm->cvterm_id,		    
-		    );
-		    $options = array('statement_name' => 'upd_feature_resemdisis_ornaty');		    
+          'type_id' => $cvterm->cvterm_id,        
+        );
+        $options = array('statement_name' => 'upd_feature_resemdisis_ornaty');        
       }
       // if we have a unique name then update it after matching by the name
       else {
@@ -722,7 +722,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       }
       $success = tripal_core_chado_update('feature', $match, $values, $options);
       if (!$success) {
-        watchdog('T_fasta_loader',"Failed to update feature '%name' ('%name')", 
+        watchdog('T_fasta_loader', "Failed to update feature '%name' ('%name')", 
           array('%name' => $name, '%uiname' => $uname), WATCHDOG_ERROR);
         return 0;
       }
@@ -764,7 +764,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       }
       $success = tripal_core_chado_update('feature', $match, $values, $options);
       if (!$success) {
-        watchdog('T_fasta_loader',"Failed to update feature '%name' ('%name')", 
+        watchdog('T_fasta_loader', "Failed to update feature '%name' ('%name')", 
           array('%name' => $name, '%uiname' => $uname), WATCHDOG_ERROR);
         return 0;
       }
@@ -773,50 +773,50 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
   
   // add in the analysis link
   if ($analysis_id) {
-  	// if the association doens't alredy exist then add one
-  	$values = array(
-  	  'analysis_id' => $analysis_id,
-  	  '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);
+    // if the association doens't alredy exist then add one
+    $values = array(
+      'analysis_id' => $analysis_id,
+      '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);
     if (count($results) == 0) {
-    	$ins_options = array('statement_name' => 'ins_analysisfeature_anfe');
-    	$success = tripal_core_chado_insert('analysisfeature', $values, $ins_options);    	
-    	if (!$success) {
-    	  watchdog('T_fasta_loader',"Failed to associate analysis and feature '%name' ('%name')", 
+      $ins_options = array('statement_name' => 'ins_analysisfeature_anfe');
+      $success = tripal_core_chado_insert('analysisfeature', $values, $ins_options);      
+      if (!$success) {
+        watchdog('T_fasta_loader', "Failed to associate analysis and feature '%name' ('%name')", 
           array('%name' => $name, '%uname' => $uname), WATCHDOG_ERROR);
-        return 0;	
-    	}
+        return 0;  
+      }
     }
   }
 
    // now add the database cross reference
   if ($db_id) {
-  	// check to see if this accession reference exists, if not add it
-  	$values = array(
-  	  'db_id' => $db_id,
-  	  'accession' => $accession
-  	);
-  	$sel_options = array('statement_name' => 'sel_dbxref_dbac');
-  	$results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
-  	if (count($results) == 0) {   
-  	  $ins_options = array('statement_name' => 'sel_dbxref_dbac');
+    // check to see if this accession reference exists, if not add it
+    $values = array(
+      'db_id' => $db_id,
+      'accession' => $accession
+    );
+    $sel_options = array('statement_name' => 'sel_dbxref_dbac');
+    $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
+    if (count($results) == 0) {   
+      $ins_options = array('statement_name' => 'sel_dbxref_dbac');
       $success = tripal_core_chado_insert('dbxref', $values, $ins_options);
       if (!$success) {
-        watchdog('T_fasta_loader',"Failed to add database accession '%accession'", 
+        watchdog('T_fasta_loader', "Failed to add database accession '%accession'", 
           array('%accession' => $accession), WATCHDOG_ERROR);
         return 0;
       }
       $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
-      if(count($results) == 1) {
+      if (count($results) == 1) {
         $dbxref = $results[0];
-  	  }
-  	  else { 
-  	    watchdog('T_fasta_loader', "Failed to retreive newly inserted dbxref '%name (%uname)'", 
+      }
+      else { 
+        watchdog('T_fasta_loader', "Failed to retreive newly inserted dbxref '%name (%uname)'", 
           array('%name' => $name, '%uname' => $numane), WATCHDOG_ERROR);
         return 0;
-  	  }
+      }
     }
 
     // check to see if the feature dbxref record exists if not, then add it
@@ -830,7 +830,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'ins_featuredbxref_fedb');
       $success = tripal_core_chado_insert('feature_dbxref', $values, $ins_options);
       if (!$success) {
-        watchdog('T_fasta_loader',"Failed to add associate database accession '%accession' with feature", 
+        watchdog('T_fasta_loader', "Failed to add associate database accession '%accession' with feature", 
           array('%accession' => $accession), WATCHDOG_ERROR);
         return 0;
       }
@@ -865,7 +865,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
       $ins_options = array('statement_name' => 'sel_featurerelationship_suojty');
       $success = tripal_core_chado_insert('feature_relationship', $values, $ins_options);
       if (!$success) {
-        watchdog('T_fasta_loader',"Failed to add associate database accession '%accession' with feature", 
+        watchdog('T_fasta_loader', "Failed to add associate database accession '%accession' with feature", 
           array('%accession' => $accession), WATCHDOG_ERROR);
         return 0;
       }

+ 92 - 92
tripal_feature/includes/gff_loader.inc

@@ -163,10 +163,10 @@ function tripal_feature_gff3_load_form_validate($form, &$form_state) {
   }
 
   // @coder-ignore: there are no functions being called here
-  if (($add_only AND ($update OR $refresh OR $remove)) OR
-      ($update AND ($add_only OR $refresh OR $remove)) OR
-      ($refresh AND ($update OR $add_only OR $remove)) OR
-      ($remove AND ($update OR $refresh OR $add_only))) {
+  if (($add_only AND ($update   OR $refresh  OR $remove)) OR
+      ($update   AND ($add_only OR $refresh  OR $remove)) OR
+      ($refresh  AND ($update   OR $add_only OR $remove)) OR
+      ($remove   AND ($update   OR $refresh  OR $add_only))) {
       form_set_error('add_only', t("Please select only one checkbox from the import options section"));
   }
 }
@@ -221,33 +221,33 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
   // make sure our temporary table exists
   $ret = array(); 
   if (!db_table_exists('tripal_gff_temp')) { 
-	  $schema = tripal_feature_get_custom_tables('tripal_gff_temp');  
-	  $success = tripal_core_create_custom_table($ret, 'tripal_gff_temp', $schema['tripal_gff_temp']);
-	  if(!$success) {
-	  	 watchdog('T_gff3_loader', "Cannot creat temporary loading table", array(), WATCHDOG_ERROR); 
-	  	return;
-	  } 
+    $schema = tripal_feature_get_custom_tables('tripal_gff_temp');  
+    $success = tripal_core_create_custom_table($ret, 'tripal_gff_temp', $schema['tripal_gff_temp']);
+    if (!$success) {
+      watchdog('T_gff3_loader', "Cannot creat temporary loading table", array(), WATCHDOG_ERROR); 
+      return;
+    } 
   }
   // empty the temp table
   $sql = "DELETE FROM tripal_gff_temp";
   chado_query($sql);
-  	
+    
   // begin the transaction
   if ($use_transaction) {
     $connection = tripal_db_start_transaction();
         
-	  // if we cannot get a connection then let the user know the loading will be slow
-	  if (!$connection) {
-	     print "A persistant connection was not obtained. Loading will be slow\n";
-	  }
-	  else {
-	  	 print "\nNOTE: Loading of this GFF file is performed using a database transaction. \n" .
-	  	       "If the load fails or is terminated prematurely then the entire set of \n" .
-	  	       "insertions/updates is rolled back and will not be found in the database\n\n";
-	  }
+    // if we cannot get a connection then let the user know the loading will be slow
+    if (!$connection) {
+       print "A persistant connection was not obtained. Loading will be slow\n";
+    }
+    else {
+       print "\nNOTE: Loading of this GFF file is performed using a database transaction. \n" .
+             "If the load fails or is terminated prematurely then the entire set of \n" .
+             "insertions/updates is rolled back and will not be found in the database\n\n";
+    }
   }
   else {
-  	$connection = tripal_db_persistent_chado();
+    $connection = tripal_db_persistent_chado();
     if (!$connection) {
        print "A persistant connection was not obtained. Loading will be slow\n";
     }
@@ -261,7 +261,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     $dfile = $gff_file;
   }
   if (!file_exists($dfile)) {
-    watchdog('T_gff3_loader',"Cannot find the file: %dfile", 
+    watchdog('T_gff3_loader', "Cannot find the file: %dfile", 
       array('%dfile' => $dfile), WATCHDOG_ERROR);
     return 0;
   }
@@ -272,7 +272,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) {
-    watchdog('T_gff3_loader',"cannot open file: %dfile", 
+    watchdog('T_gff3_loader', "cannot open file: %dfile", 
       array('%dfile' => $dfile), WATCHDOG_ERROR);
     return 0;
   }
@@ -284,7 +284,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
   $sql = "SELECT * FROM cv WHERE name = '%s'";
   $cv = db_fetch_object(chado_query($sql, 'sequence'));
   if (!$cv) {   
-    watchdog('T_gff3_loader',"Cannot find the 'sequence' ontology", 
+    watchdog('T_gff3_loader', "Cannot find the 'sequence' ontology", 
       array(), WATCHDOG_ERROR);
     return '';
   }
@@ -341,7 +341,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     // get the columns
     $cols = explode("\t", $line);
     if (sizeof($cols) != 9) {
-      watchdog('T_gff3_loader','improper number of columns on line %line_num', 
+      watchdog('T_gff3_loader', 'improper number of columns on line %line_num', 
         array('%line_num' => $line_num), WATCHDOG_ERROR);
       return '';
     }
@@ -391,7 +391,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
                WHERE CV.cv_id = $1 and (CVT.name = $2 or CVTS.synonym = $3)";
        $status = chado_query($psql);
        if (!$status) {
-         watchdog('T_gff3_loader','cannot prepare statement \'sel_cvterm_cvid_cvtname_synonym\' for ontology term %line_num', 
+         watchdog('T_gff3_loader', 'cannot prepare statement \'sel_cvterm_cvid_cvtname_synonym\' for ontology term %line_num', 
            array('%line_num' => $line_num), WATCHDOG_ERROR);
          return '';
       }
@@ -402,7 +402,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
    
     $cvterm = db_fetch_object($result);
     if (!$cvterm) {
-      watchdog('T_gff3_loader','cannot find ontology term \'%type\' on line %line_num', 
+      watchdog('T_gff3_loader', 'cannot find ontology term \'%type\' on line %line_num', 
         array('%type' => $type, '%line_num' => $line_num), WATCHDOG_ERROR);
       return '';
     }
@@ -427,7 +427,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         continue;
       }
       if (!preg_match('/^[^\=]+\=.+$/', $attr)) {
-        watchdog('T_gff3_loader','Attribute is not correctly formatted on line %line_num: %attr', 
+        watchdog('T_gff3_loader', 'Attribute is not correctly formatted on line %line_num: %attr', 
           array('%line_num' => $line_num, '%attr' => $attr), WATCHDOG_ERROR);
         return '';
       }
@@ -461,7 +461,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
               strcmp($tag_name, 'Derives_from') !=0 and strcmp($tag_name, 'Note') !=0 and
               strcmp($tag_name, 'Dbxref') !=0       and strcmp($tag_name, 'Ontology_term') !=0 and
               strcmp($tag_name, 'Is_circular') !=0) {
-        foreach ($tags[$tag_name] as $value){
+        foreach ($tags[$tag_name] as $value) {
           $attr_others[$tag_name][] = $value;
         }
       }
@@ -473,7 +473,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         $attr_uniquename = $tags['Parent'][0] . "-$type-$landmark:$fmin..$fmax";
       }
       else {
-        watchdog('T_gff3_loader','Cannot generate a uniquename for feature on line %line_num', 
+        watchdog('T_gff3_loader', 'Cannot generate a uniquename for feature on line %line_num', 
           array('%line_num' => $line_num), WATCHDOG_ERROR);
         exit;
       }
@@ -505,14 +505,14 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
       $options = array('statement_name' => 'sel_feature_organismid_uniquename');
       $count = tripal_core_chado_select('feature', $columns, $select, $options);
       if (!$count or $count[0]->num_landmarks == 0) {
-        watchdog('T_gff3_loader',"The landmark '%landmark' cannot be found for this organism. ".
+        watchdog('T_gff3_loader', "The landmark '%landmark' cannot be found for this organism. ".
               "Please add the landmark and then retry the import of this GFF3 ".
               "file", array('%landmark' => $landmark), WATCHDOG_ERROR);
         return '';
 
       }
       if ($count[0]->num_landmarks > 1) {
-        watchdog('T_gff3_loader',"The landmark '%landmark' is not unique for this organism. ".
+        watchdog('T_gff3_loader', "The landmark '%landmark' is not unique for this organism. ".
               "The features cannot be associated", array('%landmark' => $landmark), WATCHDOG_ERROR);
         return '';
       }  
@@ -528,9 +528,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 = tripal_core_chado_delete('feature', $match);
       if (!$result) {
-        watchdog('T_gff3_loader',"cannot delete feature %attr_uniquename", 
+        watchdog('T_gff3_loader', "cannot delete feature %attr_uniquename", 
           array('%attr_uniquename' => $attr_uniquename), WATCHDOG_ERROR);
       }
       $feature = 0;
@@ -546,8 +546,8 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         $attr_is_obsolete, $add_only, $score);  
    
       if ($feature) {
-      	
-      	// add a record for this feature to the tripal_gff_temp table for
+        
+        // add a record for this feature to the tripal_gff_temp table for
         // later lookup
         $values = array(
           'feature_id' => $feature->feature_id,
@@ -558,7 +558,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         $options = array('statement_name' => 'ins_tripalgfftemp');
         $result = tripal_core_chado_insert('tripal_gff_temp', $values, $options);
         if (!$result) {
-          watchdog('T_gff3_loader',"Cound not save record in temporary table, Cannot continue.", array(), WATCHDOG_ERROR);
+          watchdog('T_gff3_loader', "Cound not save record in temporary table, Cannot continue.", array(), WATCHDOG_ERROR);
           return;
         }
 
@@ -637,7 +637,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         // add any additional attributes
         if ($attr_others) {
           foreach ($attr_others as $tag_name => $values) {
-            foreach ($values as $value){
+            foreach ($values as $value) {
               tripal_feature_load_gff3_property($feature, $tag_name, $value);
             }
           }
@@ -674,7 +674,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     if (!$success) {
       watchdog("T_gff3_loader", "Cannot prepare statement 'sel_gffchildren' and cannot set children ranks.", 
          array(), WATCHDOG_WARNING);
-      return 0;	
+      return 0;  
     }
   }
   
@@ -683,21 +683,21 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
   // relationships to be '0' (the default), and doesn't interfer with the
   // ordering defined here.        
   while ($parent = db_fetch_object($parents)) {
-  	
-  	// get the children
-  	if ($connection) {  		
-  		$result = chado_query('EXECUTE sel_gffchildren (%d)', $parent->feature_id);
-  	}
-  	else {
-  		$result = chado_query($sql, $parent->feature_id);
-  	}
-  	
-  	// build an array of the children
-  	$children = array();
+    
+    // get the children
+    if ($connection) {      
+      $result = chado_query('EXECUTE sel_gffchildren (%d)', $parent->feature_id);
+    }
+    else {
+      $result = chado_query($sql, $parent->feature_id);
+    }
+    
+    // build an array of the children
+    $children = array();
     while ($child = db_fetch_object($result)) {
        $children[] = $child;  
     }
-  	
+    
     // sort the children come in order of their fmin position
     // but if the parent is on the reverse strand we need to 
     // reverse the order of the children.
@@ -719,7 +719,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     $rank = 0;
     foreach ($children as $child) {
       $match = array('feature_relationship_id' => $child->feature_relationship_id);
-      $options = array('statement_name' => 'upd_featurerelationship_rank');    	
+      $options = array('statement_name' => 'upd_featurerelationship_rank');      
       $values = array('rank' => $rank); 
       //print "Was: " . $child->rank . " now $rank ($parent->strand)\n"     ;
       tripal_core_chado_update('feature_relationship', $match, $values, $options);
@@ -742,7 +742,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
  */
 function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
 
-	// get the subject type
+  // get the subject type
   $values = array(
     'organism_id' => $organism->organism_id,
     'uniquename' => $subject,
@@ -754,7 +754,7 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
      return ''; 
   }
   $subject_type = $result[0]->type_name;
-	
+  
   // get the subject feature
   $match = array(
     'organism_id' => $organism->organism_id,
@@ -769,7 +769,7 @@ function tripal_feature_load_gff3_derives_from($feature, $subject, $organism) {
   $options = array('statement_name' => 'sel_feature_orunty');
   $sfeature = tripal_core_chado_select('feature', array('feature_id'), $match, $options);
   if (count($sfeature)==0) {
-    watchdog('T_gff3_loader',"Could not add 'Derives_from' relationship ".
+    watchdog('T_gff3_loader', "Could not add 'Derives_from' relationship ".
       "for %uniquename and %subject.  Subject feature, '%subject', ".
       "cannot be found", array('%uniquename' => $feature->uniquename, '%subject' => $subject), WATCHDOG_ERROR);
     return;
@@ -830,17 +830,17 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
 
   // iterate through the parents in the list
   foreach ($parents as $parent) {
-  	// get the parent cvterm
-  	$values = array(
-  	  'organism_id' => $organism_id,
+    // get the parent cvterm
+    $values = array(
+      'organism_id' => $organism_id,
       'uniquename' => $parent,
-  	);
-  	$options = array('statement_name' => 'sel_tripalgfftemp_orun');
-  	$result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values, $options);  	
-  	if (count($result) == 0) {
-  	  watchdog("T_gff3_loader", "Cannot find parent type: %parent", array('%parent' => $parent), WATCHDOG_WARNING);
-       return '';	
-  	}
+    );
+    $options = array('statement_name' => 'sel_tripalgfftemp_orun');
+    $result = tripal_core_chado_select('tripal_gff_temp', array('type_name'), $values, $options);    
+    if (count($result) == 0) {
+      watchdog("T_gff3_loader", "Cannot find parent type: %parent", array('%parent' => $parent), WATCHDOG_WARNING);
+       return '';  
+    }
     $parent_type = $result[0]->type_name;
 
     // try to find the parent
@@ -915,18 +915,18 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
     $options = array('statement_name' => 'sel_db_name');
     $db = tripal_core_chado_select('db', array('db_id'), $values, $options);
     if (count($db) == 0) {
-    	$values = array('name' => "$dbname");
+      $values = array('name' => "$dbname");
       $db = tripal_core_chado_select('db', array('db_id'), $values, $options);
     }
     if (count($db) == 0) {
-    	$values = array(
-    	  'name' => $dbname,
+      $values = array(
+        'name' => $dbname,
         'description' => 'Added automatically by the GFF loader'
-    	);
+      );
       $options = array('statement_name' => 'ins_db_name');
       $success = tripal_core_chado_insert('db', $values, $options);
       if ($success) {
-      	$values = array('name' => "$dbname");
+        $values = array('name' => "$dbname");
         $options = array('statement_name' => 'sel_db_name');        
         $db = tripal_core_chado_select('db', array('db_id'), $values, $options);
       }
@@ -947,8 +947,8 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
 
     // if the accession doesn't exist then we want to add it
     if (sizeof($dbxref) == 0) {
-    	$values = array(
-    	  'db_id' => $db->db_id,
+      $values = array(
+        'db_id' => $db->db_id,
         'accession' => $accession, 
         'version' => ''
       );
@@ -974,10 +974,10 @@ function tripal_feature_load_gff3_dbxref($feature, $dbxrefs) {
     // now associate this feature with the database reference if it doesn't
     // already exist
     if (sizeof($fdbx) == 0) {
-    	$values = array(
+      $values = array(
         'dbxref_id' => $dbxref->dbxref_id,
         'feature_id' => $feature->feature_id
-    	);
+      );
       $options = array('statement_name' => 'ins_featuredbxref_dbxrefid_featureid');
       $success = tripal_core_chado_insert('feature_dbxref', $values, $options);
       if (!$success) {
@@ -1007,7 +1007,7 @@ function tripal_feature_load_gff3_ontology($feature, $dbxrefs) {
     $options = array('statement_name' => 'sel_db_name');
     $db = tripal_core_chado_select('db', array('db_id'), array('name' => "DB:$dbname"), $options);
     if (sizeof($db) == 0) {
-    	// now look for the name without the 'DB:' prefix.
+      // now look for the name without the 'DB:' prefix.
       $db = tripal_core_chado_select('db', array('db_id'), array('name' => "$dbname"), $options);
       if (sizeof($db) == 0) {
         watchdog("T_gff3_loader", "Database, $dbname is missing for reference: $dbname:$accession", array(), WATCHDOG_WARNING);
@@ -1153,13 +1153,13 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       if (!$success) {
         watchdog("T_gff3_loader", "Cannot add alias $alias to synonym table", array(), WATCHDOG_WARNING);
         return 0;
-	    }
-	    $options = array('statement_name' => 'sel_synonym_name_typeid');
-	    $result = tripal_core_chado_select('synonym', array('*'), $select, $options);
-	    $synonym = $result[0];
+      }
+      $options = array('statement_name' => 'sel_synonym_name_typeid');
+      $result = tripal_core_chado_select('synonym', array('*'), $select, $options);
+      $synonym = $result[0];
     }
     else {
-      $synonym = $result[0];	
+      $synonym = $result[0];  
     }
 
     // check to see if we have a NULL publication in the pub table.  If not,
@@ -1195,7 +1195,7 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
       $pub = $result[0];
     }
     else {
-      $pub = $result[0];	
+      $pub = $result[0];  
     }
 
     // check to see if the synonym exists in the feature_synonym table
@@ -1209,11 +1209,11 @@ function tripal_feature_load_gff3_alias($feature, $aliases) {
     $options = array('statement_name' => 'sel_featuresynonym_syfepu');
     $result = tripal_core_chado_select('feature_synonym', $columns, $values, $options);
     if (count($result) == 0) {      
-	    $values = array(
-	       'synonym_id' => $synonym->synonym_id,
-	       'feature_id' => $feature->feature_id,
-	       'pub_id' => $pub->pub_id,
-	    );  
+      $values = array(
+         'synonym_id' => $synonym->synonym_id,
+         'feature_id' => $feature->feature_id,
+         'pub_id' => $pub->pub_id,
+      );  
       $ins_options = array('statement_name' => 'ins_featuresynonym_syfepu');
       $success = tripal_core_chado_insert('feature_synonym', $values, $ins_options);   
      
@@ -1379,7 +1379,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
     );
     $options = array('statement_name' => 'sel_feature_organism_id_name');
     $r = tripal_core_chado_select('feature', array('feature_id'), $select, $options);
-    if (count($r) == 0){
+    if (count($r) == 0) {
        watchdog("T_gff3_loader", "Cannot find landmark feature: '$landmark'.  Cannot add the feature location record", array(), WATCHDOG_WARNING);
        return 0;
     } 
@@ -1466,7 +1466,7 @@ function tripal_feature_load_gff3_featureloc($feature, $organism, $landmark, $fm
        'rank'            => $rank 
     );
     $options = array('statement_name' => 'ins_featureloc_all');
-    if($phase) {
+    if ($phase) {
       $values['phase'] = $phase;
       $options = array('statement_name' => 'ins_featureloc_allphase');
     }
@@ -1504,9 +1504,9 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
       'is_obsolete' => 0,
     );    
     $cvterm = (object) tripal_cv_add_cvterm($term, 'feature_property', 0, 0);
-    if(!$cvterm){
+    if (!$cvterm) {
       watchdog("T_gff3_loader", "Cannot add cvterm, $property", array(), WATCHDOG_WARNING);
-      return 0;	
+      return 0;  
     }
   }
   $cvterm = $result[0];
@@ -1528,7 +1528,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
     ),
   );
   $results = tripal_core_chado_select('featureprop', array('*'), $select, $options);
-  foreach ($results as $prop){
+  foreach ($results as $prop) {
     if (strcmp($prop->value, $value)==0) {
       $add = NULL; // don't add it, it already exists
     }
@@ -1545,7 +1545,7 @@ function tripal_feature_load_gff3_property($feature, $property, $value) {
     );
     $options = array('statement_name' => 'ins_featureprop_all');
     $result = tripal_core_chado_insert('featureprop', $values, $options);
-    if(!$result){
+    if (!$result) {
       watchdog("T_gff3_loader", "cannot add featureprop, $property", array(), WATCHDOG_WARNING);
     }
   }

+ 3 - 3
tripal_feature/includes/syncFeatures.inc

@@ -155,11 +155,11 @@ function tripal_feature_set_feature_url($node, $feature) {
       $url_alias = $feature->uniquename;
       break;
     case 'genus_species_uqname':
-    	$url_alias = $genus . "/" . $genus . "_" . $species . "/" . $feature->uniquename;
+      $url_alias = $genus . "/" . $genus . "_" . $species . "/" . $feature->uniquename;
       break;
     case 'genus species name':
       $url_alias = $genus . "/" . $genus . "_" . $species . "/" . $feature->name;
-    	break;
+      break;
     default:
       $url_alias = "$aprefix$feature->feature_id";
   }
@@ -348,7 +348,7 @@ function tripal_feature_sync_feature($feature_id) {
   $cfsql = "SELECT * FROM {chado_feature} ".
            "WHERE feature_id = %d";
   // @coder-ignore: don't need to use db_rewrite_sql() since need all nodes regardless of access control
-  $nsql =  "SELECT * FROM {node} ".
+  $nsql =  "SELECT * FROM {node} N ".
            "WHERE nid = %d";
   $chado_feature = db_fetch_object(db_query($cfsql, $feature->feature_id));
   if ($chado_feature) {

+ 3 - 2
tripal_feature/tripal_feature.coder_ignores.txt

@@ -13,9 +13,10 @@ gff_loader.php:252:sql
 gff_loader.php:919:sql
 
 ; This is a multi-line conditional that needs to be re-written to be more readable
-gff_loader.php:164:style
-gff_loader.php:165:style
 gff_loader.php:166:style
+gff_loader.php:167:style
+gff_loader.php:168:style
+gff_loader.php:169:style
 
 ; Don't need to use db_rewrite_sql() since need all nodes regardless of access control
 syncFeatures.php:425:sql

+ 2 - 2
tripal_feature/tripal_feature.drush.inc

@@ -76,7 +76,7 @@ function drush_tripal_feature_tripal_get_sequence() {
   $aggregate = drush_get_option('agg');
   $child = drush_get_option('child');
   
-  $sub_features = explode(',',$child);
+  $sub_features = explode(',', $child);
     
   if (!$output_format) {
      $output_format = 'fasta_txt';
@@ -131,5 +131,5 @@ function drush_tripal_feature_tripal_get_sequence() {
  */
 function drush_tripal_feature_sync() {
   $feature_id = drush_get_option('id');  
-	tripal_feature_sync_feature($feature_id);
+  tripal_feature_sync_feature($feature_id);
 }

+ 89 - 88
tripal_feature/tripal_feature.module

@@ -450,13 +450,13 @@ function chado_feature_insert($node) {
   $exists = tripal_core_chado_select('feature', array('*'), $values, $options);
   
   // if the record is not a duplicate then add it
-  if(!$exists){
-	  $istatus = tripal_core_chado_insert('feature', $values);
-	  if (!$istatus) {
-	    drupal_set_message(t('Unable to add feature.'), 'warning');
-	    watchdog('tripal_feature', 'Insert feature: Unable to create feature where values: %values',
-	      array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
-	  }
+  if (!$exists) {
+    $istatus = tripal_core_chado_insert('feature', $values);
+    if (!$istatus) {
+      drupal_set_message(t('Unable to add feature.'), 'warning');
+      watchdog('tripal_feature', 'Insert feature: Unable to create feature where values: %values',
+        array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+    }
   }
   
   // now get the newly added record
@@ -550,7 +550,7 @@ function chado_feature_delete($node) {
   
   // 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.
-  if (!$feature_id){
+  if (!$feature_id) {
     return;
   }
 
@@ -941,8 +941,8 @@ function chado_feature_load($node) {
   $values = array('feature_id' => $feature_id);
   $feature = tripal_core_generate_chado_var('feature', $values);
   
-  if(strcmp($feature->name,$feature->uniquename)==0){
-     $node->title = $feature->name ." (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
+  if (strcmp($feature->name, $feature->uniquename)==0) {
+     $node->title = $feature->name . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
   }
 
   $additions = new stdClass();
@@ -1305,7 +1305,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
       $rparts = array();  // we will fill this up if we're on the reverse strand
 
       foreach ($parts as $start => $types) {
-        foreach ($types as $type_name => $type){ 
+        foreach ($types as $type_name => $type) { 
           if ($featureloc->strand >= 0) {
              // this is on the forward strand.  We need to convert the start on the src feature to the 
              // start on this feature's sequence
@@ -1333,7 +1333,8 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
       // if we're on the reverse strand we need to resort
       if ($featureloc->strand >= 0) {
         usort($parts, 'tripal_feature_sort_rel_parts_by_start');         
-      } else {
+      } 
+      else {
         usort($rparts, 'tripal_feature_sort_rel_parts_by_start');
         $parts = $rparts;
       }
@@ -1709,11 +1710,11 @@ function tripal_feature_sort_rel_objects($a, $b) {
  * @ingroup tripal_feature
  */
 function tripal_feature_sort_rel_parts_by_start($a, $b) {
-  foreach ($a as $type_name => $details){
+  foreach ($a as $type_name => $details) {
      $astart = $a[$type_name]['start'];
      break;
   }
-  foreach ($b as $type_name => $details){
+  foreach ($b as $type_name => $details) {
      $bstart = $b[$type_name]['start'];
      break;
   }
@@ -1744,7 +1745,7 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
   $types = array();
   // first get the list of types so we can create a color legend
   foreach ($parts as $index => $t) {
-    foreach ($t as $type_name => $details){
+    foreach ($t as $type_name => $details) {
        $types[$type_name] = 1;
     }
   }
@@ -1780,7 +1781,7 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
         $newseq .= "\n";
       }
       if (array_key_exists($pos, $ends)) {
-        foreach ($ends[$pos] as $end){
+        foreach ($ends[$pos] as $end) {
           $newseq .= "</span>";
         }
       }
@@ -1789,7 +1790,7 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
 
     // we want to sort the parts by their end. We want the span tag to
     // to be added in the order the parts end. 
-    usort($types,'tripal_feature_sort_rel_parts_by_end');
+    usort($types, 'tripal_feature_sort_rel_parts_by_end');
     
     // now add the child span for all types that start at this position  
     foreach ($types as $type) {
@@ -1809,7 +1810,7 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
       $newseq .= "\n";
     }
     if (array_key_exists($pos, $ends)) {
-      foreach ($ends[$pos] as $end){
+      foreach ($ends[$pos] as $end) {
         $newseq .= "</span>";
       }
     }
@@ -2001,79 +2002,79 @@ function tripal_feature_preprocess_tripal_feature_relationships(&$variables) {
   
   // iterate through the object relationships
   if ($orelationships) {
-	  foreach ($orelationships as $relationship) {
-	     $rel = new stdClass(); 
-	     // get locations where the child feature and this feature overlap with the
-	     // same landmark feature.
-	     $rel->child_featurelocs = array();     
-	     foreach ($cfeaturelocs as $featureloc) {
-	        $res = chado_query("EXECUTE sel_featureloc_preprocess_relationships (%d, %d)", 
-	          $relationship->subject_id->feature_id, 
-	          $featureloc->srcfeature_id->feature_id);        
-	        while ($loc = db_fetch_object($res)){
-	           // add in the node id of the src feature if it exists and save this location
-	           $loc->nid = $featureloc->srcfeature_id->nid;
-	           $rel->child_featurelocs[] = $loc;
-	        }
-	     }
-	     $rel->record = $relationship;    
-	     
-	     // get the relationship and child types
-	     $rel_type = t(preg_replace('/_/'," ",$relationship->type_id->name));
-	     $child_type = $relationship->subject_id->type_id->name;
-	     
-	     // get the node id of the subject
-	     $sql = "SELECT nid FROM chado_feature WHERE feature_id = %d";
-	     $n = db_fetch_object(db_query($sql,$relationship->subject_id->feature_id));
-	     if($n){
-	        $rel->record->nid = $n->nid;
-	     }
-	
-	     if (!array_key_exists($rel_type, $relationships['object'])) {
-	       $relationships['object'][$rel_type] = array();   
-	     }
-	     if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
-	       $relationships['object'][$rel_type][$child_type] = array();   
-	     }
-	     $relationships['object'][$rel_type][$child_type][] = $rel;     
-	  }
+    foreach ($orelationships as $relationship) {
+       $rel = new stdClass(); 
+       // get locations where the child feature and this feature overlap with the
+       // same landmark feature.
+       $rel->child_featurelocs = array();     
+       foreach ($cfeaturelocs as $featureloc) {
+          $res = chado_query("EXECUTE sel_featureloc_preprocess_relationships (%d, %d)", 
+            $relationship->subject_id->feature_id, 
+            $featureloc->srcfeature_id->feature_id);        
+          while ($loc = db_fetch_object($res)) {
+             // add in the node id of the src feature if it exists and save this location
+             $loc->nid = $featureloc->srcfeature_id->nid;
+             $rel->child_featurelocs[] = $loc;
+          }
+       }
+       $rel->record = $relationship;    
+       
+       // get the relationship and child types
+       $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
+       $child_type = $relationship->subject_id->type_id->name;
+       
+       // get the node id of the subject
+       $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = %d";
+       $n = db_fetch_object(db_query($sql, $relationship->subject_id->feature_id));
+       if ($n) {
+          $rel->record->nid = $n->nid;
+       }
+  
+       if (!array_key_exists($rel_type, $relationships['object'])) {
+         $relationships['object'][$rel_type] = array();   
+       }
+       if (!array_key_exists($child_type, $relationships['object'][$rel_type])) {
+         $relationships['object'][$rel_type][$child_type] = array();   
+       }
+       $relationships['object'][$rel_type][$child_type][] = $rel;     
+    }
   }
   
   // now add in the subject relationships
   if ($srelationships) {
-	  foreach ($srelationships as $relationship) {
-	     $rel = new stdClass(); 
-	     // get locations where this feature overlaps with the parent
-	     $rel->parent_featurelocs = array();     
-	     foreach ($cfeaturelocs as $featureloc) {
-	        $res = chado_query("EXECUTE sel_featureloc_preprocess_relationships (%d, %d)", 
-	          $relationship->object_id->feature_id, 
-	          $featureloc->srcfeature_id->feature_id);
-	        while ($loc = db_fetch_object($res)){
-	           // add in the node id of the src feature if it exists and save this location
-	           $loc->nid = $featureloc->srcfeature_id->nid;
-	           $rel->parent_featurelocs[] = $loc;
-	        }
-	     }
-	     $rel->record = $relationship;
-	     $rel_type = t(preg_replace('/_/'," ",$relationship->type_id->name));
-	     $parent_type = $relationship->object_id->type_id->name;
-	     
-	     // get the node id of the subject
-	     $sql = "SELECT nid FROM chado_feature WHERE feature_id = %d";
-	     $n = db_fetch_object(db_query($sql,$relationship->object_id->feature_id));
-	     if($n){
-	        $rel->record->nid = $n->nid;
-	     }
-	     
-	     if (!array_key_exists($rel_type, $relationships['subject'])) {
-	       $relationships['subject'][$rel_type] = array();   
-	     }
-	     if (!array_key_exists($child_type, $relationships['subject'][$rel_type])) {
-	       $relationships['subject'][$rel_type][$parent_type] = array();   
-	     }
-	     $relationships['subject'][$rel_type][$parent_type][] = $rel;
-	  }
+    foreach ($srelationships as $relationship) {
+       $rel = new stdClass(); 
+       // get locations where this feature overlaps with the parent
+       $rel->parent_featurelocs = array();     
+       foreach ($cfeaturelocs as $featureloc) {
+          $res = chado_query("EXECUTE sel_featureloc_preprocess_relationships (%d, %d)", 
+            $relationship->object_id->feature_id, 
+            $featureloc->srcfeature_id->feature_id);
+          while ($loc = db_fetch_object($res)) {
+             // add in the node id of the src feature if it exists and save this location
+             $loc->nid = $featureloc->srcfeature_id->nid;
+             $rel->parent_featurelocs[] = $loc;
+          }
+       }
+       $rel->record = $relationship;
+       $rel_type = t(preg_replace('/_/', " ", $relationship->type_id->name));
+       $parent_type = $relationship->object_id->type_id->name;
+       
+       // get the node id of the subject
+       $sql = "SELECT nid FROM {chado_feature} WHERE feature_id = %d";
+       $n = db_fetch_object(db_query($sql, $relationship->object_id->feature_id));
+       if ($n) {
+          $rel->record->nid = $n->nid;
+       }
+       
+       if (!array_key_exists($rel_type, $relationships['subject'])) {
+         $relationships['subject'][$rel_type] = array();   
+       }
+       if (!array_key_exists($child_type, $relationships['subject'][$rel_type])) {
+         $relationships['subject'][$rel_type][$parent_type] = array();   
+       }
+       $relationships['subject'][$rel_type][$parent_type][] = $rel;
+    }
   }
   $feature->all_relationships = $relationships;
 
@@ -2716,7 +2717,7 @@ 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 = tripal_core_chado_select('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]));
     $new_args['Analysis'] = $analysis[0]->name;   

+ 5 - 5
tripal_feature/tripal_feature.views.inc

@@ -38,10 +38,10 @@ function tripal_feature_views_data()  {
     );
         
     foreach ($tables as $tablename) {
-    	$priority = 9;
-    	
-    	// check to see if the table is integrated. If it is then integrate it's
-    	// corresponding 'chado_[table]' table.
+      $priority = 9;
+      
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
@@ -82,7 +82,7 @@ function tripal_feature_views_data()  {
       'featurerange'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 17 - 17
tripal_featuremap/tripal_featuremap.install

@@ -66,25 +66,25 @@ function tripal_featuremap_get_schemas() {
         'default' => 0
       ),
       'nid' => array(
-	      'type' => 'int',
-	      'unsigned' => TRUE,
-	      'not null' => TRUE,
-	      'default' => 0
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'featuremap_id' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0
+        )
+      ),
+      'indexes' => array(
+        'featuremap_id' => array('featuremap_id')
       ),
-	    'featuremap_id' => array(
-	      'type' => 'int',
-	      'not null' => TRUE,
-	      'default' => 0
-	      )
+      'unique keys' => array(
+        'nid_vid' => array('nid', 'vid'),
+        'vid' => array('vid')
       ),
-	    'indexes' => array(
-	      'featuremap_id' => array('featuremap_id')
-	    ),
-	    'unique keys' => array(
-	      'nid_vid' => array('nid', 'vid'),
-	      'vid' => array('vid')
-	    ),
-	    'primary key' => array('nid'),
+      'primary key' => array('nid'),
   );
   return $schema;
 }

+ 16 - 16
tripal_featuremap/tripal_featuremap.module

@@ -314,16 +314,16 @@ function tripal_featuremap_nodeapi(&$node, $op, $teaser, $page) {
     // node.
     case 'view':
       // add the map to the organism/feature search indexing
-	    if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
-	      $node->content['tripal_featuremap_index_version'] = array(
-	        '#value' => theme('tripal_featuremap_search_index', $node),
-	      );
-	    }
-	    elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
-	      $node->content['tripal_featuremap_index_version'] = array(
-	        '#value' => theme('tripal_featuremap_search_result', $node),
-	      );
-	    }	    
+      if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
+        $node->content['tripal_featuremap_index_version'] = array(
+          '#value' => theme('tripal_featuremap_search_index', $node),
+        );
+      }
+      elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
+        $node->content['tripal_featuremap_index_version'] = array(
+          '#value' => theme('tripal_featuremap_search_result', $node),
+        );
+      }      
   }
 }
 
@@ -346,10 +346,10 @@ function tripal_featuremap_theme() {
        'arguments' => array('node' => NULL),
        'template' => 'tripal_featuremap_base',
     ),
-  	'tripal_featuremap_properties' => array(
-  		'arguments' => array('node' => NULL),
-  		'template' => 'tripal_featuremap_properties',
-  	),
+    'tripal_featuremap_properties' => array(
+      'arguments' => array('node' => NULL),
+      'template' => 'tripal_featuremap_properties',
+    ),
   );
 }
 
@@ -730,7 +730,7 @@ function chado_featuremap_insert($node) {
   else {
     $values = array(
       'name' => $node->title,
-    	'description' => $node->description,
+      'description' => $node->description,
     );
     $featuremap = tripal_core_chado_insert('featuremap', $values);
   }
@@ -949,7 +949,7 @@ function chado_featuremap_delete(&$node) {
   
   // 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.
-  if (!$featuremap_id){
+  if (!$featuremap_id) {
     return;
   }
   

+ 1 - 1
tripal_featuremap/tripal_featuremap.views.inc

@@ -64,7 +64,7 @@ function tripal_featuremap_views_data()  {
       'mapprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_genetic/tripal_genetic.views.inc

@@ -50,7 +50,7 @@ function tripal_genetic_views_data()  {
       'phenotype_comparison'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         $status = tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_library/tripal_library.module

@@ -1459,7 +1459,7 @@ function chado_library_delete(&$node) {
   
   // 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.
-  if (!$library_id){
+  if (!$library_id) {
     return;
   }
   

+ 1 - 1
tripal_library/tripal_library.views.inc

@@ -64,7 +64,7 @@ function tripal_library_views_data()  {
       'libraryprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_natural_diversity/tripal_natural_diversity.views.inc

@@ -71,7 +71,7 @@ function tripal_natural_diversity_views_data()  {
       'nd_reagentprop'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_organism/tripal_organism.module

@@ -802,7 +802,7 @@ function chado_organism_delete($node) {
   
   // 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.
-  if (!$organism_id){
+  if (!$organism_id) {
     return;
   }
 

+ 1 - 1
tripal_organism/tripal_organism.views.inc

@@ -68,7 +68,7 @@ function tripal_organism_views_data()  {
       'organism_dbxref'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;    	
+      $priority = 9;      
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 6 - 6
tripal_phenotype/tripal_phenotype.views.inc

@@ -28,11 +28,11 @@ function tripal_phenotype_views_data()  {
       'phenotype'
     );
     foreach ($tables as $tablename) {
-	    $priority = 9;
-	      
-	    // check to see if the table is integrated. If it is then integrate it's
-	    // corresponding 'chado_[table]' table.
-	    if (!tripal_views_is_integrated($tablename, $priority)) {
+      $priority = 9;
+        
+      // check to see if the table is integrated. If it is then integrate it's
+      // corresponding 'chado_[table]' table.
+      if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority);
 
         // Add specialty handlers
@@ -54,7 +54,7 @@ function tripal_phenotype_views_data()  {
       'phenotype_cvterm'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_project/tripal_project.views.inc

@@ -51,7 +51,7 @@ function tripal_project_views_data()  {
     $tables = array(
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 1 - 1
tripal_stock/tripal_stock.views.inc

@@ -72,7 +72,7 @@ function tripal_stock_views_data()  {
       'stockprop_pub'
     );
     foreach ($tables as $tablename) {
-    	$priority = 9;     
+      $priority = 9;     
       if (!tripal_views_is_integrated($tablename, $priority)) {
         $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority);
         tripal_views_integration_add_entry($table_integration_array);

+ 3 - 3
tripal_views/api/tripal_views.api.inc

@@ -27,7 +27,7 @@ function tripal_views_get_table_lightest_priority($table_name) {
     return $setup->priority;
   }
   else {
-  	// default priority is 10
+    // default priority is 10
     return 10;
   }
 }
@@ -172,7 +172,7 @@ function tripal_views_integration_add_entry($defn_array) {
   }
   if ($view_record['name']) { // && $view_record['comment']) {  # SPF: commented out 9/24/2012 .. It's not required on the form
     if ($defn_array['additional_content']) {
-      $setup = db_fetch_object(db_query("SELECT * FROM {tripal_views} WHERE table_name='%s' AND priority=%d",$view_record['table_name'], $view_record['priority']));
+      $setup = db_fetch_object(db_query("SELECT * FROM {tripal_views} WHERE table_name='%s' AND priority=%d", $view_record['table_name'], $view_record['priority']));
       if (empty($setup->setup_id)) {
         $status = drupal_write_record('tripal_views', $view_record);
       }
@@ -213,7 +213,7 @@ function tripal_views_integration_add_entry($defn_array) {
       );
       if ($view_record['setup_id'] && $field['name'] && $field['title'] && $field['description'] && $field['type']) {
         if ($defn_array['additional_content']) {
-          $is = db_fetch_object(db_query("SELECT true as present FROM {tripal_views_field} WHERE column_name='%s' AND setup_id=%d",$field_record['column_name'], $field_record['setup_id']));
+          $is = db_fetch_object(db_query("SELECT true as present FROM {tripal_views_field} WHERE column_name='%s' AND setup_id=%d", $field_record['column_name'], $field_record['setup_id']));
           if (!$is->present) {
             $status = drupal_write_record('tripal_views_field', $field_record);
           }

+ 1 - 1
tripal_views/includes/tripal_views_integration.inc

@@ -362,7 +362,7 @@ function tripal_views_integration_form(&$form_state, $setup_id = NULL) {
   );
   if ($setup_obj->priority >= 9) {
     drupal_set_message('You are editing a default views integration. To ensure your changes
-    are used, change the priority to -10.','warning');
+    are used, change the priority to -10.', 'warning');
   }
 
   $form['views_type']['base_table'] = array(

+ 4 - 4
tripal_views/includes/tripal_views_integration_port.inc

@@ -15,10 +15,10 @@ function tripal_views_integration_export_form($form_state, $setup_id) {
   $defn_array = tripal_views_integration_export_entry($setup_id);
   
   $t = var_export($defn_array, TRUE);
-  $t = preg_replace("/\n\s+array/","array", $t); // move array( to previous line
-  $t = preg_replace("/true/","TRUE", $t); // upper case true
-  $t = preg_replace("/false/","FALSE", $t); // upper case false
-  $t = preg_replace("/array\(/","array (", $t); // put a space between array and paren   
+  $t = preg_replace("/\n\s+array/", "array", $t); // move array( to previous line
+  $t = preg_replace("/true/", "TRUE", $t); // upper case true
+  $t = preg_replace("/false/", "FALSE", $t); // upper case false
+  $t = preg_replace("/array\(/", "array (", $t); // put a space between array and paren   
         
   $form['export'] = array(
     '#type' => 'textarea',

+ 1 - 1
tripal_views/tripal_views.views.inc

@@ -217,7 +217,7 @@ function tripal_views_views_pre_render(&$view) {
 
 function tripal_views_views_data() {
 
-	// Make sure all chado tables are integrated
+  // Make sure all chado tables are integrated
   tripal_views_integrate_all_chado_tables();
 
   // Define Global Fields

+ 4 - 1
tripal_views/views/handlers/chado_views_handler_relationship_to_node.inc

@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ * TODO: add documentation
+ */
 /**
  * Relationship handler that links a chado table to it's nodes by creating 2 joins.
  *

+ 1 - 1
tripal_views/views/handlers/chado_wrapper_functions.inc

@@ -2,7 +2,7 @@
 
 /**
  * @file
- * A collection of functions used for the chado wrapper views handlers
+ * TODO: add documentation
  */
 
 /**

+ 1 - 1
tripal_views/views/handlers/views_handler_join_chado_aggregator.inc

@@ -61,7 +61,7 @@ class views_handler_join_chado_aggregator extends views_join {
 
   }
 
-  function aggregate_join (&$query, $opt) {
+  function aggregate_join(&$query, $opt) {
     // Create the table SQL (used in join) -------
     // query creating one-to-one table using array_agg