|
@@ -550,6 +550,19 @@ function tripal_chado_field_info() {
|
|
|
'active' => TRUE
|
|
|
),
|
|
|
),
|
|
|
+
|
|
|
+ 'synonym' => array(
|
|
|
+ 'label' => t('Synonyms'),
|
|
|
+ 'description' => t('Adds an alternative name (synonym or alias) to this record..'),
|
|
|
+ 'default_widget' => 'tripal_chado_synonym_widget',
|
|
|
+ 'default_formatter' => 'tripal_chado_synonym_formatter',
|
|
|
+ 'settings' => array(),
|
|
|
+ 'storage' => array(
|
|
|
+ 'type' => 'field_chado_storage',
|
|
|
+ 'module' => 'tripal_chado',
|
|
|
+ 'active' => TRUE
|
|
|
+ ),
|
|
|
+ ),
|
|
|
);
|
|
|
return $fields;
|
|
|
}
|
|
@@ -609,6 +622,10 @@ function tripal_chado_field_widget_info() {
|
|
|
'label' => t('Property'),
|
|
|
'field types' => array('kvproperty'),
|
|
|
),
|
|
|
+ 'tripal_chado_synonym_widget' => array(
|
|
|
+ 'label' => t('Synonyms'),
|
|
|
+ 'field types' => array('synonym'),
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
/**
|
|
@@ -656,6 +673,10 @@ function tripal_chado_field_formatter_info() {
|
|
|
'label' => t('Property'),
|
|
|
'field types' => array('kvproperty')
|
|
|
),
|
|
|
+ 'tripal_chado_synonym_formatter' => array(
|
|
|
+ 'label' => t('Synonyms'),
|
|
|
+ 'field types' => array('synonym')
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -750,6 +771,11 @@ function tripal_chado_field_formatter_view($entity_type, $entity, $field,
|
|
|
tripal_chado_kvproperty_formatter($element, $entity_type, $entity, $field,
|
|
|
$instance, $langcode, $items, $display);
|
|
|
break;
|
|
|
+ case 'tripal_chado_synonym_formatter':
|
|
|
+ module_load_include('inc', 'tripal_chado', 'includes/fields/synonym');
|
|
|
+ tripal_chado_synonym_formatter($element, $entity_type, $entity, $field,
|
|
|
+ $instance, $langcode, $items, $display);
|
|
|
+ break;
|
|
|
}
|
|
|
return $element;
|
|
|
}
|
|
@@ -814,6 +840,11 @@ function tripal_chado_field_widget_form(&$form, &$form_state, $field,
|
|
|
module_load_include('inc', 'tripal_chado', 'includes/fields/kvproperty');
|
|
|
tripal_chado_kvproperty_widget($widget, $form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
|
|
|
break;
|
|
|
+ case 'tripal_chado_synonym_widget':
|
|
|
+ form_load_include($form_state, 'inc', 'tripal_chado', 'includes/fields/synonym');
|
|
|
+ module_load_include('inc', 'tripal_chado', 'includes/fields/synonym');
|
|
|
+ tripal_chado_synonym_widget($widget, $form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
|
|
|
+ break;
|
|
|
}
|
|
|
return $widget;
|
|
|
}
|
|
@@ -961,6 +992,10 @@ function tripal_chado_theme($existing, $type, $theme, $path) {
|
|
|
'render element' => 'element',
|
|
|
'file' => 'includes/fields/cvterm.inc',
|
|
|
),
|
|
|
+ 'tripal_chado_synonym_widget' => array(
|
|
|
+ 'render element' => 'element',
|
|
|
+ 'file' => 'includes/fields/synonym.inc',
|
|
|
+ ),
|
|
|
'tripal_chado_kvproperty_addr_widget' => array(
|
|
|
'render element' => 'element',
|
|
|
'file' => 'includes/fields/dbxref_id.inc',
|
|
@@ -1097,6 +1132,18 @@ function tripal_chado_add_bundle_fields($entity_type, $bundle, $term) {
|
|
|
if (chado_table_exists($cvterm_table)) {
|
|
|
tripal_chado_add_bundle_cvterm_class_adder_field($entity_type, $bundle_name, $cvterm_table, $bundle_data['data_table']);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ ////
|
|
|
+ //
|
|
|
+ // Synonym table fields.
|
|
|
+ //
|
|
|
+ // Check to see if there are any cvterm tables with FKs to this
|
|
|
+ // base table. If so, add the fields for that type of table.
|
|
|
+ $syn_table = $bundle_data['data_table'] . '_synonym';
|
|
|
+ if (chado_table_exists($cvterm_table)) {
|
|
|
+ tripal_chado_add_bundle_synonym_field($entity_type, $bundle_name, $syn_table, $bundle_data['data_table']);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1150,6 +1197,51 @@ function tripal_chado_add_bundle_dbxref_field($entity_type_name, $bundle_name, $
|
|
|
}
|
|
|
tripal_add_bundle_field($field_name, $field_info, $entity_type_name, $bundle_name);
|
|
|
}
|
|
|
+/**
|
|
|
+ * Adds the fields for managing xrefs that are stored in a [base]_dbxref table.
|
|
|
+ *
|
|
|
+ * @param $entity_type
|
|
|
+ * @param $bundle_name
|
|
|
+ * @param $base_table
|
|
|
+ * @param $dbxref_table
|
|
|
+ */
|
|
|
+function tripal_chado_add_bundle_synonym_field($entity_type_name, $bundle_name, $syn_table, $base_table) {
|
|
|
+ // We already have a dbxref_id field.
|
|
|
+ $field_name = $syn_table;
|
|
|
+ $schema = chado_get_schema($syn_table);
|
|
|
+ $pkey = $schema['primary key'][0];
|
|
|
+
|
|
|
+ // Initialize the field array.
|
|
|
+ $field_info = array(
|
|
|
+ 'field_type' => 'synonym',
|
|
|
+ 'widget_type' => 'tripal_fields_synonym_widget',
|
|
|
+ 'widget_settings' => array('display_label' => 1),
|
|
|
+ 'description' => '',
|
|
|
+ 'label' => 'Synonyms',
|
|
|
+ 'is_required' => 0,
|
|
|
+ 'cardinality' => FIELD_CARDINALITY_UNLIMITED,
|
|
|
+ 'storage' => 'field_chado_storage',
|
|
|
+ 'field_settings' => array(
|
|
|
+ // The Chado table that this field maps to.
|
|
|
+ 'chado_table' => $syn_table,
|
|
|
+ // The column in the chado table that this field maps to.
|
|
|
+ 'chado_column' => $pkey,
|
|
|
+ // The base table that this field is connected to.
|
|
|
+ 'base_table' => $base_table,
|
|
|
+ 'semantic_web' => array(
|
|
|
+ // The type is the term from a vocabulary that desribes this field..
|
|
|
+ 'type' => '',
|
|
|
+ // The namepsace for the vocabulary (e.g. 'foaf').
|
|
|
+ 'ns' => '',
|
|
|
+ // The URL for the namespace. It must be that the type can be
|
|
|
+ // appended to the URL.
|
|
|
+ 'nsurl' => '',
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+
|
|
|
+ tripal_add_bundle_field($field_name, $field_info, $entity_type_name, $bundle_name);
|
|
|
+}
|
|
|
/**
|
|
|
* Adds the fields for managing properties that are stored in a prop table.
|
|
|
*
|
|
@@ -1420,7 +1512,7 @@ function tripal_chado_get_table_column_field_default($table_name, $schema, $colu
|
|
|
$field['field_type'] = 'md5checksum';
|
|
|
$field['widget_type'] = 'tripal_chado_md5checksum_checkbox_widget';
|
|
|
$field['label'] = 'MD5 Checksum';
|
|
|
- $field['description'] = 'Generating MD5 checksum for the sequence.';
|
|
|
+ $field['description'] = 'Generate an MD5 checksum for the sequence.';
|
|
|
}
|
|
|
elseif ($field['field_settings']['chado_table'] == 'feature' and $field['field_settings']['chado_column'] == 'seqlen') {
|
|
|
$field['field_type'] = 'seqlen';
|