123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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 = [
-
- '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 [
- $field_term => [
- '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] = [
- 'value' => '',
- ];
-
-
-
-
- $featurelocs_sql = "
- SELECT FL.featureloc_id, FL.srcfeature_id
- FROM {featureloc} FL
- WHERE FL.feature_id = :feature_id
- ORDER BY rank ASC
- ";
- $aligned = chado_query($featurelocs_sql, [':feature_id' => $feature->feature_id]);
- $index = 0;
- while ($featureloc = $aligned->fetchObject()) {
-
- $cds_sequence = chado_get_feature_sequences(
- [
- 'feature_id' => $feature->feature_id,
- 'parent_id' => $featureloc->srcfeature_id,
- 'name' => $feature->name,
- 'featureloc_id' => $featureloc->featureloc_id,
- ],
- [
-
-
- 'derive_from_parent' => 1,
-
- 'aggregate' => 1,
-
- 'sub_feature_types' => ['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'],
-
-
-
- 'chado-featureprop__featureprop_id' => NULL,
- 'chado-featureprop__feature_id' => NULL,
- 'chado-featureprop__value' => NULL,
- 'chado-featureprop__type_id' => NULL,
- 'chado-featureprop__rank' => NULL
- ];
- }
- }
- }
- }
- }
|