|
@@ -1,10 +1,10 @@
|
|
|
<?php
|
|
|
/*
|
|
|
- * There are several ways that sequences can be displayed. They can come from the
|
|
|
+ * There are several ways that sequences can be displayed. They can come from the
|
|
|
* feature.residues column, they can come from an alignment with another feature,
|
|
|
* they can come from a protein sequence that has relationship with this sequence,
|
|
|
* or they can come from sub children (e.g. CDS coding sequences).
|
|
|
- *
|
|
|
+ *
|
|
|
* This template will show all types depending on the data available.
|
|
|
*
|
|
|
*/
|
|
@@ -12,7 +12,7 @@
|
|
|
$feature = $variables['node']->feature;
|
|
|
|
|
|
// number of bases per line in FASTA format
|
|
|
-$num_bases = 50;
|
|
|
+$num_bases = 50;
|
|
|
|
|
|
// 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
|
|
@@ -24,37 +24,37 @@ if(strcmp($feature->type_id->name,'scaffold') !=0 and
|
|
|
strcmp($feature->type_id->name,'pseudomolecule') !=0) {
|
|
|
$feature = chado_expand_var($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) {
|
|
|
+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
|
|
|
-
|
|
|
+
|
|
|
// ADD IN RESIDUES FOR THIS FEATURE
|
|
|
// add in the residues if they are present
|
|
|
if ($residues) {
|
|
|
$list_items[] = '<a href="#residues">' . $feature->type_id->name . ' sequence</a>';
|
|
|
-
|
|
|
+
|
|
|
// format the sequence to break every 50 residues
|
|
|
$sequences_html .= '<a name="residues"></a>';
|
|
|
$sequences_html .= '<div id="residues" class="tripal_feature-sequence-item">';
|
|
|
$sequences_html .= '<p><b>' . $feature->type_id->name . ' sequence</b></p>';
|
|
|
$sequences_html .= '<pre class="tripal_feature-sequence">';
|
|
|
- $sequences_html .= '>' . tripal_get_fasta_defline($feature, '', NULL, '', strlen($feature->residues)) . "\n";
|
|
|
+ $sequences_html .= '>' . tripal_get_fasta_defline($feature, '', NULL, '', strlen($feature->residues)) . "<br>";
|
|
|
$sequences_html .= wordwrap($feature->residues, $num_bases, "<br>", TRUE);
|
|
|
$sequences_html .= '</pre>';
|
|
|
$sequences_html .= '<a href="#sequences-top">back to top</a>';
|
|
|
$sequences_html .= '</div>';
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// ADD IN RELATIONSHIP SEQUENCES (e.g. proteins)
|
|
|
- // see the explanation in the tripal_feature_relationships.tpl.php
|
|
|
+ // 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;
|
|
@@ -64,27 +64,27 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
foreach ($object_rels as $rel_type => $rels){
|
|
|
foreach ($rels as $subject_type => $subjects){
|
|
|
foreach ($subjects as $subject){
|
|
|
-
|
|
|
+
|
|
|
// add in protein sequence if it has residues
|
|
|
if ($rel_type == 'derives from' and $subject_type == 'polypeptide') {
|
|
|
$protein = $subject->record->subject_id;
|
|
|
$protein = chado_expand_var($protein, 'field', 'feature.residues');
|
|
|
-
|
|
|
+
|
|
|
if ($protein->residues) {
|
|
|
$list_items[] = '<a href="#residues">protein sequence</a>';
|
|
|
$sequences_html .= '<a name="protein-' . $protein->feature_id . '"></a>';
|
|
|
$sequences_html .= '<div id="protein-' . $protein->feature_id . '" class="tripal_feature-sequence-item">';
|
|
|
$sequences_html .= '<p><b>protein sequence of ' . $protein->name . '</b></p>';
|
|
|
$sequences_html .= '<pre class="tripal_feature-sequence">';
|
|
|
- $sequences_html .= '>' . tripal_get_fasta_defline($protein, '', NULL, '', strlen($protein->residues)) . "\n";
|
|
|
+ $sequences_html .= '>' . tripal_get_fasta_defline($protein, '', NULL, '', strlen($protein->residues)) . "<br>";
|
|
|
$sequences_html .= wordwrap($protein->residues, $num_bases, "<br>", TRUE);
|
|
|
$sequences_html .= '</pre>';
|
|
|
$sequences_html .= '<a href="#sequences-top">back to top</a>';
|
|
|
$sequences_html .= '</div>';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // If the CDS has sequences then concatenate those. The objects
|
|
|
+
|
|
|
+ // If the CDS has sequences then concatenate those. The objects
|
|
|
// should be returned in order of rank
|
|
|
if ($rel_type == 'part of' and $subject_type == 'CDS') {
|
|
|
$cds = $subject->record->subject_id;
|
|
@@ -94,14 +94,14 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
$coding_seq .= $cds->residues;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// add any other sequences that are related through a relationship
|
|
|
// and that have values in the 'residues' column
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// CODING SEQUENCES FROM RELATIONSHIPS
|
|
|
// add in any CDS sequences.
|
|
|
if ($has_coding_seq) {
|
|
@@ -115,7 +115,7 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
$sequences_html .= '<a href="#sequences-top">back to top</a>';
|
|
|
$sequences_html .= '</div>';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/* ADD IN ALIGNMENT SEQUENCES FOR THIS FEATURE
|
|
|
* For retreiving the sequence from an alignment we would typically make a call to
|
|
|
* chado_expand_var function. For example, to retrieve all
|
|
@@ -127,7 +127,7 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
* Then all of the sequences would need to be retreived from the alignments and
|
|
|
* formatted for display below. However, to simplify this template, this has already
|
|
|
* been done by the tripal_feature module and the sequences are made available in
|
|
|
- * the variable:
|
|
|
+ * the variable:
|
|
|
*
|
|
|
* $feature->featureloc_sequences
|
|
|
*/
|
|
@@ -148,7 +148,7 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
$sequences_html .= '<a href="#sequences-top">back to top</a>';
|
|
|
$sequences_html .= '</div>';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// check to see if this alignment has any CDS. If so, generate a CDS sequence
|
|
|
$cds_sequence = tripal_get_feature_sequences(
|
|
|
array(
|
|
@@ -183,14 +183,14 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
$sequences_html .= '</div>';
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
?>
|
|
|
|
|
|
- <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following sequences are available for this feature:</div>
|
|
|
+ <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following sequences are available for this feature:</div>
|
|
|
<?php
|
|
|
-
|
|
|
+
|
|
|
// 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
|
|
|
+ // 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
|
|
@@ -216,7 +216,7 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
is associated with an mRNA feature and protein sequences will appear on the mRNA page.</li>
|
|
|
<li>This feature has one or more CDS features associated via the "feature_relationship" table of Chado with a
|
|
|
relationship of type "part of". If the CDS features have residues then those will be concatenated
|
|
|
- and presented as a sequence. Typically, CDSs are associated with an mRNA feature and CDS sequences
|
|
|
+ and presented as a sequence. Typically, CDSs are associated with an mRNA feature and CDS sequences
|
|
|
will appear on the mRNA page.</li>
|
|
|
<li>This feature is aligned to another feature (e.g. scaffold, or chromosome) and this feature has
|
|
|
one or more CDS features associated. The CDS sequenes underlying the alignment will be
|
|
@@ -224,7 +224,7 @@ if ($residues or count($featureloc_sequences) > 0) {
|
|
|
</ul>
|
|
|
</p>';
|
|
|
print tripal_set_message($message, TRIPAL_INFO, array('return_html' => 1));
|
|
|
-
|
|
|
+
|
|
|
// now print the sequences
|
|
|
print $sequences_html;
|
|
|
}
|