Browse Source

protein sequence field is now working. Fixed relationship field to link to entities. Renamed a few new API functions

Stephen Ficklin 7 years ago
parent
commit
8843ccf83d

+ 1 - 1
legacy/tripal_analysis/includes/tripal_analysis.delete.inc

@@ -84,7 +84,7 @@ function tripal_analysis_delete_analyses($analyses, $job = NULL) {
   global $user;
 
   // Deleting of analyses will cause a cascade delete on the
-  // fassociated tables which may include the fatureloc table. The create_point
+  // fassociated tables which may include the featureloc table. The create_point
   // function which is not prefix with the schema, and an error occurs.
   // Therefore, we set the active database to chado to get around that
   // problem.

+ 1 - 1
legacy/tripal_organism/includes/tripal_organism.delete.inc

@@ -83,7 +83,7 @@ function tripal_organism_delete_organisms($organisms, $job = NULL) {
   global $user;
 
   // Deleting of organisms will cause a cascade delete on the
-  // fassociated tables which may include the fatureloc table. The create_point
+  // fassociated tables which may include the featureloc table. The create_point
   // function which is not prefix with the schema, and an error occurs.
   // Therefore, we set the active database to chado to get around that
   // problem.

+ 4 - 4
tripal_chado/api/modules/tripal_chado.feature.api.inc

@@ -1135,11 +1135,11 @@ function chado_get_feature_relationships($feature_id, $side = 'as_subject') {
   $relationships = array();
   while ($rel = $results->fetchObject()) {
 
-    $entity = tripal_chado_get_record_entity($bundle, $rel->subject_id);
+    $entity = chado_get_record_entity_by_bundle($bundle, $rel->subject_id);
     if ($entity) {
       $rel->subject_entity_id = $entity->entity_id;
     }
-    $entity = tripal_chado_get_record_entity($bundle, $rel->object_id);
+    $entity = chado_get_record_entity_by_bundle($bundle, $rel->object_id);
     if ($entity) {
       $rel->object_entity_id = $entity->entity_id;
     }
@@ -1206,8 +1206,8 @@ function chado_get_featurelocs($feature_id, $side = 'as_parent', $aggregate = 1)
     $fbundle = tripal_load_bundle_entity(array('term_id' => $fterm->id));
     $sbundle = tripal_load_bundle_entity(array('term_id' => $sterm->id));
 
-    $loc->feid = tripal_chado_get_record_entity($fbundle, $loc->feature_id);
-    $loc->seid = tripal_chado_get_record_entity($sbundle, $loc->src_feature_id);
+    $loc->feid = chado_get_record_entity_by_bundle($fbundle, $loc->feature_id);
+    $loc->seid = chado_get_record_entity_by_bundle($sbundle, $loc->src_feature_id);
 
     // add the result to the array
     $featurelocs[$i++] = $loc;

+ 1 - 1
tripal_chado/api/tripal_chado.api.inc

@@ -40,7 +40,7 @@ function tripal_chado_publish_records($values, $job_id = NULL) {
         array('@error' => 'The bundle name must be provided'));
     return FALSE;
   }
-  $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+  $chado_entity_table = chado_get_bundle_entity_table($bundle);
 
 
   // Get the mapping of the bio data type to the Chado table.

+ 65 - 8
tripal_chado/api/tripal_chado.entity.api.inc

@@ -1,6 +1,6 @@
 <?php
 /**
- * A helper function to retreive the entity_id of a given record_id.
+ * Retreive the entity_id assigned to a given record_id and bundle.
  *
  * @param $bundle
  *   A bundle object (as retreieved from tripal_load_bundle_entity().
@@ -9,19 +9,76 @@
  *   the table to which the bundle is associated in chado.
  *
  * @return
- *   A database result object.
+ *   The ID of the entity that belongs to the given record_id.
  */
-function tripal_chado_get_record_entity($bundle, $record_id) {
-  if (!$bundle or !$record_id) {
-    return NULL;
+function chado_get_record_entity_by_bundle(TripalBundle $bundle, $record_id) {
+  if (!$bundle) {
+    throw new Exception('Please provide a TripalBundle object.');
+  };
+  if (!$record_id) {
+    throw new Exception('Please provide an integer record ID.');
+  };
+  if (!is_numeric($record_id)) {
+    throw new Exception('Please provide an integer record ID. The value provided was "' . $record_id . '"');
   }
-  $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+
+  $chado_entity_table = chado_get_bundle_entity_table($bundle);
   return db_select($chado_entity_table, 'CE')
+    ->fields('CE', array('entity_id'))
     ->condition('CE.record_id', $record_id)
     ->execute()
-    ->fetchObject();
+    ->fetchField();
+}
+
+
+/**
+ * Retreive the entity_id assigned to a given record_id and base table.
+ *
+ * @param $data_table
+ *   The name of the Chado base table.
+ * @param $record_id
+ *   The ID of the record in the Chado table. The record must belong to
+ *   the table to which the bundle is associated in chado.
+ *
+ * @return
+ *   The ID of the entity that belongs to the given record_id, or NULL
+ *   otherwise.
+ */
+
+function chado_get_record_entity_by_table($data_table, $record_id) {
+
+  // The data table and type_id are required.
+  if (!$data_table) {
+    throw new Exception('Please provide the $data_table argument.');
+  };
+  if (!$record_id) {
+    throw new Exception('Please provide an integer record ID.');
+  };
+  if (!is_numeric($record_id)) {
+    throw new Exception('Please provide an integer record ID. The value provided was "' . $record_id . '"');
+  }
+
+  // Get the list of bundles for this table.
+  $bundles = db_select('chado_bundle', 'CB')
+    ->fields('CB', array('bundle_id'))
+    ->condition('CB.data_table', $data_table)
+    ->execute();
+
+  // Look for the record ID in the appropriate chado table.
+  while ($bundle_id = $bundles->fetchField()) {
+    $entity_id = db_select('chado_bio_data_' . $bundle_id , 'CBD')
+      ->fields('CBD', array('entity_id'))
+      ->condition('record_id', $record_id)
+      ->execute()
+      ->fetchField();
+    if ($entity_id) {
+      return $entity_id;
+    }
+  }
+  return NULL;
 }
 
+
 /**
  * A helper function that provides the Chado mapping table for the bundle.
  *
@@ -37,7 +94,7 @@ function tripal_chado_get_record_entity($bundle, $record_id) {
  * @return
  *   The name of the mapping table that Chado uses to map entities to records.
  */
-function tripal_chado_get_bundle_entity_table($bundle) {
+function chado_get_bundle_entity_table($bundle) {
   if (!$bundle) {
     return '';
   }

+ 1 - 1
tripal_chado/api/tripal_chado.variables.api.inc

@@ -318,7 +318,7 @@ function chado_generate_var($table, $values, $base_options = array()) {
       $bundles->condition('cb.data_table', $table);
       $bundles->execute();
       foreach ($bundles as $bundle) {
-        $cbundle_table = tripal_chado_get_bundle_entity_table($bundle);
+        $cbundle_table = chado_get_bundle_entity_table($bundle);
         $record = $db_select($cbundle_table, 'ce')
           ->fields('ce', 'entity_id')
           ->condition('record_id', $object->{$table_primary_key})

+ 3 - 3
tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence.inc

@@ -52,7 +52,7 @@ class data__protein_sequence extends ChadoField {
     $feature = $entity->chado_record;
     $num_seqs = 0;
 
-    // Look for Protein sequences
+    // Look for protein sequences based on the relationship of this field.
     $sql = "
       SELECT F.*
       FROM {feature_relationship} FR
@@ -65,8 +65,8 @@ class data__protein_sequence extends ChadoField {
         RCVT.name = 'derives_from'
       ORDER BY FR.rank ASC
     ";
-    $results = chado_query($sql, array(':feature_id' => $feature->feature_id));
-    while ($protein = $results->fetchObject()) {
+    $proteins = chado_query($sql, array(':feature_id' => $feature->feature_id));
+    while ($protein = $proteins->fetchObject()) {
       if ($protein->residues) {
         $entity->{$field_name}['und'][$num_seqs++]['value'] = $protein->residues;
       }

+ 8 - 22
tripal_chado/includes/TripalFields/data__protein_sequence/data__protein_sequence_formatter.inc

@@ -18,31 +18,17 @@ class data__protein_sequence_formatter extends ChadoFieldFormatter {
    * @param unknown $display
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
+    $content = 'There is no sequence.';
+    if ($items[0]['value']) {
+      $num_bases = 50;
+      $content = '<pre class="protein-residues-formatter">';
+      $content .= wordwrap($items[0]['value'], $num_bases, "<br>", TRUE);
+      $content .= '</pre>';
+    }
     $element[0] = array(
       // We create a render array to produce the desired markup,
       '#type' => 'markup',
-      '#markup' => '',
+      '#markup' => $content,
     );
-
-    $num_bases = 50;
-    foreach ($items as $delta => $item) {
-      // If there are no residues then skip this one.
-      if (!is_array($item['value']) or !array_key_exists('residues', $item['value'])) {
-        continue;
-      }
-
-      $residues = $item['value']['residues'];
-
-      $content .= '<pre class="residues-formatter">';
-      $content .= '>' . $defline . "<br>";
-      $content .= wordwrap($residues, $num_bases, "<br>", TRUE);
-      $content .= '</pre>';
-
-      $element[$delta] = array(
-        // We create a render array to produce the desired markup,
-        '#type' => 'markup',
-        '#markup' => $content,
-      );
-    }
   }
 }

+ 6 - 6
tripal_chado/includes/TripalFields/data__sequence/data__sequence.inc

@@ -53,15 +53,15 @@ class data__sequence extends ChadoField {
     // We don't want to get the sequence for traditionally large types. They are
     // too big,  bog down the web browser, take longer to load and it's not
     // reasonable to print them on a page.
-    if(strcmp($feature->type_id->name,'scaffold') != 0 and
-       strcmp($feature->type_id->name,'chromosome') != 0 and
-       strcmp($feature->type_id->name,'supercontig') != 0 and
-       strcmp($feature->type_id->name,'pseudomolecule') != 0) {
-      $feature = chado_expand_var($feature,'field','feature.residues');
+    if(strcmp($feature->type_id->name, 'scaffold') != 0 and
+       strcmp($feature->type_id->name, 'chromosome') != 0 and
+       strcmp($feature->type_id->name, 'supercontig') != 0 and
+       strcmp($feature->type_id->name, 'pseudomolecule') != 0) {
+      $feature = chado_expand_var($feature, 'field', 'feature.residues');
       $entity->{$field_name}['und'][0]['value'] = $feature->residues;
     }
 
- /*    // Add in sequences from alignments.
+ /* // Add in sequences from alignments.
     $options = array(
       'return_array' => 1,
       'include_fk' => array(

+ 20 - 1
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship.inc

@@ -79,6 +79,7 @@ class sbo__relationship extends ChadoField {
     $settings = $this->field['settings'];
 
     $record = $entity->chado_record;
+    $bundle = tripal_load_bundle_entity(array('name' => $entity->bundle));
 
     $field_name = $this->field['field_name'];
     $field_type = $this->field['type'];
@@ -205,6 +206,7 @@ class sbo__relationship extends ChadoField {
         $rel_acc = $relationship->type_id->dbxref_id->db_id->name . ':' . $relationship->type_id->dbxref_id->accession;
         $rel_type = $relationship->type_id->name;
         $verb = $this->get_rel_verb($rel_type);
+        $subject_id = $relationship->$subject_id_key->$subject_pkey;
 
         // The linked to table of a relationship linker table may not always
         // have a type_id or name field.  So we have to be a bit more
@@ -271,6 +273,14 @@ class sbo__relationship extends ChadoField {
             'entity' => 'TripalEntity:' . $entity->id,
           )
         );
+
+        // See if an entity exists for the subject.
+        $data_table = preg_replace('/_relationship/', '', $relationship->tablename);
+        $sentity_id = chado_get_record_entity_by_table($data_table, $subject_id);
+        if ($sentity_id) {
+          $entity->{$field_name}['und'][$i]['value']['local:relationship_subject']['entity'] = 'TripalEntity:' . $sentity_id;
+        }
+
         if (property_exists($relationship->$subject_id_key, 'uniquename')) {
           $entity->{$field_name}['und'][$i]['value']['local:relationship_subject']['data:0842'] =  $relationship->$subject_id_key->uniquename;;
         }
@@ -311,6 +321,7 @@ class sbo__relationship extends ChadoField {
         $rel_acc = $relationship->type_id->dbxref_id->db_id->name . ':' . $relationship->type_id->dbxref_id->accession;
         $rel_type = $relationship->type_id->name;
         $verb = $this->get_rel_verb($rel_type);
+        $object_id = $relationship->$object_id_key->$object_pkey;
 
         // The linked to table of a relationship linker table may not always
         // have a type_id or name field.  So we have to be a bit more
@@ -377,6 +388,14 @@ class sbo__relationship extends ChadoField {
             'schema:name' => $object_name,
           )
         );
+
+        // See if an entity exists for the object.
+        $data_table = preg_replace('/_relationship/', '', $relationship->tablename);
+        $oentity_id = chado_get_record_entity_by_table($data_table, $object_id);
+        if ($oentity_id) {
+          $entity->{$field_name}['und'][$i]['value']['local:relationship_object']['entity'] = 'TripalEntity:' . $oentity_id;
+        }
+
         if (property_exists($relationship->$subject_id_key, 'uniquename')) {
           $entity->{$field_name}['und'][$i]['value']['local:relationship_subject']['data:0842'] = $relationship->$subject_id_key->uniquename;
         }
@@ -391,7 +410,7 @@ class sbo__relationship extends ChadoField {
         // Add the clause to the value array.
         $rel_type_clean = lcfirst(preg_replace('/_/', ' ', $rel_type));
         $entity->{$field_name}['und'][$i]['value']['SIO:000493'] = 'This ' .
-          $subject_type . ', ' . $subject_name . ', ' . $verb . ' '  . $rel_type_clean . ' the '  .
+          $subject_type . ' ' . $verb . ' '  . $rel_type_clean . ' the '  .
           $object_type . ' ' . $object_name . '.';
 
         $entity->{$field_name}['und'][$i]['chado-' . $field_table . '__' . $pkey] = $relationship->$pkey;

+ 11 - 6
tripal_chado/includes/TripalFields/sbo__relationship/sbo__relationship_formatter.inc

@@ -76,9 +76,11 @@ class sbo__relationship_formatter extends ChadoFieldFormatter {
         continue;
       }
 
+      // Add bold font to the object and subject names.
       $phrase = preg_replace("/$subject_type/", "<b>$subject_type</b>", $phrase);
       $phrase = preg_replace("/$object_type/", "<b>$object_type</b>", $phrase);
 
+      // Convert the object/subject to a link if an entity exists for it.
       if (array_key_exists('entity', $item['value']['local:relationship_object'])) {
         list($entity_type, $object_entity_id) = explode(':', $item['value']['local:relationship_object']['entity']);
         if ($object_entity_id != $entity->id) {
@@ -115,15 +117,18 @@ class sbo__relationship_formatter extends ChadoFieldFormatter {
     $pager = $this->ajaxifyPager($pager, $entity);
     $page_items = array_chunk($rows, $items_per_page);
 
-    if (count($items) == 1) {
-      $content = 'There is ' . count($items) . ' relationship.';
-    }
-    else {
-      $content = 'There are ' . count($items) . ' relationships.';
+    $content = '';
+    if ($total_pages > 1) {
+      if (count($rows) == 1) {
+        $content = 'There is ' . count($rows) . ' relationship.';
+      }
+      if (count($rows) > 1) {
+        $content = 'There are ' . count($rows) . ' relationships.';
+      }
     }
     $content .= theme_table(array(
       'header' => $headers,
-      'rows' => $page_items[$current_page],
+      'rows' => count($rows) > 0 ? $page_items[$current_page] : array(),
       'attributes' => array(
         'id' => 'sbo--relationship-table',
       ),

+ 1 - 1
tripal_chado/includes/TripalFields/so__transcript/so__transcript.inc

@@ -112,7 +112,7 @@ class so__transcript extends ChadoField {
         'data:0842' => $transcript->uniquename,
         'SO:0000735' => $loc,
       );
-      $entity_id = tripal_chado_get_record_entity($entity->bundle, $record_id);
+      $entity_id = chado_get_record_entity_by_bundle($entity->bundle, $record_id);
       if ($entity_id) {
          $entity->{$field_name}['und'][$i]['value']['entity'] = 'TripalEntity:' . $entity_id;
        }

+ 8 - 8
tripal_chado/includes/TripalImporter/FASTAImporter.inc

@@ -131,12 +131,12 @@ class FASTAImporter extends TripalImporter {
     );
 
     $form['additional']['re_help'] = array('#type' => 'item',
-      '#value' => t('A regular expression is an advanced method for extracting information from a string of text.
-         Your FASTA file may contain both a human-readable name and a unique name for each sequence.
-         If you want to import
-         both the name and unique name for all sequences, then you must provide regular expressions
-         so that the loader knows how to separate them.
-         Otherwise the name and uniquename will be the same.
+      '#value' => t('A regular expression is an advanced method for extracting
+         information from a string of text. Your FASTA file may contain both a
+         human-readable name and a unique name for each sequence. If you want
+         to import both the name and unique name for all sequences, then you
+         must provide regular expressions so that the loader knows how to
+         separate them. Otherwise the name and uniquename will be the same.
          By default, this loader will use the first word in the definition
          lines of the FASTA file
          as the name or unique name of the feature.')
@@ -155,7 +155,7 @@ class FASTAImporter extends TripalImporter {
       '#description' => t('Enter the regular expression that will extract the
          feature name from the FASTA definition line. For example, for a
          defintion line with a name and unique name separated by a bar \'|\' (>seqname|uniquename),
-         the regular expression for the unique name would be "^.*?\|(.*)$").  All FASTA
+         the regular expression for the unique name would be "^.*?\|(.*)$".  All FASTA
          definition lines begin with the ">" symbol.  You do not need to incldue
          this symbol in your regular expression.')
     );
@@ -819,7 +819,7 @@ class FASTAImporter extends TripalImporter {
       $values = array('organism_id' => $organism_id,'uniquename' => $parent, 'type_id' => $parentcvterm->cvterm_id);
       $results = chado_select_record('feature', array('feature_id'), $values);
       if (count($results) != 1) {
-        $this->logMessage("Cannot find a unique fature for the parent '!parent' of type '!type' for the feature.",
+        $this->logMessage("Cannot find a unique feature for the parent '!parent' of type '!type' for the feature.",
           array('!parent' => $parent,'!type' => $parent_type), TRIPAL_ERROR);
           return 0;
       }

+ 1 - 1
tripal_chado/includes/loaders/tripal_chado.fasta_loader.inc

@@ -870,7 +870,7 @@ function tripal_feature_load_fasta_feature($fh, $name, $uname, $db_id, $accessio
     $results = chado_select_record('feature', array('feature_id'
     ), $values);
     if (count($results) != 1) {
-      tripal_report_error('T_fasta_loader', "Cannot find a unique fature for the parent '%parent' of type
+      tripal_report_error('T_fasta_loader', "Cannot find a unique feature for the parent '%parent' of type
                '%type' for the feature.", array(
         '%parent' => $parent,'%type' => $parent_type
       ));

+ 2 - 2
tripal_chado/includes/tripal_chado.bundle.inc

@@ -110,7 +110,7 @@ function tripal_chado_create_bundle_table($bundle) {
       'entity_id' => array('entity_id'),
     ),
   );
-  $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+  $chado_entity_table = chado_get_bundle_entity_table($bundle);
   db_create_table($chado_entity_table, $schema);
 }
 
@@ -122,7 +122,7 @@ function tripal_chado_bundle_delete($bundle) {
 
   // Remove the entries in the appropriate chado entity table
   // and tripal_entity
-  $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+  $chado_entity_table = chado_get_bundle_entity_table($bundle);
   $sql = "DROP TABLE {$chado_entity_table}";
   db_query($sql);
 

+ 1 - 1
tripal_chado/includes/tripal_chado.entity.inc

@@ -88,7 +88,7 @@ function tripal_chado_entity_load($entities, $type) {
         $entity->chado_table = $bundle->data_table;
         $entity->chado_column = $bundle->type_column;
 
-        $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+        $chado_entity_table = chado_get_bundle_entity_table($bundle);
         $chado_entity = db_select($chado_entity_table, 'ce')
           ->fields('ce')
           ->condition('ce.entity_id', $entity->id)

+ 3 - 3
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -59,7 +59,7 @@ dpm($field_vals);
   // If this is an insert then add the chado_entity record.
   if ($op == FIELD_STORAGE_INSERT) {
     // Add the record to the proper chado entity table
-    $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+    $chado_entity_table = chado_get_bundle_entity_table($bundle);
     $record = array(
       'entity_id' => $entity->id,
       'record_id' => $base_record_id,
@@ -206,7 +206,7 @@ function tripal_chado_field_storage_pre_load($entity_type, $entities, $age,
       $type_field = $bundle->type_column;
 
       // Get the record id for the fields of this entity.
-      $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+      $chado_entity_table = chado_get_bundle_entity_table($bundle);
       $details = db_select($chado_entity_table, 'ce')
         ->fields('ce')
         ->condition('entity_id', $entity->id)
@@ -532,7 +532,7 @@ function tripal_chado_field_storage_query($query) {
   } // end foreach ($query->fieldConditions as $index => $condition) {
 
   // Now join with the chado entity table to get published records only.
-  $chado_entity_table = tripal_chado_get_bundle_entity_table($bundle);
+  $chado_entity_table = chado_get_bundle_entity_table($bundle);
   $cquery->join($chado_entity_table, 'CE', "CE.record_id = base.$pkey");
   $cquery->join('tripal_entity', 'TE', "CE.entity_id = TE.id");
   $cquery->fields('CE', array('entity_id'));

+ 50 - 0
tripal_chado/includes/tripal_chado.fields.inc

@@ -294,6 +294,22 @@ function tripal_chado_bundle_fields_info_custom(&$info, $details, $entity_type,
     );
   }
 
+  // PROTEIN SEQUENCE
+  if ($table_name == 'feature' and
+      ($bundle->label == 'mRNA' or $bundle->label == 'transcript' or $bundle->label == 'gene'))  {
+    $field_name = 'data__protein_sequence';
+    $field_type = 'data__protein_sequence';
+    $info[$field_name] = array(
+      'field_name' => $field_name,
+      'type' => $field_type,
+      'cardinality' => 1,
+      'locked' => FALSE,
+      'storage' => array(
+        'type' => 'field_chado_storage',
+      ),
+    );
+  }
+
   // GENE TRANSCRIPTS
   $rel_table = $table_name . '_relationship';
   if (chado_table_exists($rel_table) and $bundle->label == 'gene') {
@@ -1102,6 +1118,40 @@ function tripal_chado_bundle_instances_info_custom(&$info, $entity_type, $bundle
     );
   }
 
+  // PROTEIN SEQUENCES.
+  if ($table_name == 'feature' and
+      ($bundle->label == 'mRNA' or $bundle->label == 'transcript' or $bundle->label == 'gene'))  {
+    $field_name = 'data__protein_sequence';
+    $info[$field_name] = array(
+      'field_name' => $field_name,
+      'entity_type' => $entity_type,
+      'bundle' => $bundle->name,
+      'label' => 'Protein Sequence',
+      'description' => 'Protein sequences.',
+      'required' => FALSE,
+      'settings' => array(
+        'auto_attach' => FALSE,
+        'chado_table' => 'feature',
+        'chado_column' => 'residues',
+        'base_table' => 'feature',
+      ),
+      'widget' => array(
+        'type' => 'data__protein_sequence_widget',
+        'settings' => array(
+          'display_label' => 1,
+        ),
+      ),
+      'display' => array(
+        'default' => array(
+          'label' => 'above',
+          'type' => 'data__protein_sequence_formatter',
+          'settings' => array(),
+        ),
+      ),
+    );
+  }
+
+
   // GENE TRANSCRIPTS
   $rel_table = $table_name . '_relationship';
   if (chado_table_exists($rel_table) and $bundle->label == 'gene') {

+ 7 - 0
tripal_chado/includes/tripal_chado.semweb.inc

@@ -297,6 +297,13 @@ function tripal_chado_populate_vocab_EDAM() {
   ));
   tripal_associate_chado_semweb_term(NULL, 'uniquename', $term);
 
+  $term = tripal_insert_cvterm(array(
+    'id' => 'data:2976',
+    'name' => 'Protein sequence',
+    'cv_name' => 'EDAM',
+    'definition' => 'One or more protein sequences, possibly with associated annotation.',
+  ));
+
   $term = tripal_insert_cvterm(array(
     'id' => 'data:2968',
     'name' => 'Image',

+ 10 - 0
tripal_chado/theme/css/tripal_chado.css

@@ -22,6 +22,16 @@
    clear: both;
 }
 
+.protein-residues-formatter {
+   border: 1px solid #dddddd;
+   color: #000000;
+   height: 100px;
+   max-width: 500px;
+   overflow: scroll;
+   white-space: normal;
+   background-color: white;
+}
+
 .residues-formatter {
    border: 1px solid #dddddd;
    color: #000000;

+ 2 - 2
tripal_chado/tripal_chado.install

@@ -191,7 +191,7 @@ function tripal_chado_schema() {
     foreach ($resource as $r) {
       $bundle_name = $r->name;
       // This makes an assumption about the name of the linking table.
-      // @todo: Switch to tripal_chado_get_bundle_entity_table($bundle).
+      // @todo: Switch to chado_get_bundle_entity_table($bundle).
       $chado_entity_table = 'chado_' . $bundle_name;
       $schema[$chado_entity_table] = array(
         'description' => 'The linker table that associates TripalEntities with Chado records for entities of type ' . $bundle_name . '.',
@@ -731,7 +731,7 @@ function tripal_chado_update_7301() {
     // If the table for the bundle doesn't exist then create one, and then
     // move all of the records from the chado_entity table to it.
     while($cbundle = $cbundles->fetchObject()) {
-      $cbundle_table = tripal_chado_get_bundle_entity_table($cbundle);
+      $cbundle_table = chado_get_bundle_entity_table($cbundle);
 
       if (!db_table_exists($cbundle_table)) {
         // Create the bundle table.