function tripal_feature_preprocess_tripal_feature_sequence

2.x tripal_feature.theme.inc tripal_feature_preprocess_tripal_feature_sequence(&$variables)
3.x tripal_feature.theme.inc tripal_feature_preprocess_tripal_feature_sequence(&$variables)

Related topics

File

tripal_feature/theme/tripal_feature.theme.inc, line 7

Code

function tripal_feature_preprocess_tripal_feature_sequence(&$variables) {
  // we want to provide a new variable that contains the matched features.
  $feature = $variables['node']->feature;

  // get the featureloc src features
  $options = array(
    'return_array' => 1,
    'include_fk' => array(
      'srcfeature_id' => array(
        'type_id' => 1
      ),
    ),
  );

  $feature = chado_expand_var($feature, 'table', 'featureloc', $options);

  // because there are two foriegn keys in the featureloc table with the feature table
  // we have to access the records for each by specifying the field name after the table name:
  $ffeaturelocs = $feature->featureloc->feature_id;

  // now extract the sequences
  $featureloc_sequences = tripal_feature_load_featureloc_sequences($feature->feature_id, $ffeaturelocs);
  $feature->featureloc_sequences = $featureloc_sequences;

  // if this feature has associated protein sequences (or others via relationships
  // then we want to make sure the relationships are added so that we can
  // show the protein sequences
  if (!property_exists($feature, 'all_relationships')) {
    $feature->all_relationships = tripal_feature_get_feature_relationships($feature);
  }
}