Browse Source

Fix to the sio__annotation field

Stephen Ficklin 7 years ago
parent
commit
4fa5637902

+ 4 - 1
tripal_chado/includes/TripalFields/sio__annotation/sio__annotation.inc

@@ -261,6 +261,8 @@ class sio__annotation extends ChadoField {
     $vocabulary = tripal_get_chado_semweb_term('cvterm', 'cv_id');
     $accession = tripal_get_chado_semweb_term('dbxref', 'accession');
     $definition = tripal_get_chado_semweb_term('cvterm', 'definition');
+    $name = tripal_get_chado_semweb_term('cvterm', 'name');
+
     if (array_key_exists('is_not', $schema['fields'])) {
       $negation = tripal_get_chado_semweb_term($field_table, 'is_not');
     }
@@ -307,6 +309,7 @@ class sio__annotation extends ChadoField {
         'value' => array(
           $vocabulary => $cvterm->dbxref_id->db_id->name,
           $accession => $cvterm->dbxref_id->accession,
+          $name => $cvterm->name,
           $definition => isset($cvterm->definition) ? $cvterm->definition : ''
         ),
         'chado-' . $field_table . '__' . $pkey => $linker->$pkey,
@@ -370,4 +373,4 @@ function chado_linker__cvterm_widget_form_ajax_callback($form, $form_state) {
 
 
   return $form[$field_name]['und'][$delta];
-}
+}

+ 4 - 2
tripal_chado/includes/TripalFields/sio__annotation/sio__annotation_formatter.inc

@@ -12,7 +12,7 @@ class sio__annotation_formatter extends ChadoFieldFormatter {
    * @see TripalFieldFormatter::view()
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
-    $headers = array('Term', 'Definition');
+    $headers = array('Term', 'Name', 'Definition');
     $rows = array();
 
     $field_table = $this->instance['settings']['chado_table'];
@@ -21,6 +21,7 @@ class sio__annotation_formatter extends ChadoFieldFormatter {
     $vocabulary_term = tripal_get_chado_semweb_term('cvterm', 'cv_id');
     $accession_term = tripal_get_chado_semweb_term('dbxref', 'accession');
     $definition_term = tripal_get_chado_semweb_term('cvterm', 'definition');
+    $name_term = tripal_get_chado_semweb_term('cvterm', 'name');
     if (array_key_exists('is_not', $schema['fields'])) {
       $negation_term = tripal_get_chado_semweb_term($field_table, 'is_not');
     }
@@ -40,6 +41,7 @@ class sio__annotation_formatter extends ChadoFieldFormatter {
 
         $row = array(
           $accession,
+          $item['value'][$name_term],
           $item['value'][$definition_term],
         );
 
@@ -54,7 +56,7 @@ class sio__annotation_formatter extends ChadoFieldFormatter {
     }
 
     // Theme the results in a talbe.
-    $caption = 'This record is associated with the following annotations.';
+    $caption = 'This record has the following annotations.';
     $table = array(
       'header' => $headers,
       'rows' => $rows,