class so__cds

Hierarchy

Expanded class hierarchy of so__cds

2 string references to 'so__cds'
so__cds_formatter.inc in tripal_chado/includes/TripalFields/so__cds/so__cds_formatter.inc
so__cds_widget.inc in tripal_chado/includes/TripalFields/so__cds/so__cds_widget.inc

File

tripal_chado/includes/TripalFields/so__cds/so__cds.inc, line 3

View source
class so__cds extends ChadoField {


  // --------------------------------------------------------------------------
  //                     EDITABLE STATIC CONSTANTS
  //
  // The following constants SHOULD be set for each descendent class.  They are
  // used by the static functions to provide information to Drupal about
  // the field and it's default widget and formatter.
  // --------------------------------------------------------------------------

  // The default lable for this field.
  public static $default_label = 'Coding Sequence';

  // The default description for this field.
  public static $description = 'A contiguous sequence which begins with, and includes, a start codon and ends with, and includes, a stop codon.';

  // Provide a list of instance specific settings. These can be access within
  // the instanceSettingsForm.  When the instanceSettingsForm is submitted
  // then Drupal with automatically change these settings for the instnace.
  // It is recommended to put settings at the instance level whenever possible.
  // If you override this variable in a child class be sure to replicate the
  // term_name, term_vocab, term_accession and term_fixed keys as these are
  // required for all TripalFields.
  public static $default_instance_settings = array(
    // The short name for the vocabulary (e.g. shcema, SO, GO, PATO, etc.).
    'term_vocabulary' => 'SO',
    // The name of the term.
    'term_name' => 'CDS',
    // The unique ID (i.e. accession) of the term.
    'term_accession' => '0000316',
    // Set to TRUE if the site admin is allowed to change the term
    // type. This will create form elements when editing the field instance
    // to allow the site admin to change the term settings above.
    'term_fixed' => FALSE,
  );

  // The default widget for this field.
  public static $default_widget = 'so__cds_widget';

  // The default formatter for this field.
  public static $default_formatter = 'so__cds_formatter';


  /**
   * @see TripalField::elementInfo()
   */
  public function elementInfo() {
    $field_term = $this->getFieldTermID();
    return array(
      $field_term => array(
        'sortable' => FALSE,
        'searchable' => FALSE,
        'type' => 'xs:string',
        'readonly' => TRUE,
      ),
    );
  }

  /**
   * @see TripalField::load()
   */
  public function load($entity) {
    $field_name = $this->field['field_name'];
    $feature = $entity->chado_record;
    $num_seqs = 0;

    // Set some defauls for the empty record
    $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) {
      // Generate a CDS sequence if one exsits for this feature alignment.
      $cds_sequence = chado_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(
        // CDS are in parent-child relationships so we want to use the
        // sequence from the parent
        'derive_from_parent' => 1,
        // we want to combine all CDS for this feature into a single sequence
        'aggregate' => 1,
        // we're looking for CDS features
        'sub_feature_types' => array('CDS'),
        'is_html' => 0
      )
      );

      if (count($cds_sequence) > 0) {
        // the chado_get_feature_sequences() function can return multiple sequences
        // if a feature is aligned to multiple places. In the case of CDSs we expect
        // that one mRNA is only aligned to a single location on the assembly so we
        // can access the CDS sequence with index 0.
        if ($cds_sequence[0]['residues']) {
          $entity->{$field_name}['und'][$num_seqs++]['value'] = $cds_sequence[0]['residues'];
        }
      }
    }
  }
}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
ChadoField::$default_description public static property Overrides TripalField::$default_description
ChadoField::$default_settings public static property Overrides TripalField::$default_settings
ChadoField::$download_formatters public static property Overrides TripalField::$download_formatters
ChadoField::$module public static property Overrides TripalField::$module
ChadoField::instanceSettingsForm public function Overrides TripalField::instanceSettingsForm
ChadoField::query public function In addition to the rules to follow for the TripalField::query function these should also be followed for the ChadoField::query implementation. Overrides TripalField::query
ChadoField::queryJoinOnce protected function A convient way to join a table to a query without duplicates.
ChadoField::queryOrder public function Overrides TripalField::queryOrder
so__cds::$default_formatter public static property Overrides TripalField::$default_formatter
so__cds::$default_instance_settings public static property Overrides ChadoField::$default_instance_settings
so__cds::$default_label public static property Overrides ChadoField::$default_label
so__cds::$default_widget public static property Overrides TripalField::$default_widget
so__cds::$description public static property
so__cds::elementInfo public function Overrides TripalField::elementInfo
so__cds::load public function Overrides TripalField::load
TripalField::$field protected property
TripalField::$instance protected property
TripalField::$no_data public static property
TripalField::$no_ui public static property
TripalField::$term protected property
TripalField::createInstance public function After a field instance is created the following function is run.
TripalField::getField public function
TripalField::getFieldName public function Retrives the name of this field.
TripalField::getFieldTerm public function
TripalField::getFieldTermID public function
TripalField::getInstance public function
TripalField::getPagerElementID protected function When constructing a pager for use by a field, all pagers must have a unique ID
TripalField::info public static function Provides default information about this field type
TripalField::instanceSettingsFormValidate public function Provides validation of the instance settings form.
TripalField::settingsForm public function Provides a form for the 'Field Settings' of the field management page.
TripalField::settingsFormValidate public function _state
TripalField::validate public function Perform validation of the field regardless how it is updated.
TripalField::viewsData public function Describes this field to Views.
TripalField::webServicesData public function Describes this field to Tripal web services.
TripalField::_addViewsDataElement protected function
TripalField::_addWebServiceElement protected function
TripalField::__construct public function Instantiates a new TripalField object.