Kaynağa Gözat

Fixed bug in OBO loader where synonmys weren't being added. Fixed calls to older API calls, and minor text changes

Stephen Ficklin 10 yıl önce
ebeveyn
işleme
3b63f9bf10

+ 4 - 4
tripal_core/api/tripal_core.chado_query.api.inc

@@ -1044,8 +1044,7 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
   $where = array();
   $args = array();
 
-  // if the 'use_unique' option is turned on then we want
-  // to remove all but unique keys
+  // if the 'is_duplicate' option is turned on then we want to remove all but unique keys
   if ($options['is_duplicate'] and array_key_exists('unique keys', $table_desc)) {
     $ukeys = $table_desc['unique keys'];
     $has_results = 0;
@@ -1105,8 +1104,9 @@ function chado_select_record($table, $columns, $values, $options = NULL) {
         // is a duplicate so return FALSE
         else {
           tripal_report_error('tripal_core', TRIPAL_ERROR,
-            'chado_select_record: There is no value for %field thus we cannot check if this record is unique',
-            array('%field' => $field), array('print' => $print_errors));
+            'chado_select_record: There is no value for %field thus we cannot ' .
+            ' check if this record for table, %table, is unique.',
+            array('%field' => $field, '%table' => $table), array('print' => $print_errors));
           return FALSE;
         }
       }

+ 15 - 39
tripal_cv/includes/tripal_cv.obo_loader.inc

@@ -801,13 +801,9 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
     'subject_id' => $cvterm->cvterm_id,
     'object_id'  => $objcvterm->cvterm_id
   );
-  $options = array('statement_name' => 'sel_cvtermrelationship_tysuob');
-  $result = chado_select_record('cvterm_relationship', array('*'), $values, $options);
+  $result = chado_select_record('cvterm_relationship', array('*'), $values);
   if (count($result) == 0) {
-    $options = array(
-      'statement_name' => 'ins_cvtermrelationship_tysuob',
-      'return_record' => FALSE
-    );
+    $options = array('return_record' => FALSE);
     $success = chado_insert_record('cvterm_relationship', $values, $options);
     if (!$success) {
       tripal_cv_obo_quiterror("Cannot add term relationship: '$cvterm->name' $rel '$objcvterm->name'");
@@ -827,8 +823,7 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
  */
 function tripal_cv_obo_get_term($id) {
   $values = array('id' => $id);
-  $options = array('statement_name' => 'sel_tripalobotemp_id');
-  $result = chado_select_record('tripal_obo_temp', array('stanza'), $values, $options);
+  $result = chado_select_record('tripal_obo_temp', array('stanza'), $values);
   if (count($result) == 0) {
     return FALSE;
   }
@@ -869,7 +864,7 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
           'name' => 'synonym_type',
         ),
       );
-      $options = array('statement_name' => 'sel_cvterm_nacv', 'is_updlicate' => 1);
+      $options = array('is_duplicate' => 1);
       $results = chado_select_record('cvterm', array('*'), $values, $options);
 
       // if it doesn't exist then add it
@@ -897,18 +892,14 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
         'cvterm_id' => $cvterm->cvterm_id,
         'synonym' => $def
       );
-      $options = array('statement_name' => 'sel_cvtermsynonym_cvsy');
-      $results = chado_select_record('cvtermsynonym', array('*'), $values, $options);
+      $results = chado_select_record('cvtermsynonym', array('*'), $values);
       if (count($results) == 0) {
         $values = array(
           'cvterm_id' => $cvterm->cvterm_id,
           'synonym' => $def,
           'type_id' => $syntype->cvterm_id
         );
-        $options = array(
-          'statement_name' => 'ins_cvtermsynonym_cvsy',
-          'return_record' => FALSE
-        );
+        $options = array('return_record' => FALSE);
         $success = chado_insert_record('cvtermsynonym', $values, $options);
         if (!$success) {
           tripal_cv_obo_quiterror("Failed to insert the synonym for term: $name ($def)");
@@ -1006,8 +997,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
           'stanza' => base64_encode(serialize($stanza)),
           'type' => $type,
         );
-        $options = array('statement_name' => 'ins_tripalobotemp_all');
-        $success = chado_insert_record('tripal_obo_temp', $values, $options);
+        $success = chado_insert_record('tripal_obo_temp', $values);
         if (!$success) {
           tripal_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
           exit;
@@ -1055,8 +1045,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
       'stanza' => base64_encode(serialize($stanza)),
       'type' => $type,
     );
-    $options = array('statement_name' => 'ins_tripalobotemp_all');
-    chado_insert_record('tripal_obo_temp', $values, $options);
+    chado_insert_record('tripal_obo_temp', $values);
     if (!$success) {
       tripal_report_error('T_obo_loader', "ERROR: Cannot insert stanza into temporary table.", array(), 'error');
       exit;
@@ -1114,13 +1103,9 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
     'cvterm_id' => $cvterm->cvterm_id,
     'dbxref_id' => $dbxref->dbxref_id,
   );
-  $options = array('statement_name' => 'sel_cvtermdbxref_cvdb');
-  $result = chado_select_record('cvterm_dbxref', array('*'), $values, $options);
+  $result = chado_select_record('cvterm_dbxref', array('*'), $values);
   if (count($result) == 0) {
-    $ins_options = array(
-      'statement_name' => 'ins_cvtermdbxref_cvdb',
-      'return_record' => FALSE
-    );
+    $ins_options = array('return_record' => FALSE);
     $result = chado_insert_record('cvterm_dbxref', $values, $ins_options);
     if (!$result) {
       tripal_cv_obo_quiterror("Cannot add cvterm_dbxref: $xref");
@@ -1158,8 +1143,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
     'name' => $property,
     'cv_id' => $cv->cv_id,
   );
-  $options = array('statement_name' => 'sel_cvterm_nacv_na');
-  $results = chado_select_record('cvterm', array('*'), $values, $options);
+  $results = chado_select_record('cvterm', array('*'), $values);
   if (count($results) == 0) {
     $term = array(
       'name' => $property,
@@ -1182,8 +1166,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
   // remove any properties that currently exist for this term.  We'll reset them
   if ($rank == 0) {
     $values = array('cvterm_id' => $cvterm->cvterm_id);
-    $options = array('statement_name' => 'del_cvtermprop_cv');
-    $success = chado_delete_record('cvtermprop', $values, $options);
+    $success = chado_delete_record('cvtermprop', $values);
     if (!$success) {
        tripal_cv_obo_quiterror("Could not remove existing properties to update property $property for term\n");
        return FALSE;
@@ -1197,10 +1180,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
     'value' => $value,
     'rank' => $rank,
   );
-  $options = array(
-    'statement_name' => 'ins_cvtermprop_cvtyvara',
-    'return_record' => FALSE,
-  );
+  $options = array('return_record' => FALSE);
   $result = chado_insert_record('cvtermprop', $values, $options);
   if (!$result) {
     tripal_cv_obo_quiterror("Could not add property $property for term\n");
@@ -1230,8 +1210,7 @@ function tripal_cv_obo_add_dbxref($db_id, $accession, $version='', $description=
     'db_id' => $db_id,
     'accession' => $accession,
   );
-  $options = array('statement_name' => 'sel_dbxref_idac');
-  $result = chado_select_record('dbxref', array('dbxref_id'), $values, $options);
+  $result = chado_select_record('dbxref', array('dbxref_id'), $values);
   if (count($result) == 0) {
     $ins_values = array(
       'db_id'       => $db_id,
@@ -1239,10 +1218,7 @@ function tripal_cv_obo_add_dbxref($db_id, $accession, $version='', $description=
       'version'     => $version,
       'description' => $description,
     );
-    $ins_options = array(
-      'statement_name' => 'ins_dbxref_idacvede',
-      'return_record' => FALSE
-    );
+    $ins_options = array('return_record' => FALSE);
     $result = chado_insert_record('dbxref', $ins_values, $ins_options);
     if (!$result) {
       tripal_cv_obo_quiterror("Failed to insert the dbxref record $accession");

+ 3 - 2
tripal_feature/includes/tripal_feature.gff_loader.inc

@@ -87,8 +87,9 @@ function tripal_feature_gff3_load_form() {
     '#title'       => t('ID Attribute'),
     '#type'        => t('textfield'),
     '#description' => t("Optional. Sometimes lines in the GFF file are missing the
-      required ID attribute that specifies the unique name of the feature.  If so,
-      you may specify an the name of an existing  attribute to use for the name."),
+      required ID attribute that specifies the unique name of the feature, but there
+      may be another attribute that can uniquely identify the feature.  If so,
+      you may specify the name of the attribute to use for the name."),
   );
 
   $form['import_options'] = array(

+ 1 - 1
tripal_library/theme/templates/tripal_library_base.tpl.php

@@ -3,7 +3,7 @@
 $library  = $variables['node']->library;
 
 // get the library description. IT uses a tern name of 'Library Description'
-$libprop = tripal_library_get_property($library->library_id, 'Library Description');
+$libprop = chado_get_property('library', $library->library_id, 'Library Description', 'library_property');
 $description = $libprop->value; ?>
 
 <div class="tripal_library-data-block-desc tripal-data-block-desc"></div> <?php 

+ 1 - 1
tripal_library/theme/templates/tripal_library_teaser.tpl.php

@@ -3,7 +3,7 @@ $node    = $variables['node'];
 $library = $variables['node']->library;
 
 // get the library description. IT uses a tern name of 'Library Description'
-$libprop = tripal_library_get_property($library->library_id, 'Library Description');
+$libprop = chado_get_property('library', $library->library_id, 'Library Description', 'library_property');
 $description = $libprop->value; ?>
 
 <div class="tripal_library-teaser tripal-teaser"> 

+ 1 - 1
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -343,7 +343,7 @@ function chado_organism_insert($node) {
   }
 
   // add the image
-  if (property_exists($node, organism_image)) {
+  if (property_exists($node, 'organism_image')) {
     chado_organism_add_image($node);
   }
 }

+ 1 - 1
tripal_project/theme/templates/tripal_project_base.tpl.php

@@ -18,7 +18,7 @@ if ($project->description) {
   $description = $project->description;
 }
 else {
-  $projectprop = tripal_project_get_property($project->project_id, 'Project Description');
+  $projectprop = chado_get_property('project', $project->project_id, 'Project Description', 'project_property');
   $description = $projectprop->value;
 } ?>
 

+ 1 - 1
tripal_project/theme/templates/tripal_project_teaser.tpl.php

@@ -19,7 +19,7 @@ if (property_exists($node, 'description')) {
   $description = $project->description;
 }
 else {
-  $projectprop = tripal_project_get_property($project->project_id, 'Project Description');
+  $projectprop = chado_get_property('property', $project->project_id, 'Project Description', 'project_property');
   $description = $projectprop->value;
 } ?>