From cea197f984e0e4ded110898401485e6420e47d32 Mon Sep 17 00:00:00 2001 From: Sofia Robb Date: Fri, 22 Sep 2023 21:21:33 -0700 Subject: [PATCH 01/10] This field was originally submitted by Sofia, but with changes added by Stephen --- .../ChadoSynonymFormatterDefault.php | 59 +++++ .../Field/FieldType/ChadoSynonymDefault.php | 233 ++++++++++++++++++ .../FieldWidget/ChadoSynonymWidgetDefault.php | 178 +++++++++++++ 3 files changed, 470 insertions(+) create mode 100644 tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php create mode 100644 tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php create mode 100644 tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php diff --git a/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php b/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php new file mode 100644 index 000000000..73902391a --- /dev/null +++ b/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php @@ -0,0 +1,59 @@ + $item) { + $value = $item->get('value')->getString(); + $list[$delta] = $value; + } + + // Also need to make sure to not return markup if the field is empty. + if (empty($list)) { + return $elements; + } + + // If more than one value has been found display all values in an unordered + // list. + if (count($list) > 1) { + $elements[0] = [ + '#theme' => 'item_list', + '#list_type' => 'ul', + '#items' => $list, + '#wrapper_attributes' => ['class' => 'container'], + ]; + return $elements; + } + + $elements[0] = [ + '#type' => 'markup', + "#markup" => $list[0] + ]; + return $elements; + } +} diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php new file mode 100644 index 000000000..582a4479f --- /dev/null +++ b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php @@ -0,0 +1,233 @@ +getValue('settings'); + if (!array_key_exists('storage_plugin_settings', $settings)) { + return; + } + + // Check if a corresponding synonym table exists for the + // base table. + $base_table = $form_state->getValue(['settings', 'storage_plugin_settings', 'base_table']); + $linker_table = $base_table . '_synonym'; + $chado = \Drupal::service('tripal_chado.database'); + $schema = $chado->schema(); + $linker_table_def = $schema->getTableDef($linker_table, ['format' => 'Drupal']); + if (!$linker_table_def) { + $form_state->setErrorByName('storage_plugin_settings][syn_linker_table', + 'The selected base table cannot support synonyms.'); + } + else { + $chado = \Drupal::service('tripal_chado.database'); + $schema = $chado->schema(); + $linker_table_def = $schema->getTableDef($linker_table, ['format' => 'Drupal']); + $linker_fkey_column = array_keys($linker_table_def['foreign keys'][$base_table]['columns'])[0]; + $form_state->setvalue(['settings', 'storage_plugin_settings', 'syn_linker_table'], $linker_table); + $form_state->setvalue(['settings', 'storage_plugin_settings', 'syn_linker_fkey_column'], $linker_fkey_column); + } + } + + + /** + * {@inheritdoc} + */ + public static function tripalTypes($field_definition) { + $entity_type_id = $field_definition->getTargetEntityTypeId(); + + // Get the settings for this field. + $storage_settings = $field_definition->getSetting('storage_plugin_settings'); + + $base_table = $storage_settings['base_table']; + $syn_linker_table = $storage_settings['syn_linker_table']; + $syn_linker_fkey_column = $storage_settings['syn_linker_fkey_column']; + + // If we don't have a base table then we're not ready to specify the + // properties for this field. + if (!$base_table or !$syn_linker_table) { + $record_id_term = 'SIO:000729'; + return [ + new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'record_id', $record_id_term, [ + 'action' => 'store_id', + 'drupal_store' => TRUE, + ]) + ]; + } + + // Determine the primary key of the base table. + $chado = \Drupal::service('tripal_chado.database'); + $schema = $chado->schema(); + $base_table_def = $schema->getTableDef($base_table, ['format' => 'Drupal']); + $base_pkey_col = $base_table_def['primary key']; + $synonym_table_def = $schema->getTableDef('synonym', ['format' => 'Drupal']); + $syn_linker_table_def = $schema->getTableDef($syn_linker_table, ['format' => 'Drupal']); + $syn_linker_table_pkey = $syn_linker_table_def['primary key']; + $cvterm_table_def = $schema->getTableDef('cvterm', ['format' => 'Drupal']); + + // Create variables to store the terms for the properties. We can use terms + // from Chado tables if appropriate. + $storage = \Drupal::entityTypeManager()->getStorage('chado_term_mapping'); + $mapping = $storage->load('core_mapping'); + $record_id_term = 'SIO:000729'; + + // Synonym table fields + $syn_name_term = $mapping->getColumnTermId('synonym', 'name'); + $syn_name_len = $synonym_table_def['fields']['name']['size']; + $syn_type_id_term = $mapping->getColumnTermId('synonym','type_id'); + $syn_type_name_len = $cvterm_table_def['fields']['name']['size']; + + + // Synonym linker table fields + $syn_linker_fkey_id_term = $mapping->getColumnTermId($syn_linker_table, $syn_linker_fkey_column); + $syn_linker_synonym_id_term = $mapping->getColumnTermId($syn_linker_table, 'synonym_id'); + $syn_linker_is_current_term = $mapping->getColumnTermId($syn_linker_table, 'is_current'); + $syn_linker_is_internal_term = $mapping->getColumnTermId($syn_linker_table, 'is_internal'); + $syn_linker_pub_id_term = $mapping->getColumnTermId($syn_linker_table, 'pub_id'); + + // Always store the record id of the base record that this field is + // associated with in Chado. + $properties = []; + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'record_id', $record_id_term, [ + 'action' => 'store_id', + 'drupal_store' => TRUE, + 'chado_table' => $base_table, + 'chado_column' => $base_pkey_col + ]); + + // + // Properties corresponding to the synonym linker table. + // + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pkey_id', $syn_linker_synonym_id_term, [ + 'action' => 'store_pkey', + 'drupal_store' => TRUE, + 'chado_table' => $syn_linker_table, + 'chado_column' => $syn_linker_table_pkey, + ]); + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_base_fkey_id' , $syn_linker_fkey_id_term, [ + 'action' => 'store_link', + 'drupal_store' => TRUE, + 'chado_table' => $syn_linker_table, + 'chado_column' => $syn_linker_fkey_column, + ]); + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_synonym_fkey_id' , $syn_linker_fkey_id_term, [ + 'action' => 'store_link', + 'drupal_store' => TRUE, + 'chado_table' => $syn_linker_table, + 'chado_column' => 'synonym_id', + ]); + $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_current', $syn_linker_is_current_term, [ + 'action' => 'store', + 'chado_table' => $syn_linker_table, + 'drupal_store' => FALSE, + 'chado_column' => 'is_current', + 'empty_value' => TRUE + ]); + $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_internal', $syn_linker_is_internal_term, [ + 'action' => 'store', + 'chado_table' => $syn_linker_table, + 'drupal_store' => FALSE, + 'chado_column' => 'is_internal', + 'empty_value' => FALSE + ]); + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pub_id' , $syn_linker_pub_id_term, [ + 'action' => 'store', + 'drupal_store' => FALSE, + 'chado_table' => $syn_linker_table, + 'chado_column' => 'pub_id', + ]); + + // + // Properties corresponding to the synonym table. + // + $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'name', $syn_name_term, $syn_name_len, [ + 'action' => 'join', + 'path' => $syn_linker_table . '.synonym_id>synonym.synonym_id', + 'chado_column' => 'name', + 'as' => 'term_name', + 'drupal_store' => FALSE, + ]); + $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'synonym_type', $syn_type_id_term, $syn_type_name_len, [ + 'action' => 'join', + 'path' => $syn_linker_table . '.synonym_id>synonym.synonym_id;synonym.type_id>cvterm.cvterm_id', + 'chado_column' => 'name', + 'as' => 'synonym_type', + 'drupal_store' => FALSE, + ]); + + + return $properties; + } + +} \ No newline at end of file diff --git a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php new file mode 100644 index 000000000..4b5ecb5e3 --- /dev/null +++ b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php @@ -0,0 +1,178 @@ +getFieldDefinition(); + $field_settings = $field_definition->getSettings(); + $storage_settings = $field_definition->getSetting('storage_plugin_settings'); + $base_table = $storage_settings['base_table']; + $syn_linker_table = $storage_settings['syn_linker_table']; + $syn_linker_fkey_column = $storage_settings['syn_linker_fkey_column']; + + $schema = $chado->schema(); + $synonym_table_def = $schema->getTableDef('synonym', ['format' => 'Drupal']); + $syn_name_len = $synonym_table_def['fields']['name']['size']; + + // Get the default values. + $item_vals = $items[$delta]->getValue(); + $record_id = $item_vals['record_id'] ?? 0; + $linker_pkey_id = $item_vals['linker_pkey_id'] ?? 0; + $linker_base_fkey_id = $item_vals['linker_base_fkey_id'] ?? 0; + $linker_synonym_fkey_id = $item_vals['linker_synonym_fkey_id'] ?? 0; + $linker_pub_id = $item_vals['linker_pub_id'] ?? 0; + $is_current = $item_vals['is_current'] ?? TRUE; + $is_internal = $item_vals['is_internal'] ?? FALSE; + $name = $item_vals['name'] ?? ''; + $synonym_type = $item_vals['synonym_type'] ?? 'exact'; + $synonym_sgml = $item_vals['synonym_sgml'] ?? ''; + + // Get the `exact` synonym type. There are other types + // that are installed by Tripal such as BROAD, NARROW, and RELATED + // but these are meant for terms. Anyone using this field should + // simply be adding alternate names so this will always be + // an "exact" synonym. + $query = $chado->select('1:cvterm', 'cvt'); + $query->leftJoin('1:cv', 'cv', 'cv.cv_id = cvt.cv_id'); + $query->fields('cvt', ['cvterm_id', 'name', 'definition']); + $query->condition('cv.name', 'synonym_type'); + $results = $query->execute(); + $default_syn_type_id = NULL; + while ($result = $results->fetchObject()) { + if ($result->name == 'exact') { + $default_syn_type_id = $result->cvterm_id; + } + } + + // Get the default null publication for now until we have a + // decent pub lookup field. + $query = $chado->select('1:pub', 'p'); + $query->fields('p', ['pub_id']); + $query->condition('p.uniquename', 'null'); + $linker_pub_id = $query->execute()->fetchField(); + + $elements = []; + $elements['record_id'] = [ + '#type' => 'value', + '#default_value' => $record_id, + ]; + $elements['linker_pkey_id'] = [ + '#type' => 'value', + '#default_value' => $linker_pkey_id, + ]; + $elements['linker_base_fkey_id'] = [ + '#type' => 'value', + '#default_value' => $linker_base_fkey_id, + ]; + $elements['linker_synonym_fkey_id'] = [ + '#type' => 'value', + '#default_value' => $linker_synonym_fkey_id, + ]; + $elements['linker_pub_id'] = [ + '#type' => 'value', + '#default_value' => $linker_pub_id, + ]; + $elements['name'] = $element + [ + '#type' => 'textfield', + '#title' => 'Synonym', + '#default_value' => $name, + '#maxlength' => $syn_name_len, + '#description' => 'An alias or alternate name for this entity.', + '#weight' => 10, + ]; + $elements['synonym_type_id'] = [ + '#type' => 'value', + '#default_value' => $default_syn_type_id, + ]; + $elements['synonym_type'] = [ + '#type' => 'value', + '#default_value' => 'exact', + ]; + $elements['is_current'] = [ + '#type' => 'checkbox', + '#title' => t('Is this synonym current?'), + '#description' => t('If a different synonym has replaced this one, uncheck this box. '. + 'However, more than one synonym can be current.'), + '#default_value' => $is_current, + '#weight' => 12, + ]; + $elements['is_internal'] = [ + '#type' => 'checkbox', + '#title' => 'Is this synonym internal?', + '#default_value' => $is_internal, + '#description' => t('Typically a synonym exists so that somebody querying the database with an ' . + 'obsolete name can find the object they\'re looking. If the synonym has been used publicly '. + 'and deliberately (e.g. in a paper), it may also be listed in reports as a synonym. If the ' . + 'synonym was not used deliberately (e.g. there was a typo which went public), then the ' . + 'synonym is internal.'), + '#weight' => 14, + ]; + return $elements; + } + + + /** + * {@inheritDoc} + */ + public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { + $chado = \Drupal::service('tripal_chado.database'); + + // Remove any empty values that don't have a name + foreach ($values as $delta => $item) { + if ($item['name'] == '') { + unset($values[$delta]); + } + } + + // Iterate through the synonyms and if a name is not + // present in the synonym table then add it. + foreach ($values as $delta => $item) { + $name = $item['name']; + $synonym_type_id = $item['synonym_type_id']; + + $query = $chado->select('1:synonym', 's'); + $query->fields('s', ['name', 'synonym_id']); + $query->condition('s.name', $item['name']); + $synonym = $query->execute()->fetchObject(); + if (!$synonym) { + $insert = $chado->insert('1:synonym'); + $insert->fields([ + 'name' => $name, + 'type_id' => $synonym_type_id, + 'synonym_sgml' => '', + ]); + $insert->execute(); + $synonym = $query->execute()->fetchObject(); + } + $values[$delta]['linker_synonym_fkey_id'] = $synonym->synonym_id; + } + return $values; + } + +} From 90948504daadb3f5e84ee04f54f69ae6e2700ffb Mon Sep 17 00:00:00 2001 From: Stephen Ficklin Date: Fri, 22 Sep 2023 23:09:16 -0700 Subject: [PATCH 02/10] slight adjustments for clarity and one bug fix --- .../FieldFormatter/ChadoSynonymFormatterDefault.php | 2 +- .../Plugin/Field/FieldType/ChadoSynonymDefault.php | 2 +- .../Field/FieldWidget/ChadoSynonymWidgetDefault.php | 11 +++++++++++ .../src/Plugin/TripalStorage/ChadoStorage.php | 8 ++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php b/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php index 73902391a..9c415c384 100644 --- a/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoSynonymFormatterDefault.php @@ -29,7 +29,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $list = []; foreach($items as $delta => $item) { - $value = $item->get('value')->getString(); + $value = $item->get('name')->getString(); $list[$delta] = $value; } diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php index 582a4479f..9f37721fc 100644 --- a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php @@ -215,7 +215,7 @@ public static function tripalTypes($field_definition) { 'action' => 'join', 'path' => $syn_linker_table . '.synonym_id>synonym.synonym_id', 'chado_column' => 'name', - 'as' => 'term_name', + 'as' => 'synonym_name', 'drupal_store' => FALSE, ]); $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'synonym_type', $syn_type_id_term, $syn_type_name_len, [ diff --git a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php index 4b5ecb5e3..975786faa 100644 --- a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php @@ -72,6 +72,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // Get the default null publication for now until we have a // decent pub lookup field. + // @todo: update this for a pub selector field later. $query = $chado->select('1:pub', 'p'); $query->fields('p', ['pub_id']); $query->condition('p.uniquename', 'null'); @@ -150,6 +151,16 @@ public function massageFormValues(array $values, array $form, FormStateInterface } } + // Reset the weights + $i = 0; + foreach ($values as $delta => $value) { + if ($value['value'] == '') { + continue; + } + $values[$delta]['_weight'] = $i; + $i++; + } + // Iterate through the synonyms and if a name is not // present in the synonym table then add it. foreach ($values as $delta => $item) { diff --git a/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php b/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php index d10a38c49..59ad0fffa 100644 --- a/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php +++ b/tripal_chado/src/Plugin/TripalStorage/ChadoStorage.php @@ -44,14 +44,14 @@ class ChadoStorage extends TripalStorageBase implements TripalStorageInterface { /** * The database connection for querying Chado. * - * @var Drupal\tripal_chado\Database\ChadoConnection + * @var \Drupal\tripal_chado\Database\ChadoConnection */ protected $connection; /** * A service to provide debugging for fields to developers. * - * @ var Drupal\tripal_chado\Services\ChadoFieldDebugger + * @var \Drupal\tripal_chado\Services\ChadoFieldDebugger */ protected $field_debugger; @@ -91,8 +91,8 @@ public static function create(ContainerInterface $container, array $configuratio * @param array $configuration * @param string $plugin_id * @param mixed $plugin_definition - * @param Drupal\tripal\Services\TripalLogger $logger - * @param Drupal\tripal_chado\Database\ChadoConnection $connection + * @param \Drupal\tripal\Services\TripalLogger $logger + * @param \Drupal\tripal_chado\Database\ChadoConnection $connection */ public function __construct(array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger, ChadoConnection $connection, ChadoFieldDebugger $field_debugger) { parent::__construct($configuration, $plugin_id, $plugin_definition, $logger); From 1b04d597e7badfe34fa2b88e79c0146c2d063531 Mon Sep 17 00:00:00 2001 From: Stephen Ficklin Date: Fri, 22 Sep 2023 23:21:49 -0700 Subject: [PATCH 03/10] updated YML --- ...l.tripalfield_collection.default_chado.yml | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml index e471ba4b0..67f8cf3b0 100644 --- a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml +++ b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml @@ -987,7 +987,34 @@ fields: default: region: content weight: 90 - + + - name: gene_synonym + content_type: gene + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + syn_linker_table: feature_synonym + syn_linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: mrna_name content_type: mRNA label: Name From ab7b0beb0c318d2fdca6ac7267962588cb32685a Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Mon, 25 Sep 2023 13:27:21 -0600 Subject: [PATCH 04/10] Switch syn_linker* to be more generic --- ...l.tripalfield_collection.default_chado.yml | 8 +-- .../Field/FieldType/ChadoSynonymDefault.php | 64 +++++++++---------- .../FieldWidget/ChadoSynonymWidgetDefault.php | 4 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml index 67f8cf3b0..be4703fc2 100644 --- a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml +++ b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml @@ -987,7 +987,7 @@ fields: default: region: content weight: 90 - + - name: gene_synonym content_type: gene label: Synonyms @@ -999,8 +999,8 @@ fields: storage_plugin_id: chado_storage storage_plugin_settings: base_table: feature - syn_linker_table: feature_synonym - syn_linker_fkey_column: feature_id + linker_table: feature_synonym + linker_fkey_column: feature_id settings: termIdSpace: schema termAccession: alternateName @@ -1014,7 +1014,7 @@ fields: default: region: content weight: 10 - + - name: mrna_name content_type: mRNA label: Name diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php index 9f37721fc..54e9fb389 100644 --- a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php @@ -39,8 +39,8 @@ public static function mainPropertyName() { */ public static function defaultStorageSettings() { $settings = parent::defaultStorageSettings(); - $settings['storage_plugin_settings']['syn_linker_table'] = ''; - $settings['storage_plugin_settings']['syn_linker_fkey_column'] = ''; + $settings['storage_plugin_settings']['linker_table'] = ''; + $settings['storage_plugin_settings']['linker_fkey_column'] = ''; return $settings; } @@ -87,7 +87,7 @@ public static function storageSettingsFormValidate(array $form, FormStateInterfa $schema = $chado->schema(); $linker_table_def = $schema->getTableDef($linker_table, ['format' => 'Drupal']); if (!$linker_table_def) { - $form_state->setErrorByName('storage_plugin_settings][syn_linker_table', + $form_state->setErrorByName('storage_plugin_settings][linker_table', 'The selected base table cannot support synonyms.'); } else { @@ -95,8 +95,8 @@ public static function storageSettingsFormValidate(array $form, FormStateInterfa $schema = $chado->schema(); $linker_table_def = $schema->getTableDef($linker_table, ['format' => 'Drupal']); $linker_fkey_column = array_keys($linker_table_def['foreign keys'][$base_table]['columns'])[0]; - $form_state->setvalue(['settings', 'storage_plugin_settings', 'syn_linker_table'], $linker_table); - $form_state->setvalue(['settings', 'storage_plugin_settings', 'syn_linker_fkey_column'], $linker_fkey_column); + $form_state->setvalue(['settings', 'storage_plugin_settings', 'linker_table'], $linker_table); + $form_state->setvalue(['settings', 'storage_plugin_settings', 'linker_fkey_column'], $linker_fkey_column); } } @@ -111,12 +111,12 @@ public static function tripalTypes($field_definition) { $storage_settings = $field_definition->getSetting('storage_plugin_settings'); $base_table = $storage_settings['base_table']; - $syn_linker_table = $storage_settings['syn_linker_table']; - $syn_linker_fkey_column = $storage_settings['syn_linker_fkey_column']; + $linker_table = $storage_settings['linker_table']; + $linker_fkey_column = $storage_settings['linker_fkey_column']; // If we don't have a base table then we're not ready to specify the // properties for this field. - if (!$base_table or !$syn_linker_table) { + if (!$base_table or !$linker_table) { $record_id_term = 'SIO:000729'; return [ new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'record_id', $record_id_term, [ @@ -132,8 +132,8 @@ public static function tripalTypes($field_definition) { $base_table_def = $schema->getTableDef($base_table, ['format' => 'Drupal']); $base_pkey_col = $base_table_def['primary key']; $synonym_table_def = $schema->getTableDef('synonym', ['format' => 'Drupal']); - $syn_linker_table_def = $schema->getTableDef($syn_linker_table, ['format' => 'Drupal']); - $syn_linker_table_pkey = $syn_linker_table_def['primary key']; + $linker_table_def = $schema->getTableDef($linker_table, ['format' => 'Drupal']); + $linker_table_pkey = $linker_table_def['primary key']; $cvterm_table_def = $schema->getTableDef('cvterm', ['format' => 'Drupal']); // Create variables to store the terms for the properties. We can use terms @@ -150,11 +150,11 @@ public static function tripalTypes($field_definition) { // Synonym linker table fields - $syn_linker_fkey_id_term = $mapping->getColumnTermId($syn_linker_table, $syn_linker_fkey_column); - $syn_linker_synonym_id_term = $mapping->getColumnTermId($syn_linker_table, 'synonym_id'); - $syn_linker_is_current_term = $mapping->getColumnTermId($syn_linker_table, 'is_current'); - $syn_linker_is_internal_term = $mapping->getColumnTermId($syn_linker_table, 'is_internal'); - $syn_linker_pub_id_term = $mapping->getColumnTermId($syn_linker_table, 'pub_id'); + $linker_fkey_id_term = $mapping->getColumnTermId($linker_table, $linker_fkey_column); + $linker_synonym_id_term = $mapping->getColumnTermId($linker_table, 'synonym_id'); + $linker_is_current_term = $mapping->getColumnTermId($linker_table, 'is_current'); + $linker_is_internal_term = $mapping->getColumnTermId($linker_table, 'is_internal'); + $linker_pub_id_term = $mapping->getColumnTermId($linker_table, 'pub_id'); // Always store the record id of the base record that this field is // associated with in Chado. @@ -169,42 +169,42 @@ public static function tripalTypes($field_definition) { // // Properties corresponding to the synonym linker table. // - $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pkey_id', $syn_linker_synonym_id_term, [ + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pkey_id', $linker_synonym_id_term, [ 'action' => 'store_pkey', 'drupal_store' => TRUE, - 'chado_table' => $syn_linker_table, - 'chado_column' => $syn_linker_table_pkey, + 'chado_table' => $linker_table, + 'chado_column' => $linker_table_pkey, ]); - $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_base_fkey_id' , $syn_linker_fkey_id_term, [ + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_base_fkey_id' , $linker_fkey_id_term, [ 'action' => 'store_link', 'drupal_store' => TRUE, - 'chado_table' => $syn_linker_table, - 'chado_column' => $syn_linker_fkey_column, + 'chado_table' => $linker_table, + 'chado_column' => $linker_fkey_column, ]); - $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_synonym_fkey_id' , $syn_linker_fkey_id_term, [ + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_synonym_fkey_id' , $linker_fkey_id_term, [ 'action' => 'store_link', 'drupal_store' => TRUE, - 'chado_table' => $syn_linker_table, + 'chado_table' => $linker_table, 'chado_column' => 'synonym_id', ]); - $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_current', $syn_linker_is_current_term, [ + $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_current', $linker_is_current_term, [ 'action' => 'store', - 'chado_table' => $syn_linker_table, + 'chado_table' => $linker_table, 'drupal_store' => FALSE, 'chado_column' => 'is_current', 'empty_value' => TRUE ]); - $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_internal', $syn_linker_is_internal_term, [ + $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_internal', $linker_is_internal_term, [ 'action' => 'store', - 'chado_table' => $syn_linker_table, + 'chado_table' => $linker_table, 'drupal_store' => FALSE, 'chado_column' => 'is_internal', 'empty_value' => FALSE ]); - $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pub_id' , $syn_linker_pub_id_term, [ + $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pub_id' , $linker_pub_id_term, [ 'action' => 'store', 'drupal_store' => FALSE, - 'chado_table' => $syn_linker_table, + 'chado_table' => $linker_table, 'chado_column' => 'pub_id', ]); @@ -213,14 +213,14 @@ public static function tripalTypes($field_definition) { // $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'name', $syn_name_term, $syn_name_len, [ 'action' => 'join', - 'path' => $syn_linker_table . '.synonym_id>synonym.synonym_id', + 'path' => $linker_table . '.synonym_id>synonym.synonym_id', 'chado_column' => 'name', 'as' => 'synonym_name', 'drupal_store' => FALSE, ]); $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'synonym_type', $syn_type_id_term, $syn_type_name_len, [ 'action' => 'join', - 'path' => $syn_linker_table . '.synonym_id>synonym.synonym_id;synonym.type_id>cvterm.cvterm_id', + 'path' => $linker_table . '.synonym_id>synonym.synonym_id;synonym.type_id>cvterm.cvterm_id', 'chado_column' => 'name', 'as' => 'synonym_type', 'drupal_store' => FALSE, @@ -230,4 +230,4 @@ public static function tripalTypes($field_definition) { return $properties; } -} \ No newline at end of file +} diff --git a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php index 975786faa..4f0a5bc40 100644 --- a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php @@ -33,8 +33,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $field_settings = $field_definition->getSettings(); $storage_settings = $field_definition->getSetting('storage_plugin_settings'); $base_table = $storage_settings['base_table']; - $syn_linker_table = $storage_settings['syn_linker_table']; - $syn_linker_fkey_column = $storage_settings['syn_linker_fkey_column']; + $linker_table = $storage_settings['linker_table']; + $linker_fkey_column = $storage_settings['linker_fkey_column']; $schema = $chado->schema(); $synonym_table_def = $schema->getTableDef('synonym', ['format' => 'Drupal']); From 7b84cdeeb0e6a41ab738b249b9d1dd229a9ccf50 Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Mon, 25 Sep 2023 13:27:48 -0600 Subject: [PATCH 05/10] Add linker_* to the yml schema for storage_plugin_settings. --- tripal_chado/tripal_chado.module | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tripal_chado/tripal_chado.module b/tripal_chado/tripal_chado.module index f78ce8cab..91871ba14 100644 --- a/tripal_chado/tripal_chado.module +++ b/tripal_chado/tripal_chado.module @@ -78,6 +78,17 @@ function tripal_chado_config_schema_info_alter(&$definitions) { 'label' => 'Table containing property columns', 'nullable' => false ]; + // Specific to linker tables. + $definitions['field.storage.tripal_entity.*']['mapping']['settings']['mapping']['storage_plugin_settings']['mapping']['linker_table'] = [ + 'type' => 'string', + 'label' => 'The linking table used by the current field.', + 'nullable' => true + ]; + $definitions['field.storage.tripal_entity.*']['mapping']['settings']['mapping']['storage_plugin_settings']['mapping']['linker_fkey_column'] = [ + 'type' => 'string', + 'label' => 'The column in the linking table which is a foreign key pointing to the base table (e.g. for feature_synonym this would be feature_id).', + 'nullable' => true + ]; // ADDITIONS TO TRIPAL FIELD COLLECTION -YML FIELD CREATION. // Adds the Base table and column information needed for all Chado fields. @@ -111,6 +122,17 @@ function tripal_chado_config_schema_info_alter(&$definitions) { 'label' => 'Table containing property columns', 'nullable' => false ]; + // Specific to linker tables. + $definitions['tripal.tripalfield_collection.*']['mapping']['fields']['sequence']['mapping']['storage_settings']['mapping']['storage_plugin_settings']['mapping']['linker_table'] = [ + 'type' => 'string', + 'label' => 'The linking table used by the current field.', + 'nullable' => true + ]; + $definitions['tripal.tripalfield_collection.*']['mapping']['fields']['sequence']['mapping']['storage_settings']['mapping']['storage_plugin_settings']['mapping']['linker_fkey_column'] = [ + 'type' => 'string', + 'label' => 'The column in the linking table which is a foreign key pointing to the base table (e.g. for feature_synonym this would be feature_id).', + 'nullable' => true + ]; } /** From e156247aba4ae372fd4c32958426b0823005a93e Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Wed, 27 Sep 2023 14:43:15 -0600 Subject: [PATCH 06/10] Sometimes value[value] not set --- .../src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php index 4f0a5bc40..b8e7be611 100644 --- a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoSynonymWidgetDefault.php @@ -154,7 +154,7 @@ public function massageFormValues(array $values, array $form, FormStateInterface // Reset the weights $i = 0; foreach ($values as $delta => $value) { - if ($value['value'] == '') { + if (array_key_exists('value', $value) AND $value['value'] == '') { continue; } $values[$delta]['_weight'] = $i; From 262121fbe863eec4a03fa2a94e159b298d9ea4e9 Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Wed, 27 Sep 2023 14:43:31 -0600 Subject: [PATCH 07/10] Switch to using new store_link convention. --- .../Field/FieldType/ChadoSynonymDefault.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php index 54e9fb389..316656a9b 100644 --- a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php @@ -163,30 +163,36 @@ public static function tripalTypes($field_definition) { 'action' => 'store_id', 'drupal_store' => TRUE, 'chado_table' => $base_table, - 'chado_column' => $base_pkey_col + 'chado_column' => $base_pkey_col, ]); // // Properties corresponding to the synonym linker table. // + // E.g. feature_synonym.feature_synonym_id $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pkey_id', $linker_synonym_id_term, [ 'action' => 'store_pkey', 'drupal_store' => TRUE, 'chado_table' => $linker_table, 'chado_column' => $linker_table_pkey, ]); + // E.g. feature.feature_id => feature_synonym.feature_id $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_base_fkey_id' , $linker_fkey_id_term, [ 'action' => 'store_link', 'drupal_store' => TRUE, - 'chado_table' => $linker_table, - 'chado_column' => $linker_fkey_column, + 'left_table' => $base_table, + 'left_table_id' => $base_pkey_col, + 'right_table' => $linker_table, + 'right_table_id' => $linker_fkey_column, ]); + // E.g. feature_synonym.synonym_id $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_synonym_fkey_id' , $linker_fkey_id_term, [ - 'action' => 'store_link', + 'action' => 'store', 'drupal_store' => TRUE, 'chado_table' => $linker_table, 'chado_column' => 'synonym_id', ]); + // E.g. feature_synonym.is_current $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_current', $linker_is_current_term, [ 'action' => 'store', 'chado_table' => $linker_table, @@ -194,6 +200,7 @@ public static function tripalTypes($field_definition) { 'chado_column' => 'is_current', 'empty_value' => TRUE ]); + // E.g. feature_synonym.is_internal $properties[] = new ChadoBoolStoragePropertyType($entity_type_id, self::$id, 'is_internal', $linker_is_internal_term, [ 'action' => 'store', 'chado_table' => $linker_table, @@ -201,6 +208,7 @@ public static function tripalTypes($field_definition) { 'chado_column' => 'is_internal', 'empty_value' => FALSE ]); + // E.g. feature_synonym.pub_id $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'linker_pub_id' , $linker_pub_id_term, [ 'action' => 'store', 'drupal_store' => FALSE, @@ -211,6 +219,7 @@ public static function tripalTypes($field_definition) { // // Properties corresponding to the synonym table. // + // E.g. feature_synonym.synonym_id>synonym.synonym_id : synonym.name as synonym_name $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'name', $syn_name_term, $syn_name_len, [ 'action' => 'join', 'path' => $linker_table . '.synonym_id>synonym.synonym_id', @@ -218,6 +227,7 @@ public static function tripalTypes($field_definition) { 'as' => 'synonym_name', 'drupal_store' => FALSE, ]); + // E.g. feature_synonym.synonym_id>synonym.synonym_id;synonym.type_id>cvterm.cvterm_id : cvterm.name as synonym_type $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'synonym_type', $syn_type_id_term, $syn_type_name_len, [ 'action' => 'join', 'path' => $linker_table . '.synonym_id>synonym.synonym_id;synonym.type_id>cvterm.cvterm_id', From 31c686b8a88275779bcbc7fa25a9cb147f63042f Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Wed, 27 Sep 2023 15:45:12 -0600 Subject: [PATCH 08/10] Fix ID. --- tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php index 316656a9b..e8161dc08 100644 --- a/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php +++ b/tripal_chado/src/Plugin/Field/FieldType/ChadoSynonymDefault.php @@ -16,7 +16,7 @@ * Plugin implementation of Tripal string field type. * * @FieldType( - * id = "chado_feature_synonym_default", + * id = "chado_synonym_default", * label = @Translation("Chado Synonym"), * description = @Translation("A chado syonym"), * default_widget = "chado_synonym_widget_default", From fd99c94c457916f4c51552cdac41f2411f506bdb Mon Sep 17 00:00:00 2001 From: Lacey-Anne Sanderson Date: Wed, 27 Sep 2023 15:45:28 -0600 Subject: [PATCH 09/10] Ensure field is added to all content types it applies to. --- ...l.tripalfield_collection.default_chado.yml | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) diff --git a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml index be4703fc2..82f293f35 100644 --- a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml +++ b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml @@ -1228,6 +1228,33 @@ fields: region: content weight: 90 + - name: mrna_synonym + content_type: mRNA + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + linker_table: feature_synonym + linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: phylotree_name content_type: phylotree label: Name @@ -1548,6 +1575,33 @@ fields: region: content weight: 20 + - name: dna_library_synonym + content_type: dna_library + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: library + linker_table: library_synonym + linker_fkey_column: library_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: genome_assembly_name content_type: genome_assembly label: Name @@ -2353,6 +2407,33 @@ fields: region: content weight: 90 + - name: qtl_synonym + content_type: QTL + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + linker_table: feature_synonym + linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: sequence_variant_name content_type: sequence_variant label: Name @@ -2566,6 +2647,33 @@ fields: region: content weight: 90 + - name: sequence_variant_synonym + content_type: sequence_variant + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + linker_table: feature_synonym + linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: genetic_marker_name content_type: genetic_marker label: Name @@ -2779,6 +2887,33 @@ fields: region: content weight: 90 + - name: genetic_marker_synonym + content_type: genetic_marker + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + linker_table: feature_synonym + linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: phenotypic_marker_name content_type: phenotypic_marker label: Name @@ -2992,6 +3127,33 @@ fields: region: content weight: 90 + - name: phenotypic_marker_synonym + content_type: phenotypic_marker + label: Synonyms + type: chado_synonym_default + description: Alternate names, aliases or synonyms for this record. + cardinality: 0 + required: false + storage_settings: + storage_plugin_id: chado_storage + storage_plugin_settings: + base_table: feature + linker_table: feature_synonym + linker_fkey_column: feature_id + settings: + termIdSpace: schema + termAccession: alternateName + display: + view: + default: + region: content + label: above + weight: 10 + form: + default: + region: content + weight: 10 + - name: germplasm_name content_type: germplasm label: Name From 42cb9193cc42fc8765ac14084dc01e0084e57c6f Mon Sep 17 00:00:00 2001 From: Lacey Sanderson Date: Thu, 28 Sep 2023 16:15:59 -0600 Subject: [PATCH 10/10] Use -1 for unlimited. --- ...tripal.tripalfield_collection.default_chado.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml index 82f293f35..8e3a7f002 100644 --- a/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml +++ b/tripal_chado/config/install/tripal.tripalfield_collection.default_chado.yml @@ -993,7 +993,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -1233,7 +1233,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -1580,7 +1580,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -2412,7 +2412,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -2652,7 +2652,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -2892,7 +2892,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage @@ -3132,7 +3132,7 @@ fields: label: Synonyms type: chado_synonym_default description: Alternate names, aliases or synonyms for this record. - cardinality: 0 + cardinality: -1 required: false storage_settings: storage_plugin_id: chado_storage