Browse Source

Updates to the feature template

spficklin 14 years ago
parent
commit
610ca29f50
2 changed files with 97 additions and 18 deletions
  1. 51 0
      theme_tripal/css/tripal_feature.css
  2. 46 18
      theme_tripal/node-chado_feature.tpl.php

+ 51 - 0
theme_tripal/css/tripal_feature.css

@@ -0,0 +1,51 @@
+/* styles for the sequence blocks on the feature page */
+pre#tripal_feature-sequence {
+   background-color: #FFFFFF;
+   border: 0;
+   margin: 0;
+   margin-top: 10px;
+   padding: 0;
+}
+
+div#tripal_feature-sequence-legend {
+   padding: 10px;
+   margin: 10px;
+}
+/* styles for cvterm types in sequences */
+div#tripal_feature-sequence-legend span {
+   margin: 5px;
+   padding: 10px;
+}
+span.tripal_feature-sequence-five_prime_UTR {
+   background-color: #99FF99;
+}
+
+span.tripal_feature-sequence-three_prime_UTR {
+   background-color: #FF9999;
+}
+
+span.tripal_feature-sequence-CDS {
+   background-color: #FFFF99;
+}
+
+span.tripal_feature-sequence-mRNA {
+   background-color: #FFFF99;
+}
+/* information tables on the feature pages */
+table.tripal_feature-relationships-subject-table th {
+   background-color: #EEEEEE;
+   text-align: left;
+}
+table.tripal_feature-relationships-object-table th {
+   background-color: #EEEEEE;
+   text-align: left;
+}
+table.tripal_feature-locations-table th {
+   background-color: #EEEEEE;
+   text-align: left;
+}
+table.tripal_feature-references-table th {
+   background-color: #EEEEEE;
+   text-align: left;
+
+}

+ 46 - 18
theme_tripal/node-chado_feature.tpl.php

@@ -93,12 +93,13 @@
      <!-- Control link for the expandableBoxes -->
        <br><a id="tripal_expandableBox_toggle_button" onClick="toggleExpandableBoxes()">[-] Collapse All</a><br><br>
      <!-- End of Control link for the expandableBoxes -->
+
      <!-- Start of sequences -->
       <div id="feature-sequence" class="tripal_feature-info-box">
       <div class="tripal_expandableBox"><h3>Sequence</h3></div>
       <div class="tripal_expandableBoxContent">
         <?php print $feature->cvname; ?> sequence        
-        <pre><?php 
+        <pre id="tripal_feature-sequence"><?php 
            if($feature->residues){
               print ereg_replace("(.{100})","\\1<br>",$feature->residues); 
            } else {
@@ -115,7 +116,7 @@
       <div id="feature-references" class="tripal_feature-info-box">
       <div class="tripal_expandableBox"><h3>References</h3></div>
       <div class="tripal_expandableBoxContent">
-      <table>
+      <table class="tripal_feature-references-table">
          <tr>
             <th>Dababase</th>
             <th>Accession</th>
@@ -137,9 +138,9 @@
          if(count($featurelocs) > 0){
       ?>
       <div id="feature-featurelocs" class="tripal_feature-info-box">
-      <div class="tripal_expandableBox"><h3>Locations of <?php print $feature->featurename;?></h3></div>
+      <div class="tripal_expandableBox"><h3>Locations</h3></div>
       <div class="tripal_expandableBoxContent">
-      <table>
+      <table class="tripal_feature-locations-table">
          <tr>
             <th>Feature</th>
             <th>Type</th>
@@ -189,13 +190,14 @@
      <!-- End of theme_tripal_feature_feature_references -->
      <!-- Start of theme_tripal_feature_feature_relationships -->
        <?php
+         print "<div id=\"feature-srelationships\" class=\"tripal_feature-info-box\">";
+         print "<div class=\"tripal_expandableBox\"><h3>Relationships</h3></div>";
+         print "<div class=\"tripal_expandableBoxContent\">";
          $srelationships = $node->subject_relationships;
         if(count($srelationships) > 0){
-            print "<div id=\"feature-srelationships\" class=\"tripal_feature-info-box\">";
-            print "<div class=\"tripal_expandableBox\"><h3>Features that have $feature->featurename as a relationship</h3></div>";
-            print "<div class=\"tripal_expandableBoxContent\">";
+            print "<b>Subject Relationships</b><br>";
             print "
-            <table>
+            <table class=\"tripal_feature-relationships-subject-table\">
                <tr>
                   <th>Relationship</th>
                   <th>Feature</th>
@@ -214,21 +216,18 @@
                print "</td>";
                print "<td>$result->object_type</td>";
             }
-            print "</table>";
-            print "</div></div>";
+            print "</table><br>";
          } 
        ?>
      <!-- End of theme_tripal_feature_feature_relationships -->
      <!-- Start of theme_tripal_feature_feature_relationships -->
        <?php
          $orelationships = $node->object_relationships;
-         if(count($orelationships) > 0){
-            print "<div id=\"feature-orelationships\" class=\"tripal_feature-info-box\">";
-            print "<div class=\"tripal_expandableBox\"><h3>Features with a relationship to $feature->featurename</h3></div>";
-            print "<div class=\"tripal_expandableBoxContent\">";      
-
+         $other_seqs = array();
+         if(count($orelationships) > 0){    
+            print "<b>Object Relationships</b><br>";
             print "
-            <table>
+            <table class=\"tripal_feature-relationships-object-table\">
                <tr>
                   <th>Feature</th>
                   <th>Type</th>
@@ -251,12 +250,41 @@
                print "</td>";
                print "<td>$result->subject_type</td>";
                print "<td><b>$result->rel_type</b></td>";
-               print "<td>$result->src_name ($result->src_cvname): $result->fmin $result->fmax</td>";
+               if($result->src_name){
+                  print "<td>$result->src_name ($result->src_cvname):$result->fmin $result->fmax</td>";
+               } else {
+                  print "<td></td>";
+               }
                print "</tr>";
+               // anything with a src_name does not have a location on a 
+               // reference sequence, so let's keep track of those and print
+               // the sequences later.  Those that are located elsewhere
+               // will get printed separately.
+               if(!$result->src_name){
+                  $other_seqs[]=$result;
+               }
             }
             print "</table>";
+ 
+            // print the sequences for those that are located on a references
+            // sequence
+            $rel_info = $node->relationship_object_info;
+            foreach($rel_info as $index => $info){
+              if($info->source){
+                 print "<br><b>Sequence Context:</b><br>";
+                 print "$info->source:$info->fmin..$info->fmax<br>"; 
+                 print $info->residues;
+              }       
+            }
+            // now print any remaining sequences
+            foreach($other_seqs as $i => $rel){
+               print "<br><b>$rel->subject_type sequence</b>";
+               print "<pre id=\"tripal_feature-sequence\">";
+               print ereg_replace("(.{100})","\\1<br>",$rel->subject_residues); 
+               print "</pre>";
+            }
 
-            print "</div></div>";
+           print "</div></div>";
          } 
        ?>