Browse Source

A variety of small bug and text fixes

Stephen Ficklin 7 years ago
parent
commit
39c8baf932

+ 0 - 2
tripal/api/tripal.entities.api.inc

@@ -534,8 +534,6 @@ function tripal_create_bundle_fields($bundle, $term) {
     // If the field already exists then skip it.
     // If the field already exists then skip it.
     $field = field_info_field($details['field_name']);
     $field = field_info_field($details['field_name']);
     if ($field) {
     if ($field) {
-      tripal_set_message(t("Could not create new field: %field because it already exists.",
-        array('%field' =>  $details['field_name'])), TRIPAL_WARNING);
       continue;
       continue;
     }
     }
 
 

+ 5 - 0
tripal/includes/tripal.fields.inc

@@ -252,6 +252,11 @@ function tripal_field_no_delete() {
  */
  */
 function tripal_form_field_ui_field_overview_form_alter(&$form, &$form_state, $form_id) {
 function tripal_form_field_ui_field_overview_form_alter(&$form, &$form_state, $form_id) {
 
 
+  // If this isn't a TripalEntity content type then skip this form.
+  if ($form['#entity_type'] != 'TripalEntity') {
+    return;
+  }
+
   // Add the 'Storage Location' to the table header.
   // Add the 'Storage Location' to the table header.
   $form['fields']['#header'][] = 'Term';
   $form['fields']['#header'][] = 'Term';
   $form['fields']['#header'][] = 'Supported By * ';
   $form['fields']['#header'][] = 'Supported By * ';

+ 1 - 1
tripal/tripal.module

@@ -893,7 +893,7 @@ function tripal_block_save($delta = '', $edit = array()) {
 /**
 /**
  * Implements hook_block_configure().
  * Implements hook_block_configure().
  */
  */
-function tripal_block_configure ($delta = '') {
+function tripal_block_configure($delta = '') {
   $form = array();
   $form = array();
 
 
   switch ($delta) {
   switch ($delta) {

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

@@ -174,7 +174,6 @@ function tripal_chado_publish_records($values, $job_id = NULL) {
   // Perform the query.
   // Perform the query.
   $sql = $select . $from . $where;
   $sql = $select . $from . $where;
   $records = chado_query($sql, $args);
   $records = chado_query($sql, $args);
-
   $transaction = db_transaction();
   $transaction = db_transaction();
 
 
   print "\nNOTE: publishing records is performed using a database transaction. \n" .
   print "\nNOTE: publishing records is performed using a database transaction. \n" .

+ 3 - 1
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_widget.inc

@@ -74,7 +74,9 @@ class chado_linker__prop_widget extends ChadoFieldWidget {
           'accession' => $accession,
           'accession' => $accession,
         ),
         ),
       ));
       ));
-      $type_id = $cvterm->cvterm_id;
+      if ($cvterm) {
+        $type_id = $cvterm->cvterm_id;
+      }
     }
     }
 
 
     $widget['value'] = array(
     $widget['value'] = array(

+ 2 - 2
tripal_chado/includes/TripalImporter/OBOImporter.inc

@@ -661,7 +661,6 @@ class OBOImporter extends TripalImporter {
    *   The name of the default database.
    *   The name of the default database.
    */
    */
   private function processTerms($defaultcv, &$newcvs, $default_db) {
   private function processTerms($defaultcv, &$newcvs, $default_db) {
-
     $i = 0;
     $i = 0;
 
 
     // Iterate through each term from the OBO file and add it.
     // Iterate through each term from the OBO file and add it.
@@ -1117,6 +1116,7 @@ class OBOImporter extends TripalImporter {
     $default_db = '';
     $default_db = '';
     $line_num = 0;
     $line_num = 0;
     $num_read = 0;
     $num_read = 0;
+    $type = '';
 
 
     $filesize = filesize($obo_file);
     $filesize = filesize($obo_file);
     $this->setTotalItems($filesize);
     $this->setTotalItems($filesize);
@@ -1145,7 +1145,6 @@ class OBOImporter extends TripalImporter {
 
 
       //remove comments from end of lines
       //remove comments from end of lines
       $line = preg_replace('/^(.*?)\!.*$/', '\1', $line);  // TODO: if the explamation is escaped
       $line = preg_replace('/^(.*?)\!.*$/', '\1', $line);  // TODO: if the explamation is escaped
-      $type = '';
 
 
       // at the first stanza we're out of header
       // at the first stanza we're out of header
       if (preg_match('/^\s*\[/', $line)) {
       if (preg_match('/^\s*\[/', $line)) {
@@ -1172,6 +1171,7 @@ class OBOImporter extends TripalImporter {
         $stanza = array();
         $stanza = array();
         continue;
         continue;
       }
       }
+
       // break apart the line into the tag and value but ignore any escaped colons
       // break apart the line into the tag and value but ignore any escaped colons
       preg_replace("/\\:/", "|-|-|", $line); // temporarily replace escaped colons
       preg_replace("/\\:/", "|-|-|", $line); // temporarily replace escaped colons
       $pair = explode(":", $line, 2);
       $pair = explode(":", $line, 2);

+ 4 - 1
tripal_chado/includes/tripal_chado.cv.inc

@@ -3,11 +3,14 @@
 /**
 /**
  * Loads an OBO File using the new TripalImporter. Expected to be run by a Tripal Job.
  * Loads an OBO File using the new TripalImporter. Expected to be run by a Tripal Job.
  */
  */
-function tripal_cv_load_obo($obo_id) {
+function tripal_cv_load_obo($obo_id, $job = NULL) {
 
 
   module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/OBOImporter');
   module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/OBOImporter');
   $obo_importer = new OBOImporter();
   $obo_importer = new OBOImporter();
   $obo_importer->create(array('obo_id' => $obo_id));
   $obo_importer->create(array('obo_id' => $obo_id));
+  if ($job) {
+    $obo_importer->setJob($job);
+  }
   $obo_importer->run();
   $obo_importer->run();
 
 
 }
 }

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

@@ -60,13 +60,13 @@ function tripal_chado_field_storage_write($entity_type, $entity, $op, $fields) {
   if ($op == FIELD_STORAGE_INSERT) {
   if ($op == FIELD_STORAGE_INSERT) {
     // Add the record to the proper chado entity table
     // Add the record to the proper chado entity table
     $chado_entity_table = chado_get_bundle_entity_table($bundle);
     $chado_entity_table = chado_get_bundle_entity_table($bundle);
-    $record_id = db_insert($chado_entity_table)
+    $mapping_id = db_insert($chado_entity_table)
       ->fields(array(
       ->fields(array(
         'entity_id' => $entity->id,
         'entity_id' => $entity->id,
-        'record_id' => $base_record_id
+        'record_id' => $record_id
       ))
       ))
       ->execute();
       ->execute();
-    if (!$record_id) {
+    if (!$mapping_id) {
       throw new Exception('Unable to insert new Chado entity.');
       throw new Exception('Unable to insert new Chado entity.');
     }
     }
   }
   }
@@ -107,7 +107,7 @@ function tripal_chado_field_storage_write($entity_type, $entity, $op, $fields) {
  * @return
  * @return
  *   The unique record ID.
  *   The unique record ID.
  */
  */
-function tripal_chado_field_storage_write_table($table_name, $values, $base_table, $base_pkey = NULL, $base_record_id= NULL) {
+function tripal_chado_field_storage_write_table($table_name, $values, $base_table, $base_pkey = NULL, $base_record_id = NULL) {
   $schema = chado_get_schema($table_name);
   $schema = chado_get_schema($table_name);
   $fkeys = $schema['foreign keys'];
   $fkeys = $schema['foreign keys'];
   $pkey = $schema['primary key'][0];
   $pkey = $schema['primary key'][0];

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

@@ -33,6 +33,7 @@ function tripal_chado_populate_chado_semweb_table() {
   tripal_chado_populate_vocab_RDFS();
   tripal_chado_populate_vocab_RDFS();
   tripal_chado_populate_vocab_SBO();
   tripal_chado_populate_vocab_SBO();
   tripal_chado_populate_vocab_SCHEMA();
   tripal_chado_populate_vocab_SCHEMA();
+  tripal_chado_populate_vocab_SEP();
   tripal_chado_populate_vocab_SIO();
   tripal_chado_populate_vocab_SIO();
   tripal_chado_populate_vocab_SO();
   tripal_chado_populate_vocab_SO();
   tripal_chado_populate_vocab_SWO();
   tripal_chado_populate_vocab_SWO();

+ 14 - 1
tripal_chado/tripal_chado.module

@@ -164,7 +164,20 @@ function tripal_chado_menu() {
 
 
   // Adds a +Publish Chado Content link on the 'Tripal Content Types' page.
   // Adds a +Publish Chado Content link on the 'Tripal Content Types' page.
   $items['admin/structure/bio_data/publish'] = array(
   $items['admin/structure/bio_data/publish'] = array(
-    'title' => 'Publish Chado Content',
+    'title' => 'Publish Tripal Content',
+    'description' => t('Publish data that is present in Chado but which does
+        not yet have a page on this site for viewing. In Tripal v2.0 or
+        earlier this was refered to as "syncing".'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tripal_chado_publish_form'),
+    'access arguments' => array('administer tripal'),
+    'file' => 'includes/tripal_chado.publish.inc',
+    'file path' => drupal_get_path('module', 'tripal_chado'),
+    'type' => MENU_LOCAL_ACTION,
+    'weight' => 2
+  );
+  $items['admin/content/bio_data/publish'] = array(
+    'title' => 'Publish Tripal Content',
     'description' => t('Publish data that is present in Chado but which does
     'description' => t('Publish data that is present in Chado but which does
         not yet have a page on this site for viewing. In Tripal v2.0 or
         not yet have a page on this site for viewing. In Tripal v2.0 or
         earlier this was refered to as "syncing".'),
         earlier this was refered to as "syncing".'),

+ 4 - 4
tripal_ds/includes/tripal_ds.field_group.inc

@@ -164,14 +164,14 @@ function _data_sequence_field_group_info($bundle_name, $fields){
   $field_group_tripalpane->mode = 'default';
   $field_group_tripalpane->mode = 'default';
   $field_group_tripalpane->parent_name = '';
   $field_group_tripalpane->parent_name = '';
   $field_group_tripalpane->data = array(
   $field_group_tripalpane->data = array(
-    'label' => 'Data Sequences',
+    'label' => 'Sequences',
     'weight' => '1',
     'weight' => '1',
     'children' => array(
     'children' => array(
         0 => 'group_sequence_table',
         0 => 'group_sequence_table',
     ),
     ),
     'format_type' => 'tripalpane',
     'format_type' => 'tripalpane',
     'format_settings' => array(
     'format_settings' => array(
-      'label' => 'Data Sequences',
+      'label' => 'Sequences',
       'instance_settings' => array(
       'instance_settings' => array(
         'id' => 'tripal_ds-fieldset-group_sequence_tripalpane',
         'id' => 'tripal_ds-fieldset-group_sequence_tripalpane',
         'classes' => 'group-sequence-tripalpane field-group-tripalpane ',
         'classes' => 'group-sequence-tripalpane field-group-tripalpane ',
@@ -195,12 +195,12 @@ function _data_sequence_field_group_info($bundle_name, $fields){
   $field_group->mode = 'default';
   $field_group->mode = 'default';
   $field_group->parent_name = 'group_sequence_tripalpane';
   $field_group->parent_name = 'group_sequence_tripalpane';
   $field_group->data = array(
   $field_group->data = array(
-    'label' => 'Data Sequences Table',
+    'label' => 'Sequences Table',
     'weight' => '1',
     'weight' => '1',
     'children' => $fields,
     'children' => $fields,
     'format_type' => 'table',
     'format_type' => 'table',
     'format_settings' => array(
     'format_settings' => array(
-      'label' => 'Data Sequences Table',
+      'label' => 'Sequences Table',
       'instance_settings' => array(
       'instance_settings' => array(
         'label_visibility' => '1',
         'label_visibility' => '1',
         'desc' => '',
         'desc' => '',

+ 1 - 1
tripal_ds/includes/views/tripal_ds.views.inc

@@ -58,7 +58,7 @@ function tripal_ds_views_data() {
 
 
   $data['tripal_ds']['tripal_ds_field_label'] = array(
   $data['tripal_ds']['tripal_ds_field_label'] = array(
    'title' => t('Field Label'),
    'title' => t('Field Label'),
-   'help' => t('The human readable name of the field, like "Data Sequences".'),
+   'help' => t('The human readable name of the field, like "Sequences".'),
    'field' => array(
    'field' => array(
         'handler' => 'views_handler_field',
         'handler' => 'views_handler_field',
         'click sortable' => TRUE, // This is use by the table display plugin.
         'click sortable' => TRUE, // This is use by the table display plugin.