Ver código fonte

Fixed minor coding review problems

spficklin 11 anos atrás
pai
commit
d922b7a57b
34 arquivos alterados com 585 adições e 581 exclusões
  1. 1 1
      tripal_analysis/api/tripal_analysis.api.inc
  2. 15 15
      tripal_analysis/includes/tripal_analysis.admin.inc
  3. 14 14
      tripal_analysis/includes/tripal_analysis.form.inc
  4. 18 17
      tripal_analysis/tripal_analysis.install
  5. 17 17
      tripal_analysis/tripal_analysis.module
  6. 24 24
      tripal_core/api/tripal_core_chado.api.inc
  7. 18 18
      tripal_core/api/tripal_core_custom_tables.api.inc
  8. 1 1
      tripal_core/api/tripal_core_files.api.inc
  9. 3 3
      tripal_core/api/tripal_core_mviews.api.inc
  10. 3 3
      tripal_core/includes/custom_tables.inc
  11. 5 5
      tripal_core/includes/jobs.inc
  12. 65 65
      tripal_core/includes/mviews.inc
  13. 4 4
      tripal_cv/api/tripal_cv.api.inc
  14. 96 96
      tripal_cv/includes/cvterm_form.inc
  15. 6 6
      tripal_cv/includes/obo_loader.inc
  16. 4 3
      tripal_cv/includes/tripal_cv_admin.inc
  17. 2 2
      tripal_db/api/tripal_db.api.inc
  18. 38 38
      tripal_db/includes/tripal_db.admin.inc
  19. 8 8
      tripal_feature/api/tripal_feature.api.inc
  20. 2 2
      tripal_feature/includes/fasta_loader.inc
  21. 11 11
      tripal_feature/includes/gff_loader.inc
  22. 5 5
      tripal_feature/includes/indexFeatures.inc
  23. 7 7
      tripal_feature/includes/seq_extract.inc
  24. 2 2
      tripal_feature/includes/tripal_feature-db_references.inc
  25. 2 2
      tripal_feature/includes/tripal_feature-properties.inc
  26. 3 3
      tripal_feature/includes/tripal_feature-relationships.inc
  27. 38 38
      tripal_feature/includes/tripal_feature.admin.inc
  28. 30 30
      tripal_feature/includes/tripal_feature.sync_features.inc
  29. 1 1
      tripal_feature/tripal_feature.drush.inc
  30. 4 4
      tripal_feature/tripal_feature.install
  31. 102 102
      tripal_feature/tripal_feature.module
  32. 5 5
      tripal_organism/api/tripal_organism.api.inc
  33. 14 12
      tripal_organism/includes/tripal_organism.admin.inc
  34. 17 17
      tripal_organism/tripal_organism.module

+ 1 - 1
tripal_analysis/api/tripal_analysis.api.inc

@@ -17,7 +17,7 @@
  */
 function tripal_analysis_register_child($modulename) {
   $sql = "SELECT * FROM {tripal_analysis} WHERE modulename = '%s'";
-  if(!db_result($sql, $modulename)) {
+  if (!db_result($sql, $modulename)) {
     $sql = "INSERT INTO {tripal_analysis} (modulename) VALUES ('%s')";
     db_query($sql, $modulename);
   }

+ 15 - 15
tripal_analysis/includes/tripal_analysis.admin.inc

@@ -112,7 +112,7 @@ function get_tripal_analysis_admin_form_taxonomy_set(&$form) {
   $form['taxonify']['description'] = array(
        '#type' => 'item',
        '#value' => t("Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
-          "nodes. These terms allow for advanced filtering during searching. This option allows ".
+          "nodes. These terms allow for advanced filtering during searching. This option allows " .
           "for setting taxonomy only for features that belong to the selected analyses below.  All other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
      '#weight' => 1,
   );
@@ -202,10 +202,10 @@ function get_tripal_analysis_admin_form_cleanup_set(&$form) {
   );
   $form['cleanup']['description'] = array(
        '#type' => 'item',
-       '#value' => t("With Drupal and chado residing in different databases ".
-          "it is possible that nodes in Drupal and analyses in Chado become ".
-          "\"orphaned\".  This can occur if an analysis node in Drupal is ".
-          "deleted but the corresponding chado analysis is not and/or vice ".
+       '#value' => t("With Drupal and chado residing in different databases " .
+          "it is possible that nodes in Drupal and analyses in Chado become " .
+          "\"orphaned\".  This can occur if an analysis node in Drupal is " .
+          "deleted but the corresponding chado analysis is not and/or vice " .
           "versa. Click the button below to resolve these discrepancies."),
        '#weight' => 1,
   );
@@ -272,8 +272,8 @@ function get_tripal_analysis_admin_form_sync_set(&$form) {
       $form['sync']['analyses'] = array(
            '#title'       => t('Available analyses'),
            '#type'        => t('checkboxes'),
-           '#description' => t("Check the analyses you want to sync.  Drupal ".
-              "content will be created for each of the analyses listed above. ".
+           '#description' => t("Check the analyses you want to sync.  Drupal " .
+              "content will be created for each of the analyses listed above. " .
               "Select 'All analyses' to sync all of them."),
            '#required'    => FALSE,
            '#prefix'      => '<div id="ana_boxes">',
@@ -400,17 +400,17 @@ function tripal_analysis_sync_analyses($analysis_id = NULL, $job_id = NULL) {
   $page_content = '';
 
   if (!$analysis_id) {
-    $sql = "SELECT Analysis_id, name, description, program, ".
-        "  programversion, algorithm, sourcename, sourceversion, sourceuri, ".
-          "  timeexecuted ".
+    $sql = "SELECT Analysis_id, name, description, program, " .
+        "  programversion, algorithm, sourcename, sourceversion, sourceuri, " .
+          "  timeexecuted " .
           "FROM {Analysis} ";
     $results = chado_query($sql);
   }
   else {
-    $sql = "SELECT Analysis_id, name, description, program, ".
-         "  programversion, algorithm, sourcename, sourceversion, sourceuri, ".
-          "  timeexecuted ".
-          "FROM {Analysis} ".
+    $sql = "SELECT Analysis_id, name, description, program, " .
+         "  programversion, algorithm, sourcename, sourceversion, sourceuri, " .
+          "  timeexecuted " .
+          "FROM {Analysis} " .
           "WHERE analysis_id = %d";
     $results = chado_query($sql, $analysis_id);
   }
@@ -418,7 +418,7 @@ function tripal_analysis_sync_analyses($analysis_id = NULL, $job_id = NULL) {
 
   // We'll use the following SQL statement for checking if the analysis
   // already exists as a drupal node.
-  $sql = "SELECT * FROM {chado_analysis} ".
+  $sql = "SELECT * FROM {chado_analysis} " .
           "WHERE analysis_id = %d";
 
   while ($analysis = db_fetch_object($results)) {

+ 14 - 14
tripal_analysis/includes/tripal_analysis.form.inc

@@ -178,8 +178,8 @@ function chado_analysis_form(&$node, $form_state = NULL) {
   ";
   $prop_types = chado_query($sql);
   while ($prop = db_fetch_object($prop_types)) {
-  	$properties_select[$prop->cvterm_id] = $prop->name;
-  	$properties_list[$prop->cvterm_id] = $prop;
+    $properties_select[$prop->cvterm_id] = $prop->name;
+    $properties_list[$prop->cvterm_id] = $prop;
   }
   
   $form['properties'] = array(
@@ -243,10 +243,10 @@ function tripal_analysis_validate($node, &$form) {
     $analysis = $result[0];
       
     // if the name has changed make sure it doesn't conflict with an existing name
-    if($analysis->name != $node->analysisname) {
+    if ($analysis->name != $node->analysisname) {
       $values = array('name' => $node->analysisname);
       $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
-      if($result and count($result) > 0) {
+      if ($result and count($result) > 0) {
         form_set_error('analysisname', 'Cannot update the analysis with this analysis name. An analysis with this name already exists.');
         return;
       }  
@@ -254,7 +254,7 @@ function tripal_analysis_validate($node, &$form) {
     
     // if the unique constraint has changed check to make sure it doesn't conflict with an
     // existing record
-    if($analysis->program != $node->program or $analysis->programversion != $node->programversion or 
+    if ($analysis->program != $node->program or $analysis->programversion != $node->programversion or 
        $analysis->sourcename != $node->sourcename) {
       $values = array(
         'program' => $node->program,
@@ -278,7 +278,7 @@ function tripal_analysis_validate($node, &$form) {
       }  
     }
   }
-  else{
+  else {
     // To differentiate if we are syncing or creating a new analysis altogther, see if an
     // analysis_id already exists
     if ($node->analysis_id and $node->analysis_id != 0) {
@@ -305,7 +305,7 @@ function tripal_analysis_validate($node, &$form) {
       // title, so it should be unique      
       $values = array('name' => $node->analysisname);
       $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
-      if($result and count($result) > 0) {
+      if ($result and count($result) > 0) {
         form_set_error('analysisname', 'Cannot add the analysis with this analysis name. An analysis with this name already exists.');
         return;
       }
@@ -367,10 +367,10 @@ function chado_analysis_node_form_add_new_props(&$form, $form_state, &$d_propert
 
         // skip any properties that the user requested to delete through a previous
         // AHAH callback or through the current AHAH callback
-        if($d_removed["$new_id-$rank"]) {
+        if ($d_removed["$new_id-$rank"]) {
           continue;
         }
-        if($form_state['post']['remove-' . $new_id . '-' . $rank]) {
+        if ($form_state['post']['remove-' . $new_id . '-' . $rank]) {
           $d_removed["$new_id-$rank"] = 1;
           continue;
         }
@@ -420,7 +420,7 @@ function chado_analysis_node_form_add_new_props(&$form, $form_state, &$d_propert
 
 
   // second add in any new properties added during this callback
-  if($form_state['post']['add']) {
+  if ($form_state['post']['add']) {
     $new_id = $form_state['values']['new_id'];
     $new_value = $form_state['values']['new_value'];
 
@@ -478,7 +478,7 @@ function chado_analysis_node_form_add_analysisprop_table_props(&$form, $form_sta
   // get the properties for this analysis
   $num_properties = 0;
 
-  if(!$analysis_id) {
+  if (!$analysis_id) {
     return $num_properties;
   }
 
@@ -498,10 +498,10 @@ function chado_analysis_node_form_add_analysisprop_table_props(&$form, $form_sta
     
     // skip any properties that the user requested to delete through a previous
     // AHAH callback or through the current AHAH callback
-    if($d_removed["$type_id-$rank"]) {
+    if ($d_removed["$type_id-$rank"]) {
       continue;
     }
-    if($form_state['post']['remove-' . $type_id . '-' . $rank]) {
+    if ($form_state['post']['remove-' . $type_id . '-' . $rank]) {
       $d_removed["$type_id-$rank"] = 1;
       continue;
     }
@@ -591,7 +591,7 @@ function tripal_analysis_theme_node_form_properties($form) {
     );
   }
 
-  $headers = array('Property Type','Value', '');
+  $headers = array('Property Type', 'Value', '');
   return theme('table', $headers, $rows);
 }
 

+ 18 - 17
tripal_analysis/tripal_analysis.install

@@ -28,19 +28,20 @@ function tripal_analysis_install() {
 /*
  * 
  */
-function tripal_analysis_create_analysisfeatureprop(){
+function tripal_analysis_create_analysisfeatureprop() {
+  
   // Create analysisfeatureprop table in chado.  This is needed for Chado 
   // version 1.11, the table exists in Chado 1.2. 
   if (!db_table_exists('analysisfeatureprop')) {
-    $sql = "CREATE TABLE analysisfeatureprop (".
-            "  analysisfeatureprop_id SERIAL PRIMARY KEY, ".
+    $sql = "CREATE TABLE analysisfeatureprop (" .
+            "  analysisfeatureprop_id SERIAL PRIMARY KEY, " .
             "  analysisfeature_id     INTEGER NOT NULL REFERENCES analysisfeature(analysisfeature_id) " .
-            "    ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, ".
-            "  type_id                INTEGER NOT NULL REFERENCES cvterm(cvterm_id) ".
-            "    ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, ".
-            "  value                  TEXT, ".
-            "  rank                   INTEGER NOT NULL, ".
-            "  CONSTRAINT analysisfeature_id_type_id_rank UNIQUE(analysisfeature_id, type_id, rank)".
+            "    ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, " .
+            "  type_id                INTEGER NOT NULL REFERENCES cvterm(cvterm_id) " .
+            "    ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, " .
+            "  value                  TEXT, " .
+            "  rank                   INTEGER NOT NULL, " .
+            "  CONSTRAINT analysisfeature_id_type_id_rank UNIQUE(analysisfeature_id, type_id, rank)" .
             ")";
     chado_query($sql);
   } 
@@ -48,7 +49,7 @@ function tripal_analysis_create_analysisfeatureprop(){
 /*
  * 
  */
-function tripal_analysis_add_cvterms(){
+function tripal_analysis_add_cvterms() {
   
   tripal_cv_add_cv('tripal_analysis', 'Terms used for managing analyses in Tripal');
   
@@ -56,8 +57,8 @@ function tripal_analysis_add_cvterms(){
   // change change this property
   $term = array(
     'name' => 'analysis_type', 
-    'def' => 'The type of analysis was performed. This value is automatically set by '.
-             'each Tripal Analysis module and should be equal to the module name '.
+    'def' => 'The type of analysis was performed. This value is automatically set by ' .
+             'each Tripal Analysis module and should be equal to the module name ' .
              '(e.g. tripal_analysis_blast, tripal_analysis_go).'
   );
   tripal_cv_add_cvterm($term, 'tripal_analysis', 0, 1, 'tripal');
@@ -83,7 +84,7 @@ function tripal_analysis_add_cvterms(){
   // an analysis_type term in the 'tripal_analysis' vocabular we duplicate it here because the 
   // tripal_analysis vocabulary is intended for use by the extension modules.  user's should not be able
   // to directly modify properties set by extension modules for an analysis.
-  tripal_cv_add_cvterm(array('name' => 'Analysis Type','def' => 'The type of analysis was performed.'), 
+  tripal_cv_add_cvterm(array('name' => 'Analysis Type', 'def' => 'The type of analysis was performed.'), 
      'analysis_property', 0, 1, 'tripal');
 }
 /**
@@ -93,8 +94,8 @@ function tripal_analysis_uninstall() {
   // Use schema API to delete database table.
   drupal_uninstall_schema('tripal_analysis');
   // Remove analysis nodes from drupal.
-  $sql_ana_id = "SELECT nid, vid ".
-                 "FROM {node} ".
+  $sql_ana_id = "SELECT nid, vid " .
+                 "FROM {node} " .
                  "WHERE type like 'chado_analysi%'";
   $result = db_query($sql_ana_id);
   while ($ana = db_fetch_object($result)) {
@@ -151,7 +152,7 @@ function tripal_analysis_schema() {
         'type' => 'text',
         'size' => 'small',
         'not null' => TRUE,
-        'description' => t('The module name. Tripal Analysis will use the '.
+        'description' => t('The module name. Tripal Analysis will use the ' .
                             'module name to call module_setting_form()')
       )
     ),
@@ -213,7 +214,7 @@ function tripal_analysis_update_6101() {
   // an analysis_type term in the 'tripal_analysis' vocabular we duplicate it here because the 
   // tripal_analysis vocabulary is intended for use by the extension modules.  user's should not be able
   // to directly modify properties set by extension modules for an analysis.
-   tripal_cv_add_cvterm(array('name' => 'Analysis Type','def' => 'The type of analysis was performed.'), 
+   tripal_cv_add_cvterm(array('name' => 'Analysis Type', 'def' => 'The type of analysis was performed.'), 
      'analysis_property', 0, 1, 'tripal');
 
   $ret = array(

+ 17 - 17
tripal_analysis/tripal_analysis.module

@@ -128,7 +128,7 @@ function chado_analysis_insert($node) {
   if ($analysis_id) {
     $values = array('analysis_id' => $node->analysis_id);
     $result = tripal_core_chado_select('analysis', array('analysis_id'), $values);
-    if($result and count($result) > 0) {
+    if ($result and count($result) > 0) {
       $analysis = $result[0];
     }
   }
@@ -155,12 +155,12 @@ function chado_analysis_insert($node) {
 
   // Make sure the entry for this analysis doesn't already exist in the
   // chado_analysis table if it doesn't exist then we want to add it.
-  $node_check_sql = "SELECT * FROM {chado_analysis} ".
+  $node_check_sql = "SELECT * FROM {chado_analysis} " .
                     "WHERE analysis_id = :analysis_id";
   $node_check = db_query($node_check_sql, array(':analysis_id' => $analysis_id))->fetchObject();
   if (!$node_check) {
     // next add the item to the drupal table
-    $sql = "INSERT INTO {chado_analysis} (nid, vid, analysis_id) ".
+    $sql = "INSERT INTO {chado_analysis} (nid, vid, analysis_id) " .
            "VALUES (:nid, :vid, :analysis_id)";
     db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid, ':analysis_id' => $analysis_id));
     // Create a title for the analysis node using the unique keys so when the
@@ -254,16 +254,16 @@ function chado_analysis_delete($node) {
   }
 
   // Remove data from the {chado_analysis}, {node}, and {node_revisions} tables
-  $sql_del = "DELETE FROM {chado_analysis} ".
-              "WHERE nid = :nid ".
+  $sql_del = "DELETE FROM {chado_analysis} " .
+              "WHERE nid = :nid " .
               "AND vid = :vid";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
-  $sql_del = "DELETE FROM {node} ".
-              "WHERE nid = :nid ".
+  $sql_del = "DELETE FROM {node} " .
+              "WHERE nid = :nid " .
               "AND vid = :vid";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
-  $sql_del = "DELETE FROM {node_revisions} ".
-              "WHERE nid = :nid ".
+  $sql_del = "DELETE FROM {node_revisions} " .
+              "WHERE nid = :nid " .
               "AND vid = :vid";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
 
@@ -400,9 +400,9 @@ function chado_analysis_update($node) {
   ";
   $success = chado_query($sql, $analysis_id);
   if (!$success) {
-  	drupal_set_message("Cannot update analysis properties", "error");
-  	watchdog('t_analysis', "Cannot update analysis properties.", array(), WATCHDOG_ERROR);
-  	return;
+    drupal_set_message("Cannot update analysis properties", "error");
+    watchdog('t_analysis', "Cannot update analysis properties.", array(), WATCHDOG_ERROR);
+    return;
   }
   foreach ($properties as $property => $elements) {
     foreach ($elements as $rank => $value) {
@@ -546,19 +546,19 @@ function tripal_analysis_perm() {
       'title' => t('View Analyses'),
       'description' => t('Allow users to view analysis pages.'),
     ),
-    'create chado_analysis content'=> array(
+    'create chado_analysis content' => array(
       'title' => t('Create Analyses'),
       'description' => t('Allow users to create new analysis pages.'),
     ),
-    'delete chado_analysis content'=> array(
+    'delete chado_analysis content' => array(
       'title' => t('Delete Analyses'),
       'description' => t('Allow users to delete analysis pages.'),
     ),
-    'edit chado_analysis content'=> array(
+    'edit chado_analysis content' => array(
       'title' => t('Edit Analyses'),
       'description' => t('Allow users to edit analysis pages.'),
     ),
-    'adminster tripal analysis'=> array(
+    'adminster tripal analysis' => array(
       'title' => t('Administer Analyses'),
       'description' => t('Allow users to administer all analyses.'),
     ),
@@ -640,7 +640,7 @@ function tripal_analysis_block($op = 'list', $delta = 0, $edit=array()) {
  * 
  * Implements hook_node_view()
  */
-function tripal_analysis_node_view ($node, $view_mode, $langcode) {
+function tripal_analysis_node_view($node, $view_mode, $langcode) {
   if ($node->type == 'chado_feature') {
     if ($view_mode == 'search_index') {
        // return results for searching

+ 24 - 24
tripal_core/api/tripal_core_chado.api.inc

@@ -616,7 +616,7 @@ function tripal_core_chado_delete($table, $match, $options = NULL) {
       $sql .= "$field IN (";
       $index = 0;
       foreach ($value as $v) {
-      	$sql .= ":$field" . $index . ", ";
+        $sql .= ":$field" . $index . ", ";
         $args[":$field" . $index] = $v;
         $index++;
       }
@@ -970,7 +970,7 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
         $sql .= "$field IN (";
         $index = 0;
         foreach ($value as $v) {
-        	$sql .= ":$field" . $index . ', ';
+          $sql .= ":$field" . $index . ', ';
           $args[":$field" . $index] = $v;
           $index++;
         }
@@ -993,8 +993,8 @@ function tripal_core_chado_select($table, $columns, $values, $options = NULL) {
           $args[":$field"] = $value[0];
         }
         else {
-	        $sql .= "$field $operator :$field AND ";
-	        $args[":$field"] = $value[0];        	
+          $sql .= "$field $operator :$field AND ";
+          $args[":$field"] = $value[0];          
         }
       }
     } // end foreach item in where clause
@@ -1441,7 +1441,7 @@ function tripal_core_generate_chado_var($table, $values, $base_options = array()
   // convert the results into an array
   $results_arr = array(); 
   foreach ($results as $record) {
-  	$results_arr[] = $record;
+    $results_arr[] = $record;
   }
   // check only one result returned
   if (!$return_array) {
@@ -1900,13 +1900,13 @@ function chado_query_range($query, $args, $from, $count) {
  * @ingroup tripal_chado_api
  */
 function chado_query($sql, $args = array()) {
-	
+  
   $is_local = tripal_core_is_chado_local();
     
   // if Chado is local to the database then prefix the Chado table
   // names with 'chado'.
   if ($is_local) {
-  	$sql = preg_replace('/\n/', '', $sql);  // remove carriage returns
+    $sql = preg_replace('/\n/', '', $sql);  // remove carriage returns
     $sql = preg_replace('/\{(.*?)\}/', 'chado.$1', $sql);
     $results = db_query($sql, $args);
   }
@@ -1935,10 +1935,10 @@ function chado_query($sql, $args = array()) {
  * @ingroup tripal_chado_api
  */
 function chado_get_id_for_node($table, $nid) {
-	$sql = "SELECT " . $table . "_id as id FROM {chado_$table} WHERE nid = :nid";
-	$result = db_query($sql, array(':nid' => $nid))->fetchObject();
-	
-	return $result->id;
+  $sql = "SELECT " . $table . "_id as id FROM {chado_$table} WHERE nid = :nid";
+  $result = db_query($sql, array(':nid' => $nid))->fetchObject();
+  
+  return $result->id;
 }
 
 /**
@@ -1952,7 +1952,7 @@ function chado_get_id_for_node($table, $nid) {
  *  @ingroup tripal_chado_api
  */
 function chado_get_node_id($table, $id) {
-	$sql = "SELECT nid FROM {chado_$table} WHERE " . $table . "_id = :" . $table . "_id";
+  $sql = "SELECT nid FROM {chado_$table} WHERE " . $table . "_id = :" . $table . "_id";
   $result = db_query($sql, array(":" . $table . "_id" => $id))->fetchObject();
   return $results->nid;
 }
@@ -2384,9 +2384,9 @@ function tripal_get_chado_custom_schema($table) {
  *   TRUE/FALSE depending upon whether it exists
  */
 function chado_table_exists($table) {
-	global $databases;
-	
-	$default_db = $databases['default']['default']['database'];
+  global $databases;
+  
+  $default_db = $databases['default']['default']['database'];
 
   $sql = "
     SELECT 1
@@ -2399,7 +2399,7 @@ function chado_table_exists($table) {
   $results = db_query($sql, array(':table_name' => $table));
   $exists = $results->fetchObject();
   if (!$exists) {
-  	return FALSE;
+    return FALSE;
   }
   return TRUE;
 }
@@ -2527,10 +2527,10 @@ function tripal_core_set_chado_version() {
 
   // check that Chado is installed if not return 'uninstalled as the version'
   $chado_exists = tripal_core_chado_schema_exists();
-  if (!$chado_exists) {  	
+  if (!$chado_exists) {    
     // if it's not in the drupal database check to see if it's specified in the $db_url
     // in the settings.php    
-    if (!array_key_exists('chado', $databases)) {    	
+    if (!array_key_exists('chado', $databases)) {      
       // if it's not in the drupal database or specified in the $db_url then
       // return uninstalled as the version
       return 'not installed';
@@ -2540,8 +2540,8 @@ function tripal_core_set_chado_version() {
     tripal_db_set_active($previous_db);
   }
   else {
-  	$is_local = 1;
-  	$prop_exists = db_table_exists('chado.chadoprop');
+    $is_local = 1;
+    $prop_exists = db_table_exists('chado.chadoprop');
   }
   
   // if the table doesn't exist then we don't know what version but we know
@@ -2558,9 +2558,9 @@ function tripal_core_set_chado_version() {
     WHERE CV.name = 'chado_properties' and CVT.name = 'version'
   ";
   if (!$is_local) {
-	  $previous_db = tripal_db_set_active('chado');
-	  $results = db_query($sql);
-	  tripal_db_set_active($previous_db);
+    $previous_db = tripal_db_set_active('chado');
+    $results = db_query($sql);
+    tripal_db_set_active($previous_db);
   }
   else {
     $results = chado_query($sql);
@@ -2852,7 +2852,7 @@ function tripal_db_set_active($dbname  = 'default') {
   
   $chado_exists = variable_get('chado_schema_exists', FALSE);
   if ($chado_exists) {
-    if($dbname == 'chado') {
+    if ($dbname == 'chado') {
       db_query('set search_path to chado');
       return 'default';
     }

+ 18 - 18
tripal_core/api/tripal_core_custom_tables.api.inc

@@ -103,10 +103,10 @@ function tripal_core_edit_custom_table($table_id, $table_name, $schema, $skip_cr
  * @ingroup tripal_custom_tables_api
  */
 function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
-	global $databases;
-	$created = 0;
-	$recreated = 0;
-	
+  global $databases;
+  $created = 0;
+  $recreated = 0;
+  
   // see if the table entry already exists in the tripal_custom_tables table.
   $sql = "SELECT * FROM {tripal_custom_tables} WHERE table_name = :table_name";
   $results = db_query($sql, array(':table_name' => $table));
@@ -117,15 +117,15 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
   
   // if the table does not exist then create it
   if (!$exists) { 
-  	$previous_db = tripal_db_set_active('chado');  // use chado database   
-    try {    	
+    $previous_db = tripal_db_set_active('chado');  // use chado database   
+    try {      
       $ret = db_create_table($table, $schema);
       tripal_db_set_active($previous_db);  // now use drupal database
       $created = 1;
     }
     catch (Exception $e) {
-    	tripal_db_set_active($previous_db);  // now use drupal database
-    	$error = $e->getMessage();
+      tripal_db_set_active($previous_db);  // now use drupal database
+      $error = $e->getMessage();
       watchdog('tripal_core', "Error adding custom table: @message",
         array('@message' => $error), WATCHDOG_ERROR);
       drupal_set_message("Could not add custom table. $error.", "error");
@@ -138,12 +138,12 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
   if ($exists and is_object($centry) and !$skip_creation) {    
     
     // drop the table we'll recreate it with the new schema    
-    try {	    
-	    chado_query('DROP TABLE {' . $table . '}');
-	    $previous_db = tripal_db_set_active('chado');  // use chado database
-	    db_create_table($table, $schema);
-	    tripal_db_set_active($previous_db);  // now use drupal database    
-	    $recreated = 1;
+    try {      
+      chado_query('DROP TABLE {' . $table . '}');
+      $previous_db = tripal_db_set_active('chado');  // use chado database
+      db_create_table($table, $schema);
+      tripal_db_set_active($previous_db);  // now use drupal database    
+      $recreated = 1;
     }
     catch (Exception $e) {
       tripal_db_set_active('default');  // now use drupal database
@@ -193,11 +193,11 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
           chado_query($sql);
         }
         catch (Exception $e) {
-        	$error = $e->getMessage();
+          $error = $e->getMessage();
           watchdog('tripal_core', "Error, could not add foreign key contraint to custom table: %error",
             array('%error' => $error), WATCHDOG_ERROR);
           drupal_set_message("Could not add foreign key contraint to table: $error", 'error');      
-          return FALSE;        	
+          return FALSE;          
         }
       }
     }
@@ -207,10 +207,10 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
     drupal_set_message("Custom table created successfully.", 'status');
   }
   elseif ($recreated) {
-  	drupal_set_message("Custom table re-created successfully.", 'status');
+    drupal_set_message("Custom table re-created successfully.", 'status');
   }
   else {
-  	drupal_set_message("Custom table already exists. Table structure not changed, but definition array has been saved.", 'status');
+    drupal_set_message("Custom table already exists. Table structure not changed, but definition array has been saved.", 'status');
   }
   return TRUE;
 }

+ 1 - 1
tripal_core/api/tripal_core_files.api.inc

@@ -66,7 +66,7 @@ function tripal_create_moddir($module_name) {
 function tripal_create_mod_subdir($module_name, $path) {
 
   // make sure the module data directory exists
-	tripal_create_moddir($module_name);
+  tripal_create_moddir($module_name);
   
   // now make sure the sub dir exists
   $sub_dir = tripal_file_directory_path() . $module_name . $path;

+ 3 - 3
tripal_core/api/tripal_core_mviews.api.inc

@@ -270,8 +270,8 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
  */
 function tripal_mviews_get_mview_id($view_name) {
   if (db_table_exists('tripal_mviews')) {
-  	$sql = "SELECT * FROM {tripal_mviews} WHERE name = :name";
-  	$results = db_query($sql, array(':name' => $view_name));
+    $sql = "SELECT * FROM {tripal_mviews} WHERE name = :name";
+    $results = db_query($sql, array(':name' => $view_name));
     $mview = $results->fetchObject();
     if ($mview) {
       return $mview->mview_id;
@@ -307,7 +307,7 @@ function tripal_mviews_action($op, $mview_id, $redirect = FALSE) {
 
   // add a job or perform the action based on the given operation
   if ($op == 'update') {
-  	$args = array("$mview_id");
+    $args = array("$mview_id");
     tripal_add_job("Populate materialized view '$mview->name'", 'tripal_core',
        'tripal_update_mview', $args, $user->uid);
   }

+ 3 - 3
tripal_core/includes/custom_tables.inc

@@ -12,9 +12,9 @@
  * 
  */
 function tripal_custom_table_new_page() {
-	$output = drupal_render(drupal_get_form('tripal_custom_tables_form'));
-	return $output;   	
-	
+  $output = drupal_render(drupal_get_form('tripal_custom_tables_form'));
+  return $output;     
+  
 }
 /**
  * A template function which returns markup to display details for the custom table

+ 5 - 5
tripal_core/includes/jobs.inc

@@ -229,10 +229,10 @@ function tripal_jobs_view($job_id) {
   } 
   
   // build the links
-  $links  = l('Return to jobs list', "admin/tripal/tripal_jobs/") . ' | ';
-  $links .= l('Re-run this job', "admin/tripal/tripal_jobs/rerun/" . $job->job_id)  . ' | ';
+  $links  = l('Return to jobs list', "admin/tripal/tripal_jobs/") . ' | ' .
+  $links .= l('Re-run this job', "admin/tripal/tripal_jobs/rerun/" . $job->job_id) . ' | ';
   if ($job->start_time == 0 and $job->end_time == 0) {
-    $links .= l('Cancel this job', "admin/tripal/tripal_jobs/cancel/" . $job->job_id)  . ' | ';
+    $links .= l('Cancel this job', "admin/tripal/tripal_jobs/cancel/" . $job->job_id) . ' | ';
   }
   
   // make our start and end times more legible
@@ -245,7 +245,7 @@ function tripal_jobs_view($job_id) {
   
   // construct the table rows
   $rows[] = array('Job Description', $job->job_name);
-  $rows[] = array('Submitting Module',$job->modulename);
+  $rows[] = array('Submitting Module', $job->modulename);
   $rows[] = array('Callback function', $job->callback);
   $rows[] = array('Arguments', $arguments);
   $rows[] = array('Progress', $job->progress . "%");
@@ -266,7 +266,7 @@ function tripal_jobs_view($job_id) {
     'caption' => '',
     'colgroups' => array(), 
     'empty' => '', 
-  );  	
+  );    
   
   $output = '<p>' . substr($links, 0, -2) . '</p>'; // remove trailing |
   $output .= theme_table($table);

+ 65 - 65
tripal_core/includes/mviews.inc

@@ -64,10 +64,10 @@ function tripal_mview_report($mview_id) {
     $rows[] = array('Special Indexed Fields', $mview->special_index);
   }
   if ($mview->mv_schema) {
-    $rows[] = array('Drupal Schema API Definition', "<textarea rows=\"20\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">"  . $mview->mv_schema . "</textarea>");
+    $rows[] = array('Drupal Schema API Definition', "<textarea rows=\"20\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">" . $mview->mv_schema . "</textarea>");
   }
   
-  $header = array('Detail','Value');
+  $header = array('Detail', 'Value');
   $table = array(
     'header' => $header, 
     'rows' => $rows, 
@@ -194,14 +194,14 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     // form_state then let's use that, otherwise, we'll pull
     // the values from the database
     if (array_key_exists('values', $form_state)) {
-	    $default_name = $form_state['values']['name'];
-	    $default_mv_table = $form_state['values']['mv_table'];
-	    $default_mv_specs = $form_state['values']['mv_specs'];
-	    $default_indexed = $form_state['values']['indexed'];
-	    $default_mvquery = $form_state['values']['mvquery'];
-	    $default_special_index = $form_state['values']['special_index'];
-	    $default_comment = $form_state['values']['comment'];
-	    $default_modulename = $form_state['values']['modulename'];
+      $default_name = $form_state['values']['name'];
+      $default_mv_table = $form_state['values']['mv_table'];
+      $default_mv_specs = $form_state['values']['mv_specs'];
+      $default_indexed = $form_state['values']['indexed'];
+      $default_mvquery = $form_state['values']['mvquery'];
+      $default_special_index = $form_state['values']['special_index'];
+      $default_comment = $form_state['values']['comment'];
+      $default_modulename = $form_state['values']['modulename'];
     }
 
     if (!$default_name) {
@@ -233,7 +233,7 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
     }
     
     if ($mview->mv_specs) {
-    	$is_legacy = 1;
+      $is_legacy = 1;
     }
 
     // the mv_table column of the tripal_mviews table always has the table
@@ -320,51 +320,51 @@ function tripal_mviews_form($form, &$form_state = NULL, $mview_id = NULL) {
 
   // only let folks edit legacy MViews, not create new ones 
   if ($is_legacy) {
-	  // add a fieldset for the Original Table Description fields
-	  $form['traditional'] = array(
-	    '#type' => 'fieldset',
-	    '#title' => 'Legacy MViews Setup',
-	    '#description' => t('Traditionally MViews were created by specifying PostgreSQL style ' .
-	                       'column types.  This method can be used but is deprecated in favor of the ' .
-	                       'newer Drupal schema API method provided above. In rare cases where the Drupal Schema API ' .
-	                       'does not support a desired data type the Legacy Mviews should be used'),
-	    '#collapsible' => 1,
-	    '#collapsed' => $traditional_collapsed,
-	  );
-	
-	  $form['traditional']['mv_table']= array(
-	    '#type'          => 'textfield',
-	    '#title'         => t('Table Name'),
-	    '#description'   => t('Please enter the table name that this view will generate in the database.  You can use the schema and table name for querying the view'),
-	    '#required'      => FALSE,
-	    '#default_value' => $default_mv_table,
-	  );
-	
-	  $form['traditional']['mv_specs']= array(
-	    '#type'          => 'textarea',
-	    '#title'         => t('Table Definition'),
-	    '#description'   => t('Please enter the field definitions for this view. Each field should be separated by a comma or enter each field definition on each line.'),
-	    '#required'      => FALSE,
-	    '#default_value' => $default_mv_specs,
-	  );
-	
-	  $form['traditional']['indexed']= array(
-	    '#type'          => 'textarea',
-	    '#title'         => t('Indexed Fields'),
-	    '#description'   => t('Please enter the field names (as provided in the table definition above) that will be indexed for this view.  Separate by a comma or enter each field on a new line.'),
-	    '#required'      => FALSE,
-	    '#default_value' => $default_indexed,
-	  );
-	
-	  /**
-	  $form['traditional']['special_index']= array(
-	    '#type'          => 'textarea',
-	    '#title'         => t('View Name'),
-	    '#description'   => t('Please enter the name for this materialized view.'),
-	    '#required'      => TRUE,
-	    '#default_value' => $default_special_index,
-	  );
-	  */
+    // add a fieldset for the Original Table Description fields
+    $form['traditional'] = array(
+      '#type' => 'fieldset',
+      '#title' => 'Legacy MViews Setup',
+      '#description' => t('Traditionally MViews were created by specifying PostgreSQL style ' .
+                         'column types.  This method can be used but is deprecated in favor of the ' .
+                         'newer Drupal schema API method provided above. In rare cases where the Drupal Schema API ' .
+                         'does not support a desired data type the Legacy Mviews should be used'),
+      '#collapsible' => 1,
+      '#collapsed' => $traditional_collapsed,
+    );
+  
+    $form['traditional']['mv_table']= array(
+      '#type'          => 'textfield',
+      '#title'         => t('Table Name'),
+      '#description'   => t('Please enter the table name that this view will generate in the database.  You can use the schema and table name for querying the view'),
+      '#required'      => FALSE,
+      '#default_value' => $default_mv_table,
+    );
+  
+    $form['traditional']['mv_specs']= array(
+      '#type'          => 'textarea',
+      '#title'         => t('Table Definition'),
+      '#description'   => t('Please enter the field definitions for this view. Each field should be separated by a comma or enter each field definition on each line.'),
+      '#required'      => FALSE,
+      '#default_value' => $default_mv_specs,
+    );
+  
+    $form['traditional']['indexed']= array(
+      '#type'          => 'textarea',
+      '#title'         => t('Indexed Fields'),
+      '#description'   => t('Please enter the field names (as provided in the table definition above) that will be indexed for this view.  Separate by a comma or enter each field on a new line.'),
+      '#required'      => FALSE,
+      '#default_value' => $default_indexed,
+    );
+  
+    /**
+    $form['traditional']['special_index']= array(
+      '#type'          => 'textarea',
+      '#title'         => t('View Name'),
+      '#description'   => t('Please enter the name for this materialized view.'),
+      '#required'      => TRUE,
+      '#default_value' => $default_special_index,
+    );
+    */
   }
 
   $form['mvquery']= array(
@@ -409,13 +409,13 @@ function tripal_mviews_form_validate($form, &$form_state) {
   $is_legacy = $form_state['values']['is_legacy'];
   $query = $form_state['values']['mvquery'];
   if ($is_legacy) {
-	  $mv_table = $form_state['values']['mv_table'];
-	  $mv_specs = $form_state['values']['mv_specs'];
-	  $indexed = $form_state['values']['indexed'];	  
-	  $special_index = '';//$form_state['values']['special_index'];
+    $mv_table = $form_state['values']['mv_table'];
+    $mv_specs = $form_state['values']['mv_specs'];
+    $indexed = $form_state['values']['indexed'];    
+    $special_index = '';//$form_state['values']['special_index'];
   }
   else {
-  	$mv_table = '';
+    $mv_table = '';
     $mv_specs = '';
     $indexed = '';
     $special_index = '';
@@ -471,10 +471,10 @@ function tripal_mviews_form_submit($form, &$form_state) {
   $is_legacy = $form_state['values']['is_legacy'];
   $query = $form_state['values']['mvquery'];
   if ($is_legacy) {
-	  $mv_table = $form_state['values']['mv_table'];
-	  $mv_specs = $form_state['values']['mv_specs'];
-	  $indexed = $form_state['values']['indexed'];	  
-	  $special_index = '';//$form_state['values']['special_index'];
+    $mv_table = $form_state['values']['mv_table'];
+    $mv_specs = $form_state['values']['mv_specs'];
+    $indexed = $form_state['values']['indexed'];    
+    $special_index = '';//$form_state['values']['special_index'];
   }
   else {
     $mv_table = '';

+ 4 - 4
tripal_cv/api/tripal_cv.api.inc

@@ -265,7 +265,7 @@ function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal')
     return FALSE;
   }
   if (count($r) == 0) {
-  	return FALSE;
+    return FALSE;
   }
   return $r[0];
 }
@@ -307,10 +307,10 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
   $synonym = tripal_core_chado_select('cvtermsynonym', array('cvterm_id'), $values, $options);
   
   // if the synonym doens't exist or more than one record is returned then return false
-  if(count($synonym) == 0) {
+  if (count($synonym) == 0) {
     return FALSE;
   }
-  if(count($synonym) > 1) {
+  if (count($synonym) > 1) {
     return FALSE;
   }
   
@@ -381,7 +381,7 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
     tripal_db_set_active($previous); 
   }
   catch (Exception $e) {
-    tripal_db_set_active($previous);	
+    tripal_db_set_active($previous);  
     $error = $e->getMessage();
     watchdog('tripal_cv', "Could not fill cvtermpath table: @error", array('@error' => $error), WATCHDOG_ERROR);
     return FALSE;

+ 96 - 96
tripal_cv/includes/cvterm_form.inc

@@ -7,26 +7,26 @@
  */
 function tripal_cv_cvterm_edit_form($form, &$form_state) {
 
-	$step = 0;
+  $step = 0;
   if (empty($form_state['storage']['step'])) {
     $form_state['storage']['step'] = 0;
   }
   else {
-  	$step = $form_state['storage']['step'];
+    $step = $form_state['storage']['step'];
   }
 
   $cv_id = 0;
   if ($step == 1) {
-  	$cv_id = $form_state['storage']['cv_id'];
-  	$cvterm_name = $form_state['storage']['name'];
-  	$cvterm_id = $form_state['storage']['cvterm_id'];
-  }	
+    $cv_id = $form_state['storage']['cv_id'];
+    $cvterm_name = $form_state['storage']['name'];
+    $cvterm_id = $form_state['storage']['cvterm_id'];
+  }  
   // get the cv if form was submitted via AJAX
   $cvterm = '';
   if (array_key_exists('values', $form_state)) {
     $cv_id = $form_state['values']['cv_id'];   
     if (array_key_exists('cvterm', $form_state['values'])) {
-    	$cvterm = $form_state['values']['cvterm'];
+      $cvterm = $form_state['values']['cvterm'];
     }    
   }   
     
@@ -54,22 +54,22 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
   );
     
   if ($cv_id and $step == 0) {
-  	
-  	$form['name']= array(
+    
+    $form['name']= array(
       '#type'          => 'textfield',
       '#title'         => t("Term Name"),
       '#default_value' => $cvterm,
       '#required'      => TRUE,
       '#autocomplete_path' => "admin/tripal/tripal_cv/cvterm/auto_name/$cv_id",
-  	  '#description'   => t('Enter the term to edit.')
+      '#description'   => t('Enter the term to edit.')
     );
     $form['continue']= array(
       '#type'          => 'submit',
       '#value'         => 'continue',
     );
   }
-  elseif ($step == 1) {  	
-  	   
+  elseif ($step == 1) {    
+       
     tripal_cv_add_cvterm_form_fields($form, $form_state, $cv_id, $cvterm_name);
     
     // when editing there are certain fields the user should not change for a term
@@ -100,7 +100,7 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
   } 
   
   if ($step == 0) {
-  	// if we don't have a cv_id then this is the first time the form has
+    // if we don't have a cv_id then this is the first time the form has
     // benn loaded and we need to create the div where ajax replacement elements get stored
     $form['div_replace'] = array(
       '#type' => 'item',
@@ -116,12 +116,12 @@ function tripal_cv_cvterm_edit_form($form, &$form_state) {
  * @param $form_state
  */
 function tripal_cv_cvterm_add_form($form, &$form_state) {
-	$cv_id = 0;
-	if (array_key_exists('values', $form_state)) {
-	  $cv_id = $form_state['values']['cv_id'];	 
-	}
-	
-	// get a list of CVs
+  $cv_id = 0;
+  if (array_key_exists('values', $form_state)) {
+    $cv_id = $form_state['values']['cv_id'];   
+  }
+  
+  // get a list of CVs
   $cvs = array();
   $sql = "SELECT * FROM {cv} WHERE NOT name = 'tripal' ORDER BY name ";
   $results = chado_query($sql);
@@ -248,23 +248,23 @@ function tripal_cv_add_cvterm_form_fields(&$form, $form_state, $cv_id = 0, $cvte
  * @param $form_state
  */
 function tripal_cv_cvterm_edit_form_validate($form, &$form_state) {
-	$cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
+  $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $cvterm_id = array_key_exists('cvterm_id', $form_state['values']) ? $form_state['values']['cvterm_id'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
   
   $step = $form_state['storage']['step'];
-	 
+   
   // make sure the cv term name is unique for this vocabulary
   if ($step == 1) {
-	  $values = array('name' => $name, 'cv_id' => $cv_id);
-	  $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
-	  foreach ($results as $r) {   
-	    if ($r->cvterm_id != $cvterm_id) {
-	      form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
-	    }
-	  }
+    $values = array('name' => $name, 'cv_id' => $cv_id);
+    $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);
+    foreach ($results as $r) {   
+      if ($r->cvterm_id != $cvterm_id) {
+        form_set_error('name', 'The term name must be unique for this vocabulary. Another term with this name already exists.');
+      }
+    }
   }
 }
 /**
@@ -273,24 +273,24 @@ function tripal_cv_cvterm_edit_form_validate($form, &$form_state) {
  * @param $form_state
  */
 function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
-	$cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
+  $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
   $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-		
+    
   $values = array('cv_id' => $cv_id);
   $results = tripal_core_chado_select('cv', array('name'), $values);
-  if (!$results or count($results) == 0){
+  if (!$results or count($results) == 0) {
     form_set_error('cv_id', 'The controlled vocabulary does not exist');
   }
 
   // make sure the DB exists
   $values = array('db_id' => $db_id);
   $results = tripal_core_chado_select('db', array('name'), $values);
-  if (!$results or count($results) == 0){
+  if (!$results or count($results) == 0) {
     form_set_error('db_id', 'The database name does not exist');
   }
-	
+  
   // make sure the cv term name is unique for this vocabulary
   $values = array('name' => $name, 'cv_id' => $cv_id);
   $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);   
@@ -314,8 +314,8 @@ function tripal_cv_cvterm_add_form_validate($form, &$form_state) {
  * @ingroup tripal_cv
  */
 function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
-	
-	$cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
+  
+  $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
   $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
   $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
   $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
@@ -328,15 +328,15 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
   $op    = array_key_exists('op', $form_state['values'])         ? trim($form_state['values']['op']) : '';
   
   
-	$step = $form_state['storage']['step'];
+  $step = $form_state['storage']['step'];
 
-	switch ($step) {
-		case 0:  // a cvterm name has been selected
-			$cv_id = array_key_exists('cv_id', $form_state['values']) ? trim($form_state['values']['cv_id']) : '';
-			$name  = array_key_exists('name', $form_state['values'])  ? trim($form_state['values']['name'])  : '';
-			
-			// get the original cvterm_id
-	    $values = array('name' => $name, 'cv_id' => $cv_id);
+  switch ($step) {
+    case 0:  // a cvterm name has been selected
+      $cv_id = array_key_exists('cv_id', $form_state['values']) ? trim($form_state['values']['cv_id']) : '';
+      $name  = array_key_exists('name', $form_state['values'])  ? trim($form_state['values']['name'])  : '';
+      
+      // get the original cvterm_id
+      $values = array('name' => $name, 'cv_id' => $cv_id);
       $results = tripal_core_chado_select('cvterm', array('cvterm_id'), $values);  
       $cvterm = $results[0]; 
     
@@ -345,50 +345,50 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
       $form_state['storage']['step'] = 1;
       $form_state['storage']['cvterm_id'] = $cvterm->cvterm_id;
       $form_state['rebuild'] = TRUE;
-			break;
-			
-		case 1:  // update/delete button has been clicked					
-		  
-			if ($op == 'Update') {
-			  // get the cv
-			  $values = array('cv_id' => $cv_id);
-			  $results = tripal_core_chado_select('cv', array('name'), $values);
-			  $cv = $results[0];
-			  
-			  // get the db
-			  $values = array('db_id' => $db_id);
-			  $results = tripal_core_chado_select('db', array('name'), $values);
-			  $db = $results[0];
-			  
-			  // now add the term
-			  $term = array(    
-			    'name' => $name,
-			    'namespace' => $cv->name,
-			    'id' => $accession,
-			    'def' => $definition,
-			    'is_obsolete' => $is_obsolete,
-			  );  
-			  
-			  $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
-			  if ($cvterm) {
-			    drupal_set_message('Term updated successfully.');
-			  } 
-			  else {
-			    drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');  
-			  }
-			}
-			if ($op == 'Delete') {
-			  $values = array('cvterm_id' => $cvterm_id);
-			  $success = tripal_core_chado_delete('cvterm', $values);
-			  if ($success) {
-			    drupal_set_message('Term deleted successfully.');	
-			  } 
-			  else {
-			    drupal_set_message('Could not delete term term. Check Drupal recent logs for error messages.', 'error');	
-			  }			     	
-			}
-			break;
-	} 		 
+      break;
+      
+    case 1:  // update/delete button has been clicked          
+      
+      if ($op == 'Update') {
+        // get the cv
+        $values = array('cv_id' => $cv_id);
+        $results = tripal_core_chado_select('cv', array('name'), $values);
+        $cv = $results[0];
+        
+        // get the db
+        $values = array('db_id' => $db_id);
+        $results = tripal_core_chado_select('db', array('name'), $values);
+        $db = $results[0];
+        
+        // now add the term
+        $term = array(    
+          'name' => $name,
+          'namespace' => $cv->name,
+          'id' => $accession,
+          'def' => $definition,
+          'is_obsolete' => $is_obsolete,
+        );  
+        
+        $cvterm = tripal_cv_add_cvterm($term, $cv->name, $is_relationship, TRUE, $db->name);
+        if ($cvterm) {
+          drupal_set_message('Term updated successfully.');
+        } 
+        else {
+          drupal_set_message('Could not add term. Check Drupal recent logs for error messages.', 'error');  
+        }
+      }
+      if ($op == 'Delete') {
+        $values = array('cvterm_id' => $cvterm_id);
+        $success = tripal_core_chado_delete('cvterm', $values);
+        if ($success) {
+          drupal_set_message('Term deleted successfully.');  
+        } 
+        else {
+          drupal_set_message('Could not delete term term. Check Drupal recent logs for error messages.', 'error');  
+        }             
+      }
+      break;
+  }      
 }
 
 /**
@@ -397,15 +397,15 @@ function tripal_cv_cvterm_edit_form_submit($form, &$form_state) {
  * @param unknown_type $form_state
  */
 function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
-	$cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
-	$name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
-	$definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
-	$is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
-	$is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
-	
-	$db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
-	$accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
-	
+  $cv_id = array_key_exists('cv_id', $form_state['values']) ? $form_state['values']['cv_id'] : '';
+  $name = array_key_exists('name', $form_state['values']) ? $form_state['values']['name'] : '';
+  $definition = array_key_exists('definition', $form_state['values']) ? $form_state['values']['definition'] : '';
+  $is_relationship = array_key_exists('is_relationship', $form_state['values']) ? $form_state['values']['is_relationship'] : '';
+  $is_obsolete = array_key_exists('is_obsolete', $form_state['values']) ? $form_state['values']['is_obsolete'] : '';
+  
+  $db_id = array_key_exists('db_id', $form_state['values']) ? $form_state['values']['db_id'] : '';
+  $accession = array_key_exists('accession', $form_state['values']) ? $form_state['values']['accession'] : '';
+  
   // get the database
   $values = array('db_id' => $db_id);
   $results = tripal_core_chado_select('db', array('name'), $values);

+ 6 - 6
tripal_cv/includes/obo_loader.inc

@@ -172,9 +172,9 @@ function tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = T
   $url_fh = fopen($url, "r");
   $obo_fh = fopen($temp, "w");
   if (!$url_fh) {
-    tripal_cv_obo_quiterror("Unable to download the remote OBO file at $url. Could a firewall be blocking outgoing connections? ".
-          " if you are unable to download the file you may manually downlod the OBO file and use the web interface to ".
-          " specify the location of the file on your server.");
+    tripal_cv_obo_quiterror("Unable to download the remote OBO file at $url. Could a firewall be blocking outgoing connections? " .
+      " if you are unable to download the file you may manually downlod the OBO file and use the web interface to " .
+      " specify the location of the file on your server.");
 
   }
   while (!feof($url_fh)) {
@@ -284,7 +284,7 @@ function tripal_cv_obo_quiterror($message) {
 /*
  * 
  */
-function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid){
+function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
   $sql = "SELECT * FROM {tripal_obo_temp} WHERE type = 'Typedef' ";
   $typedefs = chado_query($sql);
   
@@ -912,7 +912,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
       'return_record' => FALSE
     );
     $result = tripal_core_chado_insert('cvterm_dbxref', $values, $ins_options);
-    if (!$result){
+    if (!$result) {
       tripal_cv_obo_quiterror("Cannot add cvterm_dbxref: $xref");
       return FALSE;
     }
@@ -1001,7 +1001,7 @@ function tripal_cv_obo_add_dbxref($db_id, $accession, $version='', $description=
   );
   $options = array('statement_name' => 'sel_dbxref_idac');
   $result = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $options);
-  if (count($result) == 0){
+  if (count($result) == 0) {
     $ins_values = array(
       'db_id'       => $db_id,
       'accession'   => $accession,

+ 4 - 3
tripal_cv/includes/tripal_cv_admin.inc

@@ -334,7 +334,8 @@ function tripal_cv_cvterm_form(&$form_state, $action = 'add') {
       if ($name) {
         $form['add_cvterm']['name']['#attributes'] = array('readonly' => 'readonly');
         $form['add_cvterm']['name']['#description'] = 'The term name cannot be changed. If the name is incorrect, please create a new term and make this one as obsolete.';
-      } else {
+      } 
+      else {
         $form['add_cvterm']['name']['#autocomplete_path'] = "admin/tripal/tripal_cv/cvterm/auto_name/$cv_id";
         $form['add_cvterm']['name']['#ahah'] = array(
            'path'    => 'admin/tripal/tripal_cv/cvterm/ahah',
@@ -456,7 +457,7 @@ function tripal_cv_cvterm_form_submit($form, &$form_state) {
   // get the database
   $values = array('db_id' => $form_state['values']['db_id']);
   $results = tripal_core_chado_select('db', array('name'), $values);
-  if (!$results or count($results) == 0){
+  if (!$results or count($results) == 0) {
     drupal_set_message(t('Unable to add term.  Cannot find the database.'), 'error');
     return;
   }
@@ -465,7 +466,7 @@ function tripal_cv_cvterm_form_submit($form, &$form_state) {
   // get the cv
   $values = array('cv_id' => $form_state['values']['cv_id']);
   $results = tripal_core_chado_select('cv', array('name'), $values);
-  if (!$results or count($results) == 0){
+  if (!$results or count($results) == 0) {
     drupal_set_message(t('Unable to add term.  Cannot find the vocabulary.'), 'error');
     return;
   }

+ 2 - 2
tripal_db/api/tripal_db.api.inc

@@ -252,11 +252,11 @@ function tripal_db_get_dbxref($select_values) {
 function tripal_db_get_dbxref_by_accession($accession, $db_id=0) {
 
   if (!empty($db_id)) {
-  	$sql = "SELECT * FROM {dbxref} WHERE accession = :accession AND db_id = :db_id";
+    $sql = "SELECT * FROM {dbxref} WHERE accession = :accession AND db_id = :db_id";
     $r = chado_query($sql, array(':accession' => $accession, ':db_id' => $db_id));
   }
   else {
-  	$sql = "SELECT * FROM {dbxref} WHERE accession = :accession";
+    $sql = "SELECT * FROM {dbxref} WHERE accession = :accession";
     $r = chado_query($sql, array(':accession' => $accession));
   }
 

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

@@ -27,11 +27,11 @@ function tripal_db_select_form() {
  */
 function tripal_db_db_edit_form($form, &$form_state) {
   
-	// get the dbid if form was submitted via AJAX
-	$dbid = 0;
-	if (array_key_exists('values', $form_state)) {
+  // get the dbid if form was submitted via AJAX
+  $dbid = 0;
+  if (array_key_exists('values', $form_state)) {
     $dbid = $form_state['values']['dbid'];
-	}  
+  }  
   
   // get a list of db from chado for user to choose
   $sql = "SELECT * FROM {db} WHERE NOT name = 'tripal' ORDER BY name ";
@@ -62,25 +62,25 @@ function tripal_db_db_edit_form($form, &$form_state) {
   // add in the other fields
   if ($dbid) {
     tripal_db_add_db_form_fields($form, $form_state, $dbid);
-    	  
-	  $form['update'] = array(
-	    '#type'         => 'submit',
-	    '#value'        => t('Update'),
-	  );
-	  $form['delete'] = array(
-	    '#type'         => 'submit',
-	    '#value'        => t('Delete'),
-	    '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'), 
+        
+    $form['update'] = array(
+      '#type'         => 'submit',
+      '#value'        => t('Update'),
+    );
+    $form['delete'] = array(
+      '#type'         => 'submit',
+      '#value'        => t('Delete'),
+      '#attributes'   => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'), 
     );
   }
   else {
-  	// if we don't have a dbid then this is the first time the form has
-  	// benn loaded and we need to create the div where ajax replacement elements get stored
-  	$form['div_replace'] = array(
-  	  '#type' => 'item',
-  	  '#prefix' => '<div id="db-edit-div">',
-  	  '#suffix' => '</div>',
-  	);
+    // if we don't have a dbid then this is the first time the form has
+    // benn loaded and we need to create the div where ajax replacement elements get stored
+    $form['div_replace'] = array(
+      '#type' => 'item',
+      '#prefix' => '<div id="db-edit-div">',
+      '#suffix' => '</div>',
+    );
   }
   return $form;
 }
@@ -92,8 +92,8 @@ function tripal_db_db_edit_form($form, &$form_state) {
  * @ingroup tripal_db
  */
 function tripal_db_db_add_form($form, $form_state) {
-	
-	// add in the form fields to this form
+  
+  // add in the form fields to this form
   tripal_db_add_db_form_fields($form, $form_state);
   
   $form['add'] = array(
@@ -112,8 +112,8 @@ function tripal_db_db_add_form($form, $form_state) {
  * @ingroup tripal_db
  */
 function tripal_db_add_db_form_fields(&$form, $form_state, $dbid = NULL) {
-	
-	$default_db        = '';
+  
+  $default_db        = '';
   $default_desc      = '';
   $default_url       = '';
   $default_urlprefix = '';
@@ -288,17 +288,17 @@ function tripal_db_db_edit_form_submit($form, &$form_state) {
  * @ingroup tripal_db
  */
 function tripal_db_edit_form_ajax($form, $form_state) {
-	
-	$elements = array();
-	
-	// add in the form fields and the buttons	
-	if (array_key_exists('dbid', $form_state['values'])) {
-		$elements['fields'] = $form['fields'];
-		$elements['update'] = $form['update'];
-		$elements['delete'] = $form['delete'];
-	}
-	
-	 // add back in the db-edit-div that is used for the next round of AJAX
+  
+  $elements = array();
+  
+  // add in the form fields and the buttons  
+  if (array_key_exists('dbid', $form_state['values'])) {
+    $elements['fields'] = $form['fields'];
+    $elements['update'] = $form['update'];
+    $elements['delete'] = $form['delete'];
+  }
+  
+   // add back in the db-edit-div that is used for the next round of AJAX
   $elements['fields']['#prefix'] =  '<div id="db-edit-div">';
   $elements['fields']['#suffix'] =  '</div">';
   
@@ -307,8 +307,8 @@ function tripal_db_edit_form_ajax($form, $form_state) {
   $elements['fields']['description']['#value'] = $elements['fields']['description']['#default_value'];
   $elements['fields']['url']['#value']         = $elements['fields']['url']['#default_value'];
   $elements['fields']['urlprefix']['#value']   = $elements['fields']['urlprefix']['#default_value'];
-	
-	//drupal_set_message('<pre>' . print_r($elements, TRUE) . '</pre>', "status");
-	
+  
+  //drupal_set_message('<pre>' . print_r($elements, TRUE) . '</pre>', "status");
+  
   return $elements;
 }

+ 8 - 8
tripal_feature/api/tripal_feature.api.inc

@@ -496,7 +496,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
   }
   
   if ($rel_part == "object" or $rel_part == "subject") { 
-    if($rel_part == "subject") {
+    if ($rel_part == "subject") {
       $psql = '
         PREPARE feature_rel_get_object (int, text) AS
         SELECT FO.feature_id, FO.name, FO.uniquename, CVTO.name as feature_type, O.genus, O.species
@@ -518,7 +518,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       $sql = "EXECUTE feature_rel_get_object(%d,'%s')";
       $features = chado_query($sql, $feature_id, $relationship); 
     }
-    if($rel_part == "object") {
+    if ($rel_part == "object") {
       $psql = '
         PREPARE feature_rel_get_subject (int, text) AS
         SELECT FS.feature_id, FS.name, FS.uniquename, CVTO.name as feature_type, O.genus, O.species
@@ -552,7 +552,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       }
       $sequences .= tripal_feature_get_formatted_sequence($feature->feature_id, $defline, 
         $num_bases_per_line, $derive_from_parent, $aggregate, $output_format,
-        $upstream, $downstream, $sub_features,'','');  
+        $upstream, $downstream, $sub_features, '', '');  
     }  
     return $sequences;  
   }
@@ -776,7 +776,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       elseif ($output_format == 'fasta_txt') {
          $seq = wordwrap($seq, $num_bases_per_line, "\r\n", TRUE);
       }
-      $residues .= ">$feature_name. Sequence derived from feature of type, '$parent->srctypename', of $parent->genus $parent->species: $parent->srcname:" . ($parent->adjfmin + 1) . ".." . $parent->adjfmax ." ($dir). ";
+      $residues .= ">$feature_name. Sequence derived from feature of type, '$parent->srctypename', of $parent->genus $parent->species: $parent->srcname:" . ($parent->adjfmin + 1) . ".." . $parent->adjfmax . " ($dir). ";
       if (count($types) > 0) {
         $residues .= "Excludes all bases but those of type(s): " . implode(', ', $types) . ". " ;
       }
@@ -1038,7 +1038,7 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     $options = array('statement_name' => 'ins_db_na');
     $success = tripal_core_chado_insert('db', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ". 
+      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " . 
         "could not be added because the database, %dbname, does not exist and cannot be added.', 
         array('%feature_id' => $feature_id, '%dbname' => $dbname), WATCHDOG_WARNING);
       return FALSE;
@@ -1062,7 +1062,7 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
     $options = array('statement_name' => 'ins_featuredbxref_dbfe');
     $success = tripal_core_chado_insert('feature_dbxref', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, '. 
+      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' . 
         'could not be added: %db:%accession.', array('%feature_id' => $feature_id, '%db' => $dbname, 
         '%accession' => $accession), WATCHDOG_WARNING);
       return FALSE;
@@ -1096,7 +1096,7 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     $options = array('statement_name' => 'ins_cv_na');
     $success = tripal_core_chado_insert('cv', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ". 
+      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " . 
         "could not be added because the CV, %cvname, does not exist and cannot be added.', 
         array('%feature_id' => $feature_id, '%cvname' => $cvname), WATCHDOG_WARNING);
       return FALSE;
@@ -1121,7 +1121,7 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
     $options = array('statement_name' => 'ins_featurecvterm_cvfepu');
     $success = tripal_core_chado_insert('feature_cvterm', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, '. 
+      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' . 
         'could not be added: %cvterm.', array('%feature_id' => $feature_id, '%cvterm' => $cvterm), WATCHDOG_WARNING);
       return FALSE;
     }

+ 2 - 2
tripal_feature/includes/fasta_loader.inc

@@ -528,7 +528,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
         // if the match_type is name and no regular expression was provided
         // then use the first word as the name, otherwise we don't set the name
         if (strcmp($match_type, 'Name')==0) {
-          if(preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)){
+          if (preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)) {
             if (strlen($matches[1]) > $feature_tbl['fields']['name']['length']) {
               watchdog('trp-fasta', "WARNING: Regular expression retrieves a feature name too long for the feature name. Line %line.", array('%line' => $i), 'error');  
             }
@@ -553,7 +553,7 @@ function tripal_feature_load_fasta($dfile, $organism_id, $type,
         // if the match_type is name and no regular expression was provided
         // then use the first word as the name, otherwise, we don't set the unqiuename
         if (strcmp($match_type, 'Unique name')==0) {
-          if(preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)){
+          if (preg_match("/^\s*(.*?)[\s\|].*$/", $line, $matches)) {
             $uname = trim($matches[1]);
           }
           else {

+ 11 - 11
tripal_feature/includes/gff_loader.inc

@@ -403,7 +403,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
                 LEFT JOIN {cvtermsynonym} CVTS on CVTS.cvterm_id = CVT.cvterm_id
              WHERE CV.cv_id = $1 and 
                (lower(CVT.name) = lower($2) or lower(CVTS.synonym) = lower($3))";
-     $status = tripal_core_chado_prepare('sel_cvterm_idnasy', $psql, array('int','text','text'));
+     $status = tripal_core_chado_prepare('sel_cvterm_idnasy', $psql, array('int', 'text', 'text'));
      if (!$status) {
        watchdog('T_gff3_loader', 'cannot prepare statement \'sel_cvterm_idnasy\'.', 
          array(), WATCHDOG_ERROR);
@@ -420,7 +420,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     $num_read += $size;
     $intv_read += $size; 
     
-    if($line_num < $start_line) {
+    if ($line_num < $start_line) {
       continue;
     }    
     
@@ -435,7 +435,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
     // check to see if we have FASTA section, if so then set the variable
     // to start parsing
     if (preg_match('/^##FASTA/i', $line)) {
-      if($remove) {
+      if ($remove) {
         // we're done because this is a delete operation so break out of the loop.
         break;         
       }
@@ -609,7 +609,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
           }
         } 
         else {
-          watchdog('T_gff3_loader', "The organism attribute '%org' on line %line is not properly formated. It ".
+          watchdog('T_gff3_loader', "The organism attribute '%org' on line %line is not properly formated. It " .
             "should be of the form: organism=Genus:species.  Skipping this line.", 
             array('%org' => $attr_organism, '%line' => $line_num), WATCHDOG_ERROR);
           $skip_feature = 1;  
@@ -704,11 +704,11 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
         $count = tripal_core_chado_select('feature', $columns, $select, $options); 
         if (!$count or count($count) == 0 or $count[0]->num_landmarks == 0) {
           watchdog('T_gff3_loader', "The landmark '%landmark' cannot be found for this organism (%species) " .
-                "Please add the landmark and then retry the import of this GFF3 ".
+                "Please add the landmark and then retry the import of this GFF3 " .
                 "file", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species), WATCHDOG_ERROR);
           return '';
         }
-        elseif($count[0]->num_landmarks > 1) {
+        elseif ($count[0]->num_landmarks > 1) {
           watchdog('T_gff3_loader', "The landmark '%landmark' has more than one entry for this organism (%species) " .
                 "Cannot continue", array('%landmark' => $landmark, '%species' => $organism->genus . " " . $organism->species), WATCHDOG_ERROR);
           return '';  
@@ -716,7 +716,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
 
       }
       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 '';
       }  
@@ -850,7 +850,7 @@ function tripal_feature_load_gff3($gff_file, $organism_id, $analysis_id,
             FROM {feature_relationship} FR              
               INNER JOIN {featureloc} FL on FL.feature_id = FR.subject_id";
     if (!$connection) {
-      $sql .= "WHERE FR.object_id = %d ".
+      $sql .= "WHERE FR.object_id = %d " .
               "ORDER BY FL.fmin ASC ";
     }
     else {
@@ -957,8 +957,8 @@ 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 ".
-      "for %uniquename and %subject.  Subject feature, '%subject', ".
+    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;
   }
@@ -1008,7 +1008,7 @@ function tripal_feature_load_gff3_parents($feature, $cvterm, $parents, $organism
                INNER JOIN {cv} CV on CVT.cv_id = CV.cv_id
                LEFT JOIN {cvtermsynonym} CVTS on CVTS.cvterm_id = CVT.cvterm_id
              WHERE cv.name = $1 and (CVT.name = $2 or CVTS.synonym = $3)";
-    $status = tripal_core_chado_prepare('sel_cvterm_cvname_cvtname_synonym', $psql, array('text', 'text' ,'text'));
+    $status = tripal_core_chado_prepare('sel_cvterm_cvname_cvtname_synonym', $psql, array('text', 'text', 'text'));
     if (!$status) {
        watchdog("T_gff3_loader", "Cannot prepare statement 'sel_cvterm_cvname_cvtname_synonym' for ontology term", 
          array(), WATCHDOG_WARNING);

+ 5 - 5
tripal_feature/includes/indexFeatures.inc

@@ -74,9 +74,9 @@ function tripal_features_reindex($max_sync, $job_id = NULL) {
   // SQL statement is derived from the hook_search function in the Drupal API.
   // Essentially, this is the SQL statement that finds all nodes that need
   // reindexing, but adjusted to include the chado_feature
-  $sql = "SELECT N.nid, N.title, CF.feature_id ".
-        "FROM {node} N ".
-        "  INNER JOIN {chado_feature} CF ON CF.nid = N.nid ";
+  $sql = "SELECT N.nid, N.title, CF.feature_id " .
+         "FROM {node} N " .
+         "  INNER JOIN {chado_feature} CF ON CF.nid = N.nid ";
   $results = db_query($sql);
 
   // load into ids array
@@ -144,8 +144,8 @@ function tripal_feature_index_feature($feature_id, $nid) {
   // if we only have a feature_id then let's find a corresponding
   // node.  If we can't find a node then return.
   if (!$nid) {
-    $nsql = "SELECT N.nid,N.title FROM {chado_feature} CF ".
-            "  INNER JOIN {node} N ON N.nid = CF.nid ".
+    $nsql = "SELECT N.nid,N.title FROM {chado_feature} CF " .
+            "  INNER JOIN {node} N ON N.nid = CF.nid " .
             "WHERE CF.feature_id = %d";
     $node = db_fetch_object(db_query($nsql, $feature_id));
     if (!$node) {

+ 7 - 7
tripal_feature/includes/seq_extract.inc

@@ -4,7 +4,7 @@
  */
 function tripal_feature_seq_extract_page() {
   
-  if ($_SESSION['tripal_feature_seq_extract']['download']){   
+  if ($_SESSION['tripal_feature_seq_extract']['download']) {   
     $genus      = $_SESSION['tripal_feature_seq_extract']['genus'];
     $species    = $_SESSION['tripal_feature_seq_extract']['species'];
     $analysis   = $_SESSION['tripal_feature_seq_extract']['analysis'];
@@ -45,7 +45,7 @@ function tripal_feature_seq_extract_page() {
         views must be populated before using this form.  Those views should be re-populated 
         when new data is added.  If you use the " . l('jquery_update module', 'http://drupal.org/project/jquery_update') . ", it may break this form.
         You will need to update the  jquery_update/replace/jquery.form.js file with " .
-        l('a more recent version','https://raw.github.com/malsup/form/master/jquery.form.js') . "</p>         
+        l('a more recent version', 'https://raw.github.com/malsup/form/master/jquery.form.js') . "</p>         
       </div>
     ";
   }
@@ -471,12 +471,12 @@ function tripal_feature_seq_extract_get_features($org_commonname, $genus, $speci
 
   // get the list of features
   $vars = array();
-  $sql  = "SELECT DISTINCT F.feature_id, F.name, F.uniquename, O.genus, O.species, CVT.name as feature_type ".
-          "FROM {feature} F ".
-          "  INNER JOIN {organism} O on O.organism_id = F.organism_id ".
+  $sql  = "SELECT DISTINCT F.feature_id, F.name, F.uniquename, O.genus, O.species, CVT.name as feature_type " .
+          "FROM {feature} F " .
+          "  INNER JOIN {organism} O on O.organism_id = F.organism_id " .
           "  INNER JOIN {cvterm} CVT on CVT.cvterm_id = F.type_id ";
   if ($analysis_name) {
-     $sql .= "  INNER JOIN {analysisfeature} AF on AF.feature_id = F.feature_id ".
+     $sql .= "  INNER JOIN {analysisfeature} AF on AF.feature_id = F.feature_id " .
              "  INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id ";
   }         
   $sql .= "WHERE (1=1) ";
@@ -524,7 +524,7 @@ function tripal_feature_seq_extract_get_features($org_commonname, $genus, $speci
     $feature_id = $feature->feature_id;
     
     // build the header for each FASTA entry
-    if($feature->uniquename == $feature->name) {
+    if ($feature->uniquename == $feature->name) {
       $feature_name = "$feature->uniquename $feature->feature_type ($feature->genus $feature->species)";
     } 
     else {

+ 2 - 2
tripal_feature/includes/tripal_feature-db_references.inc

@@ -312,8 +312,8 @@ function theme_tripal_feature_edit_ALL_db_references_form($form) {
 
   $output .= '<br /><fieldset>';
   $output .= '<legend>Edit Existing Database References<span class="form-optional" title="This field is optional">(optional)</span></legend>';
-  $output .= '<p>Below is a list of already existing database references, one per line. When entering a database reference, the accession '
-         .'is a unique identifier for this feature in the specified database.</p>';
+  $output .= '<p>Below is a list of already existing database references, one per line. When entering a database reference, the accession ' .
+             'is a unique identifier for this feature in the specified database.</p>';
   $output .= '<table>';
   $output .= '<tr><th>#</th><th>Database</th><th>Accession</th><th></th></tr>';
 

+ 2 - 2
tripal_feature/includes/tripal_feature-properties.inc

@@ -277,8 +277,8 @@ function theme_tripal_feature_edit_ALL_properties_form($form) {
 
   $output .= '<br /><fieldset>';
   $output .= '<legend>Edit Already Existing Properties<span class="form-optional" title="This field is optional">(optional)</span></legend>';
-  $output .= '<p>Below is a list of already existing properties for this feature, one property per line. The type refers to the type of '
-         .'property and the value is the value for that property. </p>';
+  $output .= '<p>Below is a list of already existing properties for this feature, one property per line. The type refers to the type of ' .
+             'property and the value is the value for that property. </p>';
   $output .= '<table>';
   $output .= '<tr><th>#</th><th>Type</th><th>Value</th><th></th></tr>';
 

+ 3 - 3
tripal_feature/includes/tripal_feature-relationships.inc

@@ -498,9 +498,9 @@ function theme_tripal_feature_edit_ALL_relationships_form($form) {
 
   $output .= '<br /><fieldset>';
   $output .= '<legend>Edit Already Existing Relationships<span class="form-optional" title="This field is optional">(optional)</span></legend>';
-  $output .= '<p>Each relationship for this stock is listed below, one per line. The textboxes indicating '
-        .'the subject and object of the relationship can contain the uniquename, name, database '
-      .'reference or synonym of a stock of the same organism.</p>';
+  $output .= '<p>Each relationship for this stock is listed below, one per line. The textboxes indicating ' .
+             'the subject and object of the relationship can contain the uniquename, name, database ' .
+             'reference or synonym of a stock of the same organism.</p>';
   $output .= '<table>';
   $output .= '<tr><th>#</th><th>Subject</th><th>Type</th><th>Object</th><th></th></tr>';
 

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

@@ -39,9 +39,9 @@ function tripal_feature_admin() {
 
     $form['browser']['browser_desc'] = array(
        '#type'        => 'markup',
-       '#value' => 'A feature browser can be added to an organism page to allow users to quickly '.
-          'access a feature.  This will most likely not be the ideal mechanism for accessing feature '.
-          'information, especially for large sites, but it will alow users exploring the site (such '.
+       '#value' => 'A feature browser can be added to an organism page to allow users to quickly ' .
+          'access a feature.  This will most likely not be the ideal mechanism for accessing feature ' .
+          'information, especially for large sites, but it will alow users exploring the site (such ' .
           'as students) to better understand the data types available on the site.',
 
     );
@@ -98,7 +98,7 @@ function tripal_feature_admin() {
 
     $form['summary']['feature_summary'] = array(
        '#title' => 'Feature Summary on Organism Page',
-       '#description' => 'A feature summary can be added to an organism page to allow users to see the '.
+       '#description' => 'A feature summary can be added to an organism page to allow users to see the ' .
           'type and quantity of features available for the organism.',
        '#type' => 'radios',
        '#options' => $allowedoptions2,
@@ -106,10 +106,10 @@ function tripal_feature_admin() {
     );
     $form['summary']['feature_mapping'] = array(
        '#title' => 'Map feature types',
-       '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the '.
-          'feature summary report by listing them in the following text area.   Enter one per line. '.
-          'If left blank, all SO terms for all features will be shown in the report. Only those terms '.
-          'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a '.
+       '#description' => t('You may specify which Sequence Ontology (SO) terms to show in the ' .
+          'feature summary report by listing them in the following text area.   Enter one per line. ' .
+          'If left blank, all SO terms for all features will be shown in the report. Only those terms ' .
+          'listed below will be shown in the report. Terms will appear in the report in the same order listed. To rename a ' .
           'SO term to be more human readable form, use an \'=\' sign after the SO term (e.g. \'polypeptide = Protein\')'),
        '#type' => 'textarea',
        '#rows' => 15,
@@ -133,10 +133,10 @@ function tripal_feature_admin() {
        '#collapsed' => FALSE,
     );
     $form['notice']['message'] = array(
-       '#value' => t('Currently, feature management jobs are waiting or ".
-          "are running. Managemment features have been hidden until these ".
-          "jobs complete.  Please check back later once these jobs have ".
-          "finished.  You can view the status of pending jobs in the Tripal ".
+       '#value' => t('Currently, feature management jobs are waiting or " .
+          "are running. Managemment features have been hidden until these " .
+          "jobs complete.  Please check back later once these jobs have " .
+          "finished.  You can view the status of pending jobs in the Tripal " .
           "jobs page.'),
     );
   }
@@ -210,14 +210,14 @@ function get_tripal_feature_admin_form_cleanup_set(&$form) {
   );
   $form['cleanup']['description'] = array(
     '#type' => 'item',
-    '#value' => t("With Drupal and chado residing in different databases ".
-      "it is possible that nodes in Drupal and features in Chado become ".
-      "\"orphaned\".  This can occur if a feature node in Drupal is ".
-      "deleted but the corresponding chado feature is not and/or vice ".
-      "versa.  The Cleanup function will also remove nodes for features ".
-      "that are not in the list of allowed feature types as specified ".
-      "above.  This is helpful when a feature type needs to be ".
-      "removed but was previously present as Drupal nodes. ".
+    '#value' => t("With Drupal and chado residing in different databases " .
+      "it is possible that nodes in Drupal and features in Chado become " .
+      "\"orphaned\".  This can occur if a feature node in Drupal is " .
+      "deleted but the corresponding chado feature is not and/or vice " .
+      "versa.  The Cleanup function will also remove nodes for features " .
+      "that are not in the list of allowed feature types as specified " .
+      "above.  This is helpful when a feature type needs to be " .
+      "removed but was previously present as Drupal nodes. " .
       "Click the button below to resolve these discrepancies."),
     '#weight' => 1,
   );
@@ -242,10 +242,10 @@ function get_tripal_feature_admin_form_reindex_set(&$form) {
   );
   $form['reindex']['description'] = array(
      '#type' => 'item',
-     '#value' => t("Indexing or reindexing of nodes is required for Drupal's full text searching. ".
-        "Index features for the first time to allow for searching of content, and later when content for features ".
-        "is updated.  Depending on the number of features this may take ".
-        "quite a while. Click the button below to begin reindexing of ".
+     '#value' => t("Indexing or reindexing of nodes is required for Drupal's full text searching. " .
+        "Index features for the first time to allow for searching of content, and later when content for features " .
+        "is updated.  Depending on the number of features this may take " .
+        "quite a while. Click the button below to begin reindexing of " .
         "features. "),
      '#weight' => 1,
   );
@@ -272,8 +272,8 @@ function get_tripal_feature_admin_form_taxonomy_set(&$form) {
 
   $form['taxonomy']['description'] = array(
      '#type' => 'item',
-     '#value' => t("Drupal allows for assignment of \"taxonomy\" or ".
-        "catagorical terms to nodes. These terms allow for advanced ".
+     '#value' => t("Drupal allows for assignment of \"taxonomy\" or " .
+        "catagorical terms to nodes. These terms allow for advanced " .
         "filtering during searching."),
      '#weight' => 1,
   );
@@ -286,7 +286,7 @@ function get_tripal_feature_admin_form_taxonomy_set(&$form) {
   $form['taxonomy']['tax_classes'] = array(
    '#title'       => t('Available Taxonomic Classes'),
    '#type'        => t('checkboxes'),
-   '#description' => t("Please select the class of terms to assign to ".
+   '#description' => t("Please select the class of terms to assign to " .
       "chado features"),
    '#required'    => FALSE,
    '#prefix'      => '<div id="taxclass_boxes">',
@@ -420,7 +420,7 @@ function tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) {
 
   // iterate through all drupal feature nodes and set the taxonomy
   $results = db_query("SELECT * FROM {chado_feature}");
-  $nsql =  "SELECT * FROM {node} ".
+  $nsql =  "SELECT * FROM {node} " .
           "WHERE nid = %d";
   $i = 0;
 
@@ -500,10 +500,10 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
   }
 
   // get the cvterm and the organism for this feature
-  $sql = "SELECT CVT.name AS cvname, O.genus, O.species ".
-        "FROM {CVTerm} CVT ".
-        "  INNER JOIN {Feature} F on F.type_id = CVT.cvterm_id ".
-        "  INNER JOIN {Organism} O ON F.organism_id = O.organism_id ".
+  $sql = "SELECT CVT.name AS cvname, O.genus, O.species " .
+        "FROM {CVTerm} CVT " .
+        "  INNER JOIN {Feature} F on F.type_id = CVT.cvterm_id " .
+        "  INNER JOIN {Organism} O ON F.organism_id = O.organism_id " .
         "WHERE F.feature_id = $feature_id";
   $feature = db_fetch_object(chado_query($sql));
 
@@ -518,9 +518,9 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
 
   // get the library that this feature may belong to and add it as taxonomy
   if ($do_lb && $lb_vid) {
-    $sql = "SELECT L.name ".
-           "FROM {Library} L ".
-           "  INNER JOIN {Library_feature} LF ON LF.library_id = L.library_id ".
+    $sql = "SELECT L.name " .
+           "FROM {Library} L " .
+           "  INNER JOIN {Library_feature} LF ON LF.library_id = L.library_id " .
            "WHERE LF.feature_id = %d ";
     $library = db_fetch_object(chado_query($sql, $feature_id));
     $tags["$lb_vid"] = "$library->name";
@@ -534,9 +534,9 @@ function tripal_feature_set_taxonomy($node, $feature_id) {
   // get the analysis that this feature may belong to and add it as taxonomy
   // We'll add each one individually since there may be more than one analysis
   if ($do_an && $an_vid) {
-    $sql = "SELECT A.name ".
-           "FROM {Analysis} A ".
-           "  INNER JOIN {Analysisfeature} AF ON AF.analysis_id = A.analysis_id ".
+    $sql = "SELECT A.name " .
+           "FROM {Analysis} A " .
+           "  INNER JOIN {Analysisfeature} AF ON AF.analysis_id = A.analysis_id " .
            "WHERE AF.feature_id = $feature_id ";
     $results = chado_query($sql);
     $analysis_terms = array();

+ 30 - 30
tripal_feature/includes/tripal_feature.sync_features.inc

@@ -39,22 +39,22 @@ function tripal_feature_sync_form() {
 
   $form['description'] = array(
   '#type' => 'item',
-  '#value' => t("Add feature types, optionally select an organism and ".
-     "click the 'Sync all Features' button to create Drupal ".
-     "content for features in chado. Only features of the types listed ".
-     "below in the Feature Types box will be synced. You may limit the ".
-     "features to be synced by a specific organism. Depending on the ".
-     "number of features in the chado database this may take a long ".
+  '#value' => t("Add feature types, optionally select an organism and " .
+     "click the 'Sync all Features' button to create Drupal " .
+     "content for features in chado. Only features of the types listed " .
+     "below in the Feature Types box will be synced. You may limit the " .
+     "features to be synced by a specific organism. Depending on the " .
+     "number of features in the chado database this may take a long " .
      "time to complete. "),
   );
 
   $form['feature_types'] = array(
     '#title'       => t('Feature Types'),
     '#type'        => 'textarea',
-    '#description' => t("Enter the names of the feature types to sync.  Pages for these feature ".
-       "types will be created automatically for features that exist in the ".
-       "chado database.  The names listed here should be spearated by ".
-       "spaces or entered separately on new lines. The names must match ".
+    '#description' => t("Enter the names of the feature types to sync.  Pages for these feature " .
+       "types will be created automatically for features that exist in the " .
+       "chado database.  The names listed here should be spearated by " .
+       "spaces or entered separately on new lines. The names must match " .
        "exactly (spelling and case) with terms in the sequence ontology"),
     '#required'    => TRUE,
     '#default_value' => variable_get('chado_sync_feature_types', 'gene contig'),
@@ -106,7 +106,7 @@ function tripal_feature_sync_form_submit($form, &$form_state) {
 
   if ($organism_id) {
     $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $organism_id));
-    $title = "Sync all features for " .  $organism[0]->genus . " " . $organism[0]->species;
+    $title = "Sync all features for " . $organism[0]->genus . " " . $organism[0]->species;
   }
   else {
     $title = t('Sync all features for all synced organisms');
@@ -178,7 +178,7 @@ function tripal_feature_set_urls($na = NULL, $job = NULL) {
     
     // if the src and dst is the same (the URL alias couldn't be set)
     // then skip to the next one. There's nothing we can do about this one.
-    if($src == $dst) {
+    if ($src == $dst) {
       continue;
     }
     
@@ -236,7 +236,7 @@ function tripal_feature_set_urls($na = NULL, $job = NULL) {
 function tripal_feature_get_feature_url($node, $url_alias = NULL) {
 
   // get the starting URL alias
-  if(!$url_alias) {
+  if (!$url_alias) {
     $url_alias = variable_get('chado_feature_url_string', '/feature/[genus]/[species]/[type]/[uniquename]'); 
     if (!$url_alias) {
       $url_alias = '/feature/[genus]/[species]/[type]/[uniquename]';
@@ -341,11 +341,11 @@ function tripal_feature_sync_features($max_sync = 0, $organism_id = NULL,
   $where_org = drupal_substr($where_org, 0, drupal_strlen($where_org)-3);  # strip trailing 'OR'
 
   // use this SQL statement to get the features that we're going to upload
-  $sql = "SELECT feature_id ".
-        "FROM {FEATURE} F ".
-        "  INNER JOIN {Cvterm} CVT ON F.type_id = CVT.cvterm_id ".
-        "  INNER JOIN {CV} on CV.cv_id = CVT.cv_id ".
-        "WHERE ($where_cvt) AND ($where_org) AND CV.name = 'sequence' ".
+  $sql = "SELECT feature_id " .
+        "FROM {FEATURE} F " .
+        "  INNER JOIN {Cvterm} CVT ON F.type_id = CVT.cvterm_id " .
+        "  INNER JOIN {CV} on CV.cv_id = CVT.cv_id " .
+        "WHERE ($where_cvt) AND ($where_org) AND CV.name = 'sequence' " .
         "ORDER BY feature_id";
 
   // get the list of features
@@ -422,18 +422,18 @@ function tripal_feature_sync_feature($feature_id) {
   }
 
   // get information about this feature
-  $fsql = "SELECT F.feature_id, F.name, F.uniquename,O.genus, ".
-         "    O.species,CVT.name as cvname,F.residues,F.organism_id ".
-         "FROM {FEATURE} F ".
-         "  INNER JOIN {Cvterm} CVT ON F.type_id = CVT.cvterm_id ".
-         "  INNER JOIN {Organism} O ON F.organism_id = O.organism_ID ".
+  $fsql = "SELECT F.feature_id, F.name, F.uniquename,O.genus, " .
+         "    O.species,CVT.name as cvname,F.residues,F.organism_id " .
+         "FROM {FEATURE} F " .
+         "  INNER JOIN {Cvterm} CVT ON F.type_id = CVT.cvterm_id " .
+         "  INNER JOIN {Organism} O ON F.organism_id = O.organism_ID " .
          "WHERE F.feature_id = %d";
   $feature = db_fetch_object(chado_query($fsql, $feature_id));
 
   // get the synonyms for this feature
-  $synsql = "SELECT S.name ".
-            "FROM {feature_synonym} FS ".
-            "  INNER JOIN {synonym} S on FS.synonym_id = S.synonym_id ".
+  $synsql = "SELECT S.name " .
+            "FROM {feature_synonym} FS " .
+            "  INNER JOIN {synonym} S on FS.synonym_id = S.synonym_id " .
             "WHERE FS.feature_id = %d";
   $synonyms = chado_query($synsql, $feature_id);
 
@@ -448,9 +448,9 @@ function tripal_feature_sync_feature($feature_id) {
   // but without a corresponding entry in the chado_feature table if so then we want to
   // clean up that node.  (If a node is found we don't know if it belongs to our feature or
   // not since features can have the same name/title.)
-  $tsql =  "SELECT * FROM {node} N ".
+  $tsql =  "SELECT * FROM {node} N " .
            "WHERE title = '%s'";
-  $cnsql = "SELECT * FROM {chado_feature} ".
+  $cnsql = "SELECT * FROM {chado_feature} " .
            "WHERE nid = %d";
   $nodes = db_query($tsql, $feature->name);
   // cycle through all nodes that may have this title
@@ -464,10 +464,10 @@ function tripal_feature_sync_feature($feature_id) {
 
   // check if this feature already exists in the chado_feature table.
   // if we have a chado feature, we want to check to see if we have a node
-  $cfsql = "SELECT * FROM {chado_feature} ".
+  $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} N ".
+  $nsql =  "SELECT * FROM {node} N " .
            "WHERE nid = %d";
   $chado_feature = db_fetch_object(db_query($cfsql, $feature->feature_id));
   if ($chado_feature) {

+ 1 - 1
tripal_feature/tripal_feature.drush.inc

@@ -84,7 +84,7 @@ function drush_tripal_feature_tripal_get_sequence() {
   $relationship = drush_get_option('relationship');
   $rel_part = drush_get_option('rel_part');
 
-  if($relationship and !$rel_part){
+  if ($relationship and !$rel_part) {
     print "Please specify both 'relationship' and a 'rel_part' arguments. Both must be used together\n";
     return;
   }

+ 4 - 4
tripal_feature/tripal_feature.install

@@ -72,10 +72,10 @@ function tripal_feature_add_organism_count_mview() {
     // table name
     $view_name,
     // table schema definition
-    'organism_id integer, genus character varying(255), '.
-    '  species character varying(255), '.
-    '  common_name character varying(255), '.
-    '  num_features integer, cvterm_id integer, '.
+    'organism_id integer, genus character varying(255), ' .
+    '  species character varying(255), ' .
+    '  common_name character varying(255), ' .
+    '  num_features integer, cvterm_id integer, ' .
     '  feature_type character varying(255)',
     // columns for indexing
     'organism_id,cvterm_id,feature_type',

+ 102 - 102
tripal_feature/tripal_feature.module

@@ -512,7 +512,7 @@ function chado_feature_insert($node) {
   $node_check = db_fetch_object(db_query($node_check_sql, $feature[0]->feature_id));
   if (!$node_check) {
     // next add the item to the drupal table
-    $sql = "INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date) ".
+    $sql = "INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date) " .
            "VALUES (%d, %d, %d, " . time() . ")";
       db_query($sql, $node->nid, $node->vid, $feature[0]->feature_id);
   }
@@ -593,16 +593,16 @@ function chado_feature_delete($node) {
   }
 
   // remove the drupal content
-  $sql_del = "DELETE FROM {chado_feature} ".
-             "WHERE nid = %d ".
+  $sql_del = "DELETE FROM {chado_feature} " .
+             "WHERE nid = %d " .
              "AND vid = %d";
   db_query($sql_del, $node->nid, $node->vid);
-  $sql_del = "DELETE FROM {node} ".
-             "WHERE nid = %d ".
+  $sql_del = "DELETE FROM {node} " .
+             "WHERE nid = %d " .
              "AND vid = %d";
   db_query($sql_del, $node->nid, $node->vid);
-  $sql_del = "DELETE FROM {node_revisions} ".
-             "WHERE nid = %d ".
+  $sql_del = "DELETE FROM {node_revisions} " .
+             "WHERE nid = %d " .
              "AND vid = %d";
   db_query($sql_del, $node->nid, $node->vid);
 
@@ -649,27 +649,27 @@ function chado_feature_add_synonyms($synonyms, $feature_id) {
     // check to see if we have this accession number already in the database
     // if so then don't add it again. it messes up drupal if the insert fails.
     // It is possible for the accession number to be present and not the feature
-    $synonym_sql = "SELECT synonym_id FROM {synonym} ".
+    $synonym_sql = "SELECT synonym_id FROM {synonym} " .
                    "WHERE name = '%s'";
     $synonym = db_fetch_object(chado_query($synonym_sql, $syn));
     if (!$synonym) {
-      $synonym_isql = "INSERT INTO {synonym} (name,synonym_sgml,type_id) ".
-                      "VALUES ('%s','%s', ".
-                      "   (SELECT cvterm_id ".
-                      "    FROM {CVTerm} CVT ".
-                      "    INNER JOIN CV ON CVT.cv_id = CV.cv_id ".
+      $synonym_isql = "INSERT INTO {synonym} (name,synonym_sgml,type_id) " .
+                      "VALUES ('%s','%s', " .
+                      "   (SELECT cvterm_id " .
+                      "    FROM {CVTerm} CVT " .
+                      "    INNER JOIN CV ON CVT.cv_id = CV.cv_id " .
                       "    WHERE CV.name = 'feature_property' and CVT.name = 'synonym'))";
       if (!chado_query($synonym_isql, $syn, $syn)) {
         $error .= "Could not add synonym. ";
       }
       // now get the synonym we just added
-      $synonym_sql = "SELECT synonym_id FROM {synonym} ".
+      $synonym_sql = "SELECT synonym_id FROM {synonym} " .
                      "WHERE name = '%s'";
       $synonym = db_fetch_object(chado_query($synonym_sql, $syn));
     }
 
     // now add in our new sysnonym
-    $feature_syn_isql = "INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id) ".
+    $feature_syn_isql = "INSERT INTO {feature_synonym} (synonym_id,feature_id,pub_id) " .
                         "VALUES (%d,%d,1)";
     if (!chado_query($feature_syn_isql, $synonym->synonym_id, $feature_id)) {
       $error .= "Could not add synonyms to feature. ";
@@ -690,11 +690,11 @@ function chado_feature_add_gbaccession($accession, $feature_id) {
   // use chado database
 
   // remove any old accession from genbank dbEST
-  $fdbxref_dsql = "DELETE FROM {feature_dbxref} ".
-                 "WHERE feature_id = %d and dbxref_id IN ".
-                 "   (SELECT DBX.dbxref_id FROM {dbxref} DBX ".
-                 "    INNER JOIN DB  ON DB.db_id = DBX.db_id ".
-                 "    INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id ".
+  $fdbxref_dsql = "DELETE FROM {feature_dbxref} " .
+                 "WHERE feature_id = %d and dbxref_id IN " .
+                 "   (SELECT DBX.dbxref_id FROM {dbxref} DBX " .
+                 "    INNER JOIN DB  ON DB.db_id = DBX.db_id " .
+                 "    INNER JOIN feature_dbxref FDBX ON DBX.dbxref_id = FDBX.dbxref_id " .
                  "    WHERE DB.name = 'DB:Genbank' and FDBX.feature_id = %d)";
   if (!chado_query($fdbxref_dsql, $feature_id, $feature_id)) {
     $error .= "Could not remove accession from feature. ";
@@ -705,32 +705,32 @@ function chado_feature_add_gbaccession($accession, $feature_id) {
     return;
   }
   // get the db_id
-  $db_sql = "SELECT db_id FROM {DB} ".
+  $db_sql = "SELECT db_id FROM {DB} " .
             "WHERE name = 'DB:Genbank_est'";
   $db = db_fetch_object(chado_query($db_sql));
 
   // check to see if we have this accession number already in the database
   // if so then don't add it again. it messes up drupal if the insert fails.
   // It is possible for the accession number to be present and not the feature
-  $dbxref_sql = "SELECT dbxref_id FROM {dbxref} ".
+  $dbxref_sql = "SELECT dbxref_id FROM {dbxref} " .
                 "WHERE db_id = %d and accession = '%s'";
   $dbxref = db_fetch_object(chado_query($dbxref_sql, $db->db_id, $accession));
   if (!$dbxref) {
     // add the accession number
-    $dbxref_isql = "INSERT INTO {dbxref} (db_id,accession) ".
+    $dbxref_isql = "INSERT INTO {dbxref} (db_id,accession) " .
                    "  VALUES (%d, '%s') ";
     if (!chado_query($dbxref_isql, $db->db_id, $accession)) {
       $error .= 'Could not add accession as a database reference ';
     }
     // get the dbxref_id for the just added accession number
-    $dbxref_sql = "SELECT dbxref_id FROM {dbxref} ".
+    $dbxref_sql = "SELECT dbxref_id FROM {dbxref} " .
                   "WHERE db_id = %d and accession = '%s'";
     $dbxref = db_fetch_object(chado_query($dbxref_sql, $db->db_id, $accession));
   }
 
 
   // associate the accession number with the feature
-  $feature_dbxref_isql = "INSERT INTO {feature_dbxref} (feature_id,dbxref_id) ".
+  $feature_dbxref_isql = "INSERT INTO {feature_dbxref} (feature_id,dbxref_id) " .
                          "  VALUES (%d, %d) ";
   if (!chado_query($feature_dbxref_isql, $feature_id, $dbxref->dbxref_id)) {
     $error .= 'Could not add feature database reference. ';
@@ -911,7 +911,7 @@ function chado_feature_validate($node) {
   // make sure the feature type is a real sequence ontology term
   $type = tripal_cv_get_cvterm_by_name($node->feature_type, NULL, 'sequence');
   if (!$type) {
-     form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));	
+    form_set_error('feature_type', t("The feature type is not a valid name from the Sequence Ontology."));
   }
 
   // if this is an update, we want to make sure that a different feature for
@@ -966,7 +966,7 @@ function chado_feature_load($node) {
   // keep it the same, but remove the duplicate name if the unique name and name
   // are identical
   $title_type = variable_get('chado_feature_title', 'unique_constraint');
-  if($title_type == 'unique_constraint') {
+  if ($title_type == 'unique_constraint') {
     if (strcmp($feature->name, $feature->uniquename)==0) {
       $node->title = $feature->name . " (" . $feature->type_id->name . ") " . $feature->organism_id->genus . " " . $feature->organism_id->species ;
     }
@@ -977,10 +977,10 @@ function chado_feature_load($node) {
     }
   }
   // set the title to be the feature name or uniquename as configured
-  if($title_type == 'feature_name') {
+  if ($title_type == 'feature_name') {
     $node->title = $feature->name;
   }
-  if($title_type == 'feature_unique_name') {
+  if ($title_type == 'feature_unique_name') {
     $node->title = $feature->uniquename;  
   }
 
@@ -1006,11 +1006,11 @@ function tripal_feature_load_organism($organism_id) {
  */
 function tripal_feature_load_synonyms($feature_id) {
 
-  $sql = "SELECT S.name ".
-        "FROM {Feature_Synonym} FS ".
-        "  INNER JOIN {Synonym} S ".
-        "    ON FS.synonym_id = S.Synonym_id ".
-        "WHERE FS.feature_id = %d ".
+  $sql = "SELECT S.name " .
+        "FROM {Feature_Synonym} FS " .
+        "  INNER JOIN {Synonym} S " .
+        "    ON FS.synonym_id = S.Synonym_id " .
+        "WHERE FS.feature_id = %d " .
         "ORDER BY S.name ";
   $results = chado_query($sql, $feature_id);
   $synonyms = array();
@@ -1052,13 +1052,13 @@ function tripal_feature_load_properties($feature_id) {
  */
 function tripal_feature_load_references($feature_id) {
 
-  $sql = "SELECT F.uniquename,F.Feature_id,DBX.accession,DB.description as dbdesc, ".
-        "   DB.db_id, DB.name as db_name, DB.urlprefix,DBX.dbxref_id ".
-        "FROM {feature} F ".
-        "  INNER JOIN {feature_dbxref} FDBX on F.feature_id = FDBX.feature_id ".
-        "  INNER JOIN {dbxref} DBX on DBX.dbxref_id = FDBX.dbxref_id ".
-        "  INNER JOIN {db} on DB.db_id = DBX.db_id ".
-        "WHERE F.feature_id = %d ".
+  $sql = "SELECT F.uniquename,F.Feature_id,DBX.accession,DB.description as dbdesc, " .
+        "   DB.db_id, DB.name as db_name, DB.urlprefix,DBX.dbxref_id " .
+        "FROM {feature} F " .
+        "  INNER JOIN {feature_dbxref} FDBX on F.feature_id = FDBX.feature_id " .
+        "  INNER JOIN {dbxref} DBX on DBX.dbxref_id = FDBX.dbxref_id " .
+        "  INNER JOIN {db} on DB.db_id = DBX.db_id " .
+        "WHERE F.feature_id = %d " .
         "ORDER BY DB.name ";
   $results = chado_query($sql, $feature_id);
   $references = array();
@@ -1245,7 +1245,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
     $rel_featurelocs = tripal_feature_load_featurelocs($rel->subject_id, 'as_child', 0);
     foreach ($rel_featurelocs as $rfindex => $rel_featureloc) {
       // keep track of this unique source feature
-      $src = $rel_featureloc->src_feature_id ."-". $rel_featureloc->src_cvterm_id;
+      $src = $rel_featureloc->src_feature_id . "-" . $rel_featureloc->src_cvterm_id;
 
       // copy over the results to the relationship object.  Since there can
       // be more than one feature location for each relationship feature we
@@ -1271,14 +1271,14 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
   // where this feature is found.   We want to get the sequence for each
   // location and then annotate it with the parts found from the relationships
   // locations determiend above.
-  $sql = "SELECT substring(residues from %d for %d) as residues ".
-         "FROM {feature} ".
+  $sql = "SELECT substring(residues from %d for %d) as residues " .
+         "FROM {feature} " .
          "WHERE feature_id = %d";
   $floc_sequences = array();
   foreach ($featurelocs as $featureloc) {
 
     // build the src name so we can keep track of the different parts for each feature
-    $src = $featureloc->srcfeature_id->feature_id ."-". $featureloc->srcfeature_id->type_id->cvterm_id;
+    $src = $featureloc->srcfeature_id->feature_id . "-" . $featureloc->srcfeature_id->type_id->cvterm_id;
 
     // orient the parts to the beginning of the feature sequence
     if (!empty($rel_locs[$src]['parts'])) {
@@ -1365,36 +1365,36 @@ function tripal_feature_get_matched_alignments($feature) {
   // not want to include these, so we have to filter on the SO terms:
   // match, or %_match
   //
-   $sql = "SELECT  ".
-          "   FL1.featureloc_id    as left_featureloc_id, ".
-          "   FL1.srcfeature_id    as left_srcfeature_id, ".
-          "   FL1.feature_id       as left_feature_id, ".
-          "   FL1.fmin             as left_fmin, ".
-          "   FL1.is_fmin_partial  as left_is_fmin_partial, ".
-          "   FL1.fmax             as left_fmax, ".
-          "   FL1.is_fmax_partial  as left_is_fmax_partial, ".
-          "   FL1.strand           as left_strand,  ".
-          "   FL1.phase            as left_phase, ".
-          "   FL1.locgroup         as left_locgroup, ".
-          "   FL1.rank             as left_rank, ".
-          "   FL2.featureloc_id    as right_featureloc_id, ".
-          "   FL2.srcfeature_id    as right_srcfeature_id, ".
-          "   FL2.feature_id       as right_feature_id, ".
-          "   FL2.fmin             as right_fmin, ".
-          "   FL2.is_fmin_partial  as right_is_fmin_partial, ".
-          "   FL2.fmax             as right_fmax, ".
-          "   FL2.is_fmax_partial  as right_is_fmax_partial, ".
-          "   FL2.strand           as right_strand,  ".
-          "   FL2.phase            as right_phase, ".
-          "   FL2.locgroup         as right_locgroup, ".
-          "   FL2.rank             as right_rank ".
-          "FROM {feature} F1 ".
-          "  INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id ".
-          "  INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id ".
-          "  INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id ".
-          "  INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id ".
+   $sql = "SELECT  " .
+          "   FL1.featureloc_id    as left_featureloc_id, " .
+          "   FL1.srcfeature_id    as left_srcfeature_id, " .
+          "   FL1.feature_id       as left_feature_id, " .
+          "   FL1.fmin             as left_fmin, " .
+          "   FL1.is_fmin_partial  as left_is_fmin_partial, " .
+          "   FL1.fmax             as left_fmax, " .
+          "   FL1.is_fmax_partial  as left_is_fmax_partial, " .
+          "   FL1.strand           as left_strand,  " .
+          "   FL1.phase            as left_phase, " .
+          "   FL1.locgroup         as left_locgroup, " .
+          "   FL1.rank             as left_rank, " .
+          "   FL2.featureloc_id    as right_featureloc_id, " .
+          "   FL2.srcfeature_id    as right_srcfeature_id, " .
+          "   FL2.feature_id       as right_feature_id, " .
+          "   FL2.fmin             as right_fmin, " .
+          "   FL2.is_fmin_partial  as right_is_fmin_partial, " .
+          "   FL2.fmax             as right_fmax, " .
+          "   FL2.is_fmax_partial  as right_is_fmax_partial, " .
+          "   FL2.strand           as right_strand,  " .
+          "   FL2.phase            as right_phase, " .
+          "   FL2.locgroup         as right_locgroup, " .
+          "   FL2.rank             as right_rank " .
+          "FROM {feature} F1 " .
+          "  INNER JOIN {featureloc} FL1 on FL1.srcfeature_id = F1.feature_id " .
+          "  INNER JOIN {feature} F2 on FL1.feature_id = F2.feature_id " .
+          "  INNER JOIN {featureloc} FL2 on FL2.feature_id = F2.feature_id " .
+          "  INNER JOIN {cvterm} CVT2 on F2.type_id = CVT2.cvterm_id " .
           "WHERE F1.feature_id = %d " .
-          "  AND (CVT2.name = 'match' or CVT2.name like '%_match') ".
+          "  AND (CVT2.name = 'match' or CVT2.name like '%_match') " .
           "ORDER BY FL1.fmin";
 
    $results = chado_query($sql, $feature->feature_id);
@@ -1571,28 +1571,28 @@ function tripal_feature_load_library_feature_browser($library) {
   $where_cvt = drupal_substr($where_cvt, 0, drupal_strlen($where_cvt)-3);  # strip trailing 'OR'
 
   // get the features for this library
-  $sql  = "SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname ".
-         "FROM {feature} F ".
-            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id ".
-            "  INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id ".
-            "  INNER JOIN {library} L on LF.library_id = L.library_id ".
-          "WHERE LF.library_id = %d and ($where_cvt) ".
+  $sql  = "SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname " .
+         "FROM {feature} F " .
+            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id " .
+            "  INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id " .
+            "  INNER JOIN {library} L on LF.library_id = L.library_id " .
+          "WHERE LF.library_id = %d and ($where_cvt) " .
           "ORDER BY feature_id ASC";
 
   // the counting SQL
-  $csql  = "SELECT count(*) ".
-          "FROM {feature} F".
-            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id ".
-            "  INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id ".
-            "  INNER JOIN {library} L on LF.library_id = L.library_id ".
-          "WHERE LF.library_id = %d and ($where_cvt) ".
+  $csql  = "SELECT count(*) " .
+          "FROM {feature} F" .
+            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id " .
+            "  INNER JOIN {library_feature} LF on F.feature_id = LF.feature_id " .
+            "  INNER JOIN {library} L on LF.library_id = L.library_id " .
+          "WHERE LF.library_id = %d and ($where_cvt) " .
           "GROUP BY L.library_id ";
 
   $org_features = chado_pager_query($sql, 10, 0, $csql, $library->library_id);
   $pager = theme('pager');
 
   // prepare the query that will lookup node ids
-  $sql = "SELECT nid FROM {chado_feature} ".
+  $sql = "SELECT nid FROM {chado_feature} " .
          "WHERE feature_id = %d";
   $i=0;
   $features = array();
@@ -1631,28 +1631,28 @@ function tripal_feature_load_analysis_feature_browser($analysis) {
   $where_cvt = drupal_substr($where_cvt, 0, drupal_strlen($where_cvt)-3);  # strip trailing 'OR'
 
   // get the features for this library
-  $sql  = "SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname ".
-         "FROM {feature} F ".
-            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id ".
-            "  INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id ".
-            "  INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id ".
-          "WHERE A.analysis_id = %d and ($where_cvt) ".
+  $sql  = "SELECT F.name,F.feature_id,F.uniquename,CVT.name as cvname " .
+         "FROM {feature} F " .
+            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id " .
+            "  INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id " .
+            "  INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id " .
+          "WHERE A.analysis_id = %d and ($where_cvt) " .
           "ORDER BY feature_id ASC";
 
   // the counting SQL
-  $csql  = "SELECT count(*) ".
-          "FROM {feature} F".
-            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id ".
-            "  INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id ".
-            "  INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id ".
-          "WHERE A.analysis_id = %d and ($where_cvt) ".
+  $csql  = "SELECT count(*) " .
+          "FROM {feature} F" .
+            "  INNER JOIN {cvterm} CVT on F.type_id = CVT.cvterm_id " .
+            "  INNER JOIN {analysisfeature} AF on F.feature_id = AF.feature_id " .
+            "  INNER JOIN {analysis} A on AF.analysis_id = A.analysis_id " .
+          "WHERE A.analysis_id = %d and ($where_cvt) " .
           "GROUP BY A.analysis_id ";
 
   $org_features = chado_pager_query($sql, 10, 0, $csql, $analysis->analysis_id);
   $pager = theme('pager');
 
   // prepare the query that will lookup node ids
-  $sql = "SELECT nid FROM {chado_feature} ".
+  $sql = "SELECT nid FROM {chado_feature} " .
          "WHERE feature_id = %d";
   $i=0;
   $features = array();
@@ -1843,7 +1843,7 @@ function tripal_feature_nodeapi(&$node, $op, $teaser, $page) {
         case 'chado_feature':
           
           $values = array('organism_id' => $node->organism_id);
-          $organism = tripal_core_chado_select('organism', array('genus','species'), $values);
+          $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
           $node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
           break;
       }
@@ -2345,7 +2345,7 @@ function tripal_feature_match_features_page($id) {
     $synonyms = preg_replace('/[\"\{\}]/', '', $synonyms);
     $rows[] = array(
        $match->uniquename,
-       "<a href=\"" . url("node/". $match->nid) ."\">" . $match->name . "</a>",
+       "<a href=\"" . url("node/" . $match->nid) . "\">" . $match->name . "</a>",
        $match->type_name,
        '<i>' . $match->genus . ' ' . $match->species . '</i>',
        $synonyms,

+ 5 - 5
tripal_organism/api/tripal_organism.api.inc

@@ -54,14 +54,14 @@ function tripal_organism_get_synced() {
   $orgs = db_query($dsql);
 
   // use this SQL statement for getting the organisms
-  $csql =  "SELECT * FROM {Organism} ".
+  $csql =  "SELECT * FROM {Organism} " .
            "WHERE organism_id = :organism_id";
 
   $org_list = array();
 
   // iterate through the organisms and build an array of those that are synced
   foreach ($orgs as $org) {
-  	$args = array(':organism_id' => $org->organism_id);
+    $args = array(':organism_id' => $org->organism_id);
     $org = chado_query($csql, $args)->fetchObject();
     $org_list[] = $org;
   }
@@ -74,9 +74,9 @@ function tripal_organism_get_synced() {
  * @param $nid
  */
 function tripal_organism_get_image_url($organism, $nid = NULL) {
-	$url = '';
-	
-	// first look for an image with the genus/species name.  This is old-style tripal
+  $url = '';
+  
+  // first look for an image with the genus/species name.  This is old-style tripal
   // and we keep it for backwards compatibility.  If we don't find that file
   // then look for the image with the node ID in the name. If we don't find that then
   // no image tag is generated  

+ 14 - 12
tripal_organism/includes/tripal_organism.admin.inc

@@ -48,10 +48,10 @@ function get_tripal_organism_admin_form_cleanup_set(&$form) {
   );
   $form['cleanup']['description'] = array(
     '#type' => 'item',
-    '#value' => t("With Drupal and chado residing in different databases ".
-    "it is possible that nodes in Drupal and organisms in Chado become ".
-    "\"orphaned\".  This can occur if an organism node in Drupal is ".
-    "deleted but the corresponding chado organism is not and/or vice ".
+    '#value' => t("With Drupal and chado residing in different databases " .
+    "it is possible that nodes in Drupal and organisms in Chado become " .
+    "\"orphaned\".  This can occur if an organism node in Drupal is " .
+    "deleted but the corresponding chado organism is not and/or vice " .
     "versa. Click the button below to resolve these discrepancies."),
     '#weight' => 1,
   );
@@ -84,9 +84,11 @@ function get_tripal_organism_admin_form_taxonomy_set(&$form) {
 
   $form['taxonify']['description'] = array(
     '#type' => 'item',
-    '#value' => t("Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
-                 "nodes. These terms allow for advanced filtering during searching. This option allows ".
-                 "for setting taxonomy only for features that belong to the selected organisms below.  All other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
+    '#value' => t(
+      "Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
+      "nodes. These terms allow for advanced filtering during searching. This option allows " .
+      "for setting taxonomy only for features that belong to the selected organisms below.  All " . 
+      "other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
     '#weight' => 1,
   );
 
@@ -274,7 +276,7 @@ function tripal_organism_admin_validate($form, &$form_state) {
         $sql = "SELECT * FROM {organism} WHERE organism_id = :organism_id";
         $organism = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
         $job_args[0] = $organism_id;
-        tripal_add_job("Reindex features for organism: $organism->genus ".
+        tripal_add_job("Reindex features for organism: $organism->genus " .
          "$organism->species", 'tripal_organism' ,
          'tripal_organism_reindex_features', $job_args, $user->uid);
       }
@@ -291,7 +293,7 @@ function tripal_organism_admin_validate($form, &$form_state) {
         $sql = "SELECT * FROM {organism} WHERE organism_id = :organism_id";
         $organism = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
         $job_args[0] = $organism_id;
-        tripal_add_job("Set taxonomy for features in organism: ".
+        tripal_add_job("Set taxonomy for features in organism: " .
           "$organism->genus $organism->species" , 'tripal_organism',
           'tripal_organism_taxonify_features', $job_args, $user->uid);
       }
@@ -326,7 +328,7 @@ function tripal_organism_sync_organisms($organism_id = NULL, $job_id = NULL) {
 
   // We'll use the following SQL statement for checking if the organism
   // already exists as a drupal node.
-  $sql = "SELECT * FROM {chado_organism} ".
+  $sql = "SELECT * FROM {chado_organism} " .
          "WHERE organism_id = :organism_id";
 
   foreach ($results as $organism) {
@@ -429,8 +431,8 @@ function tripal_organism_taxonify_features($organism_id = NULL, $job_id = NULL)
   tripal_feature_set_vocabulary();
 
   // use this SQL for getting the nodes
-  $nsql =  "SELECT * FROM {chado_feature} CF ".
-          "  INNER JOIN {node} N ON N.nid = CF.nid ".
+  $nsql = "SELECT * FROM {chado_feature} CF " .
+          "  INNER JOIN {node} N ON N.nid = CF.nid " .
           "WHERE feature_id = :feature_id";
 
   // iterate through the features and set the taxonomy

+ 17 - 17
tripal_organism/tripal_organism.module

@@ -210,19 +210,19 @@ function tripal_organism_permission() {
       'title' => t('View Organisms'),
       'description' => t('Allow users to view organism pages.'),
     ),
-    'create chado_organism content'=> array(
+    'create chado_organism content' => array(
       'title' => t('Create Organisms'),
       'description' => t('Allow users to create new organism pages.'),
     ),
-    'delete chado_organism content'=> array(
+    'delete chado_organism content' => array(
       'title' => t('Delete Organisms'),
       'description' => t('Allow users to delete organism pages.'),
     ),
-    'edit chado_organism content'=> array(
+    'edit chado_organism content' => array(
       'title' => t('Edit Organisms'),
       'description' => t('Allow users to edit organism pages.'),
     ),
-    'adminster tripal organism'=> array(
+    'adminster tripal organism' => array(
       'title' => t('Administer Organisms'),
       'description' => t('Allow users to administer all organisms.'),
     ),
@@ -316,7 +316,7 @@ function chado_organism_insert($node) {
 
   if (!chado_get_id_for_node('organism', $node->nid) ) {
     // next add the item to the drupal table
-    $sql = "INSERT INTO {chado_organism} (nid, vid, organism_id) ".
+    $sql = "INSERT INTO {chado_organism} (nid, vid, organism_id) " .
            "VALUES (:nid, :vid, :organism_id)";
     $args = array(':nid' => $node->nid, ':vid' => $node->vid, ':organism_id' => $organism_id);
     db_query($sql, $args);
@@ -380,16 +380,16 @@ function chado_organism_delete($node) {
   }
 
   // Remove data from the {chado_organism}, {node}, and {node_revisions} tables
-  $sql_del = "DELETE FROM {chado_organism} ".
-             "WHERE nid = :nid ".
+  $sql_del = "DELETE FROM {chado_organism} " .
+             "WHERE nid = :nid " .
              "AND vid = :vid";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
-  $sql_del = "DELETE FROM {node} ".
-             "WHERE nid = :nid ".
+  $sql_del = "DELETE FROM {node} " .
+             "WHERE nid = :nid " .
              "AND vid = :vid";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
-  $sql_del = "DELETE FROM {node_revisions} ".
-             "WHERE nid = ':nid' ".
+  $sql_del = "DELETE FROM {node_revisions} " .
+             "WHERE nid = ':nid' " .
              "AND vid = ':vid'";
   db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
 
@@ -405,8 +405,8 @@ function chado_organism_delete($node) {
     tripal_core_chado_delete('organism', array('organism_id' => $organism_id));
   }
   else {
-    drupal_set_message(t("Organism deleted from drupal. Warning: at least one ".
-                       "library or feature depends on this organism. It was ".
+    drupal_set_message(t("Organism deleted from drupal. Warning: at least one " .
+                       "library or feature depends on this organism. It was " .
                "not removed from chado."));
   }
 }
@@ -421,7 +421,7 @@ function chado_organism_add_image($node) {
   if (isset($_FILES['files']) && 
       $_FILES['files']['name']['organism_image'] &&
       is_uploaded_file($_FILES['files']['tmp_name']['organism_image'])) {
-      	
+        
     // make sure the destination directory exists
     $dest = tripal_file_directory_path() . "/tripal_organism/images";    
     file_prepare_directory($dest, FILE_CREATE_DIRECTORY);
@@ -434,7 +434,7 @@ function chado_organism_add_image($node) {
       drupal_set_message(t("Organism image was not uploaded."));
     }
     else {
-    	file_move($file, $destination . "/" . $node->nid . ".jpg", FILE_EXISTS_REPLACE);
+      file_move($file, $destination . "/" . $node->nid . ".jpg", FILE_EXISTS_REPLACE);
     }
   }
 }
@@ -519,7 +519,7 @@ function chado_organism_form($node, $param) {
 function chado_organism_load($nodes) {
 
   foreach ($nodes as $nid => $node) {
-  	// find the organism and add in the details
+    // find the organism and add in the details
     $organism_id = chado_get_id_for_node('organism', $nid);
 
     // build the organism variable
@@ -555,7 +555,7 @@ function tripal_organism_job_describe_args($callback, $args) {
   $new_args = array();
   if ($callback == 'tripal_organism_sync_organisms') {
     $organism = tripal_core_chado_select('organism', array('genus', 'species'), array('organism_id' => $args[0]));
-    $new_args['Organism'] = $organism[0]->genus ." ". $organism[0]->species;
+    $new_args['Organism'] = $organism[0]->genus . " " . $organism[0]->species;
   }
   return $new_args;
 }