node-chado_feature.tpl.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <?php if ($picture) {
  2. print $picture;
  3. $feature = $node->feature;
  4. $accession = $node->accession;
  5. $organism = $node->organism;
  6. }?>
  7. <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
  8. <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
  9. <?php global $base_url;
  10. if ($sticky) { print '<img src="'.base_path(). drupal_get_path('theme','sanqreal').'/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
  11. </h2><?php }; ?>
  12. <?php if (!$teaser): ?>
  13. <?php if ($submitted): ?>
  14. <div class="metanode"><p><?php print t('') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p></div>
  15. <?php endif; ?>
  16. <!-- theme_tripal_feature_feature_id -->
  17. <!--<div id="feature_notice"><img src="sites/all/modules/tripal_analysis_blast/images/info-128x128.png"><br><i>Feature information and annotations have moved. See below</i></div>-->
  18. <div id="feature-view">
  19. <?php
  20. if($feature->is_obsolete == 't'){
  21. drupal_set_message(t('This feature is obsolete and no longer used in analysis, but is here for reference.'));
  22. }?>
  23. <table class="tripal_table_vert">
  24. <tr><th>Name</th><td><?php print $feature->featurename; ?></td></tr>
  25. <tr><th nowrap>Unique Name</th><td><?php print $feature->uniquename; ?></td></tr>
  26. <tr><th>Internal ID</th><td><?php print $accession; ?></td></tr>
  27. <tr><th>Length</th><td><?php print $feature->seqlen ?></td></tr>
  28. <tr><th>Type</th><td><?php print $feature->cvname; ?></td>
  29. </tr>
  30. <tr><th>Organism</th><td>
  31. <?php
  32. if ($node->org_nid) {
  33. print"<a href=\"". url("node/$node->org_nid") ."\">$organism->genus $organism->species ($organism->common_name)</a>";
  34. } else {
  35. print"$organism->genus $organism->species ($organism->common_name)";
  36. }
  37. ?>
  38. </td>
  39. </tr>
  40. <!-- Add library information which this feature belongs to-->
  41. <?php if ($node->lib_additions) { ?>
  42. <tr><th>Library</th><td>
  43. <?php
  44. $libraries = $node->lib_additions;
  45. foreach ($libraries as $lib_url => $lib_name) {
  46. // Check if library exists as a node in drupal
  47. if ($lib_url) {
  48. ?>
  49. <a href="<?php print $lib_url?>"><?php print $lib_name?></a><BR>
  50. <?php
  51. } else {
  52. print $lib_name;
  53. }
  54. }
  55. ?>
  56. </td></tr>
  57. <?php } ?>
  58. <!-- End of library addition -->
  59. <!-- theme_tripal_feature_feature_synonyms -->
  60. <?php
  61. $synonyms = $node->synonyms;
  62. if(count($synonyms) > 0){
  63. ?>
  64. <tr><th>Synonyms</th><td>
  65. <?php
  66. // iterate through each synonym
  67. if (is_array($synonyms)) {
  68. foreach ($synonyms as $result){
  69. print $result->name."<br>";
  70. }
  71. } else {
  72. print $synonyms;
  73. }
  74. ?>
  75. </td></tr>
  76. <?php } ?>
  77. <!-- End of theme_tripal_feature_feature_synonyms -->
  78. </table>
  79. </div>
  80. <!-- End of theme_tripal_feature_feature_id -->
  81. <?php endif; ?>
  82. <div class="content">
  83. <?php if (!$teaser): ?>
  84. <!-- Control link for the expandableBoxes -->
  85. <br><a id="tripal_expandableBox_toggle_button" onClick="toggleExpandableBoxes()">[-] Collapse All</a><br><br>
  86. <!-- End of Control link for the expandableBoxes -->
  87. <!-- Start of sequences -->
  88. <div id="feature-sequence" class="tripal_feature-info-box">
  89. <div class="tripal_expandableBox"><h3>Sequence</h3></div>
  90. <div class="tripal_expandableBoxContent">
  91. <?php print $feature->cvname; ?> sequence
  92. <pre id="tripal_feature-sequence"><?php
  93. if($feature->residues){
  94. print ereg_replace("(.{100})","\\1<br>",$feature->residues);
  95. } else {
  96. print "sequence currently not available";
  97. }
  98. ?></pre>
  99. </div></div>
  100. <!-- End of sequences -->
  101. <!-- Start of theme_tripal_feature_feature_references -->
  102. <?php
  103. $references = $node->references;
  104. if(count($references) > 0){
  105. ?>
  106. <div id="feature-references" class="tripal_feature-info-box">
  107. <div class="tripal_expandableBox"><h3>References</h3></div>
  108. <div class="tripal_expandableBoxContent">
  109. <table class="tripal_feature-references-table">
  110. <tr>
  111. <th>Dababase</th>
  112. <th>Accession</th>
  113. </tr>
  114. <?php
  115. foreach ($references as $result){
  116. ?>
  117. <tr>
  118. <td><?php print $result->db_name?></td>
  119. <td><?php if($result->urlprefix){ ?><a href="<?php print $result->urlprefix.$result->accession?>"><?php print $result->accession?></a><?php } else { print $result->accession; } ?></td>
  120. </tr>
  121. <?php } ?>
  122. </table></div></div>
  123. <?php } ?>
  124. <!-- End of theme_tripal_feature_feature_references -->
  125. <!-- Start of theme_tripal_feature_feature_featurelocs -->
  126. <?php
  127. $featurelocs = $node->featurelocs;
  128. if(count($featurelocs) > 0){
  129. ?>
  130. <div id="feature-featurelocs" class="tripal_feature-info-box">
  131. <div class="tripal_expandableBox"><h3>Locations</h3></div>
  132. <div class="tripal_expandableBoxContent">
  133. <table class="tripal_feature-locations-table">
  134. <tr>
  135. <th>Feature</th>
  136. <th>Type</th>
  137. <th>Position</th>
  138. <th>Phase</th>
  139. <th>Strand</th>
  140. </tr>
  141. <?php foreach ($featurelocs as $index => $loc){ ?>
  142. <tr>
  143. <td><?php print $loc->name ?></td>
  144. <td><?php print $loc->cvname ?></td>
  145. <td><?php print $loc->fmin . ".." . $loc->fmax ?></td>
  146. <td><?php print $loc->phase ?></td>
  147. <td><?php print $loc->strand ?></td>
  148. </tr>
  149. <?php } ?>
  150. </table></div></div>
  151. <?php } ?>
  152. <!-- End of theme_tripal_feature_feature_references -->
  153. <!-- Start of theme_tripal_feature_feature_myfeaturelocs -->
  154. <?php
  155. $myfeaturelocs = $node->myfeaturelocs;
  156. if(count($myfeaturelocs) > 0){
  157. ?>
  158. <div id="feature-myfeaturelocs" class="tripal_feature-info-box">
  159. <div class="tripal_expandableBox"><h3>Features Located on <?php print $feature->featurename;?></h3></div>
  160. <div class="tripal_expandableBoxContent">
  161. <table>
  162. <tr>
  163. <th>Feature</th>
  164. <th>Type</th>
  165. <th>Position</th>
  166. <th>Phase</th>
  167. <th>Strand</th>
  168. </tr>
  169. <?php foreach ($myfeaturelocs as $index => $loc){ ?>
  170. <tr>
  171. <td><?php print $loc->name ?></td>
  172. <td><?php print $loc->cvname ?></td>
  173. <td><?php print $loc->fmin . ".." . $loc->fmax ?></td>
  174. <td><?php print $loc->phase ?></td>
  175. <td><?php print $loc->strand ?></td>
  176. </tr>
  177. <?php } ?>
  178. </table></div></div>
  179. <?php } ?>
  180. <!-- End of theme_tripal_feature_feature_references -->
  181. <!-- Start of theme_tripal_feature_feature_relationships -->
  182. <?php
  183. print "<div id=\"feature-srelationships\" class=\"tripal_feature-info-box\">";
  184. print "<div class=\"tripal_expandableBox\"><h3>Relationships</h3></div>";
  185. print "<div class=\"tripal_expandableBoxContent\">";
  186. $srelationships = $node->subject_relationships;
  187. if(count($srelationships) > 0){
  188. print "<b>Subject Relationships</b><br>";
  189. print "
  190. <table class=\"tripal_feature-relationships-subject-table\">
  191. <tr>
  192. <th>Relationship</th>
  193. <th>Feature</th>
  194. <th>Type</th>
  195. </tr>
  196. ";
  197. foreach ($srelationships as $result){
  198. print "<tr>";
  199. print "<td><b>$result->rel_type</b></td>";
  200. print "<td>";
  201. if(isset($result->object_nid)){
  202. print "<a href=\"" . url("node/$result->object_nid") . "\">$result->object_name</a> ";
  203. } else {
  204. print "$result->object_name ";
  205. }
  206. print "</td>";
  207. print "<td>$result->object_type</td>";
  208. }
  209. print "</table><br>";
  210. }
  211. ?>
  212. <!-- End of theme_tripal_feature_feature_relationships -->
  213. <!-- Start of theme_tripal_feature_feature_relationships -->
  214. <?php
  215. $orelationships = $node->object_relationships;
  216. $other_seqs = array();
  217. if(count($orelationships) > 0){
  218. print "<b>Object Relationships</b><br>";
  219. print "
  220. <table class=\"tripal_feature-relationships-object-table\">
  221. <tr>
  222. <th>Feature</th>
  223. <th>Type</th>
  224. <th>Relationship</th>
  225. <th>Position</th>
  226. </tr>
  227. ";
  228. foreach ($orelationships as $result){
  229. $subject_name = $result->subject_uniquename;
  230. if($result->subject_name) {
  231. $subject_name = $result->subject_name;
  232. }
  233. print "<tr>";
  234. print "<td>";
  235. if(isset($result->subject_nid)){
  236. print "<a href=\"" . url("node/$result->subject_nid") . "\">$result->subject_name ($result->subject_type)</a> ";
  237. } else {
  238. print "$subject_name";
  239. }
  240. print "</td>";
  241. print "<td>$result->subject_type</td>";
  242. print "<td><b>$result->rel_type</b></td>";
  243. if($result->src_name){
  244. print "<td>$result->src_name ($result->src_cvname):$result->fmin $result->fmax</td>";
  245. } else {
  246. print "<td></td>";
  247. }
  248. print "</tr>";
  249. // anything with a src_name does not have a location on a
  250. // reference sequence, so let's keep track of those and print
  251. // the sequences later. Those that are located elsewhere
  252. // will get printed separately.
  253. if(!$result->src_name){
  254. $other_seqs[]=$result;
  255. }
  256. }
  257. print "</table>";
  258. // print the sequences for those that are located on a references
  259. // sequence
  260. $rel_info = $node->relationship_object_info;
  261. foreach($rel_info as $index => $info){
  262. if($info->source){
  263. print "<br><b>Sequence Context:</b><br>";
  264. print "$info->source:$info->fmin..$info->fmax<br>";
  265. print $info->residues;
  266. }
  267. }
  268. // now print any remaining sequences
  269. foreach($other_seqs as $i => $rel){
  270. print "<br><b>$rel->subject_type sequence</b>";
  271. print "<pre id=\"tripal_feature-sequence\">";
  272. print ereg_replace("(.{100})","\\1<br>",$rel->subject_residues);
  273. print "</pre>";
  274. }
  275. print "</div></div>";
  276. }
  277. ?>
  278. <!-- End of theme_tripal_feature_feature_relationships -->
  279. <?php endif; ?>
  280. <?php print $content?>
  281. </div>
  282. <?php if (!$teaser): ?>
  283. <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
  284. <?php endif; ?>
  285. <?php if ($teaser): ?>
  286. <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
  287. <?php endif; ?>
  288. <?php if (!$teaser): ?>
  289. <?php if ($terms) { ?><div class="taxonomy"><span><?php print t('tags') ?></span> <?php print $terms?></div><?php } ?>
  290. <?php endif; ?>
  291. </div>