123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <?php
- class go__gene_expression extends TripalField {
-
-
-
-
-
-
-
-
-
-
-
-
- public static $term = 'GO:0010467';
-
- public static $label = 'Gene expression';
-
- public static $description = 'The process in which a gene\'s sequence is converted into a
- mature gene product or products (proteins or RNA). This includes the production of an
- RNA transcript as well as any processing to produce a mature RNA product or an
- mRNA (for protein-coding genes) and the translation of that mRNA into protein.
- Protein maturation is included when required to form an active form of a product from
- an inactive precursor form.';
-
-
-
- public static $settings = array(
- 'chado_table' => '',
- 'chado_column' => '',
- 'base_table' => '',
- );
-
-
-
-
- public static $instance_settings = array();
-
-
- public static $storage = 'tripal_no_storage';
-
- public static $default_widget = 'go__gene_expression_widget';
-
- public static $default_formatter = 'go__gene_expression_formatter';
-
-
-
-
-
- protected $field;
-
-
-
- protected $instance;
-
- public function validate($entity_type, $entity, $field, $items, &$errors) {
- }
-
- public function load($entity, $details = array()) {
- $record = $details['record'];
-
- $field_name = $this->field['field_name'];
- $field_type = $this->field['type'];
- $field_table = $this->field['settings']['chado_table'];
- $field_column = $this->field['settings']['chado_column'];
-
-
- $schema = chado_get_schema($field_table);
- $base_table = $details['record']->tablename;
- $pkey = $schema['primary key'][0];
- $fkey_lcolumn = key($schema['foreign keys'][$base_table]['columns']);
- $fkey_rcolumn = $schema['foreign keys'][$base_table]['columns'][$fkey_lcolumn];
-
-
- $entity->{$field_name}['und'][0] = array(
- 'value' => array(),
- );
-
- $linker_table = $base_table . '_expression';
- $options = array(
- 'return_array' => 1,
- );
- $record = chado_expand_var($record, 'table', $linker_table, $options);
- $exp_linkers = $record->$linker_table;
- if ($exp_linkers) {
- foreach ($exp_linkers as $i => $exp_linker) {
-
-
- $expression = $exp_linker->expression_id;
- $expression = chado_expand_var($expression, 'field', 'expression.uniquename', $options);
-
-
-
- $entity->{$field_name}['und'][$i]['value'] = array(
- 'name' => $expression->uniquename,
- 'description' => $expression->description,
-
- );
-
-
- $pub = $exp_linker->pub_id;
- if ($pub->uniquename != 'null') {
- $pub_details = tripal_get_minimal_pub_info($pub);
-
- $entity->{$field_name}['und'][$i]['value']['publication'] = $pub_details;
- $entity->{$field_name}['und'][$i]['value']['publication']['type'] = $pub->type_id->name;
- if (property_exists($pub, 'entity_id')) {
- $entity->{$field_name}['und'][$i]['publication'][0]['value']['entity'] = 'TripalEntity:' . $pub->entity_id;
- }
- }
-
-
- $linkerprop_table = $linker_table . 'prop';
- if (db_table_exists('chado.' . $linkerprop_table)) {
- $exp_linker = chado_expand_var($exp_linker, 'table', $linkerprop_table, $options);
- $exp_linkerprops = $exp_linker->feature_expressionprop;
- if ($exp_linkerprops) {
- foreach ($exp_linkerprops AS $linkerprop) {
- $entity->{$field_name}['und'][$i]['value'][$linkerprop->type_id->name] = $linkerprop->value;
- }
- }
- }
-
-
-
- $entity->{$field_name}['und'][$i][$linker_table . '__expression_id'] = $expression->expression_id;
- $entity->{$field_name}['und'][$i][$linker_table . '__uniquename'] = $expression->uniquename;
-
- $entity->{$field_name}['und'][$i][$linker_table . '__description'] = $expression->description;
-
- }
- }
- }
-
- public function settingsForm($has_data) {
- }
-
- public function settingsFormValidate($form, &$form_state) {
- }
-
- public function instanceSettingsForm() {
- }
-
- public function instanceSettingsFormValidate($form, &$form_state) {
- }
- }
|