featureloc_sequences * */ $feature = $variables['node']->feature; // we don't want to get the sequence for traditionally large types. They are // too big, bog down the web browser, take longer to load and it's not // reasonable to print them on a page. $residues =''; if(strcmp($feature->type_id->name,'scaffold') !=0 and strcmp($feature->type_id->name,'chromosome') !=0 and strcmp($feature->type_id->name,'supercontig') !=0 and strcmp($feature->type_id->name,'pseudomolecule') !=0) { $feature = tripal_core_expand_chado_vars($feature,'field','feature.residues'); $residues = $feature->residues; } // get the sequence derived from alignments $feature = $variables['node']->feature; $featureloc_sequences = $feature->featureloc_sequences; if ($residues or count($featureloc_sequences) > 0) { $sequences_html = ''; // a variable for holding all sequences HTML text $list_items = array(); // a list to be used for theming of content on this page ?>
The following sequences are available for this feature:
Current ' . $feature->type_id->name . ' sequence'; // format the sequence to break every 50 residues $sequences_html .= ''; $sequences_html .= '
'; $sequences_html .= '

Current ' . $feature->type_id->name . ' sequence

'; $sequences_html .= '
';
    $sequences_html .= '>' . tripal_get_fasta_defline($feature) . "\n";
    $sequences_html .= preg_replace("/(.{50})/","\\1
",$feature->residues); $sequences_html .= '
'; $sequences_html .= 'back to top'; $sequences_html .= '
'; } // ADD IN RELATIONSHIP SEQUENCES (e.g. proteins) // see the explanation in the tripal_feature_relationships.tpl.php // template for how the 'all_relationships' is provided. It is this // variable that we use to get the proteins. $all_relationships = $feature->all_relationships; $object_rels = $all_relationships['object']; foreach ($object_rels as $rel_type => $rels){ foreach ($rels as $subject_type => $subjects){ foreach ($subjects as $subject){ if ($rel_type == 'derives from' and $subject_type == 'polypeptide') { $protein = $subject->record->subject_id; $protein = chado_expand_var($protein, 'field', 'feature.residues'); $list_items[] = 'Protein sequence of ' . $protein->name . ''; $sequences_html .= ''; $sequences_html .= '
'; $sequences_html .= '

Protein sequence of ' . $protein->name . '

'; $sequences_html .= '
';
          $sequences_html .= '>' . tripal_get_fasta_defline($protein) . "\n";
          $sequences_html .= preg_replace("/(.{50})/","\\1
", $protein->residues); $sequences_html .= '
'; $sequences_html .= 'back to top'; $sequences_html .= '
'; } // add any other sequences by by relationship in a similar way } } } // ADD IN ALIGNMENT SEQUENCES FOR THIS FEATURE // show the alignment sequences first as they are colored with child features if(count($featureloc_sequences) > 0){ foreach($featureloc_sequences as $src => $attrs){ // the $attrs array has the following keys // * src: a unique identifier combining the feature id with the cvterm id // * type: the type of sequence (e.g. mRNA, etc) // * location: the alignment location // * defline: the definition line // * formatted_seq: the formatted sequences $list_items[] = 'Alignment at ' . $attrs['location']; $sequences_html .= ''; $sequences_html .= '
'; $sequences_html .= '

Alignment at ' . $attrs['location'] .'

'; $sequences_html .= $attrs['formatted_seq']; $sequences_html .= 'back to top'; $sequences_html .= '
'; } } // first add a list at the top of the page that can be formatted as the // user desires. We use the theme_item_list function of Drupal to create // the list rather than hard-code the HTML here. Instructions for how // to create the list can be found here: // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_item_list/7 print ''; print theme_item_list(array( 'items' => $list_items, 'title' => '', 'type' => 'ul', 'attributes' => array(), )); // now print the sequences print $sequences_html; }