123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- class so__cds extends ChadoField {
-
-
-
-
-
-
-
-
- public static $default_label = 'Coding Sequence';
-
- public static $description = 'A contiguous sequence which begins with, and includes, a start codon and ends with, and includes, a stop codon.';
-
-
-
-
-
-
-
- public static $default_instance_settings = array(
-
- 'term_vocabulary' => 'SO',
-
- 'term_name' => 'CDS',
-
- 'term_accession' => '0000316',
-
-
-
- 'term_fixed' => FALSE,
- );
-
- public static $default_widget = 'so__cds_widget';
-
- public static $default_formatter = 'so__cds_formatter';
-
- public function elementInfo() {
- $field_term = $this->getFieldTermID();
- return array(
- $field_term => array(
- 'sortable' => FALSE,
- 'searchable' => FALSE,
- 'type' => 'xs:string',
- 'readonly' => TRUE,
- ),
- );
- }
-
- public function load($entity) {
- $field_name = $this->field['field_name'];
- $feature = $entity->chado_record;
- $num_seqs = 0;
-
- $entity->{$field_name}['und'][0] = array(
- 'value' => '',
- );
- $options = array(
- 'return_array' => TRUE,
- 'order_by' => array('rank' => 'ASC'),
- );
- $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
- $featurelocs = $feature->featureloc->feature_id;
- foreach($featurelocs as $featureloc){
-
- $cds_sequence = tripal_get_feature_sequences(
- array(
- 'feature_id' => $feature->feature_id,
- 'parent_id' => $featureloc->srcfeature_id->feature_id,
- 'name' => $feature->name,
- 'featureloc_id' => $featureloc->featureloc_id,
- ),
- array(
-
-
- 'derive_from_parent' => 1,
-
- 'aggregate' => 1,
-
- 'sub_feature_types' => array('CDS'),
- 'is_html' => 0
- )
- );
- if (count($cds_sequence) > 0) {
-
-
-
-
- if ($cds_sequence[0]['residues']) {
- $entity->{$field_name}['und'][$num_seqs++]['value'] = $cds_sequence[0]['residues'];
- }
- }
- }
- }
- }
|