Browse Source

Fixed bug loading dbxref in FASTA loader

ficklin 12 years ago
parent
commit
3cff7d8920
1 changed files with 5 additions and 4 deletions
  1. 5 4
      tripal_feature/includes/fasta_loader.inc

+ 5 - 4
tripal_feature/includes/fasta_loader.inc

@@ -792,7 +792,7 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     }
   }
 
-   // now add the database cross reference
+  // now add the database cross reference
   if ($db_id) {
     // check to see if this accession reference exists, if not add it
     $values = array(
@@ -801,10 +801,11 @@ function tripal_feature_fasta_loader_handle_feature($name, $uname, $db_id, $acce
     );
     $sel_options = array('statement_name' => 'sel_dbxref_dbac');
     $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $values, $sel_options);
+    // if the accession doesn't exist then add it
     if (count($results) == 0) {   
-      $ins_options = array('statement_name' => 'sel_dbxref_dbac');
-      $success = tripal_core_chado_insert('dbxref', $values, $ins_options);
-      if (!$success) {
+      $ins_options = array('statement_name' => 'ins_dbxref_dbac');
+      $results = tripal_core_chado_insert('dbxref', $values, $ins_options);
+      if (!$results) {
         watchdog('T_fasta_loader', "Failed to add database accession '%accession'", 
           array('%accession' => $accession), WATCHDOG_ERROR);
         return 0;