Browse Source

Updated themeing for analyeses

spficklin 14 years ago
parent
commit
7ced61cd61
32 changed files with 1311 additions and 166 deletions
  1. 0 1
      tripal_analysis/tripal_analysis.module
  2. 33 0
      tripal_analysis_blast/theme/css/tripal_analysis_blast.css
  3. 183 0
      tripal_analysis_blast/theme/js/tripal_analysis_blast.js
  4. 98 0
      tripal_analysis_blast/theme/node-chado_analysis_blast.tpl.php
  5. 78 0
      tripal_analysis_blast/theme/tripal_analysis_blast/tripal_analysis_blast_base.tpl.php
  6. 123 0
      tripal_analysis_blast/theme/tripal_analysis_blast/tripal_analysis_blast_report.tpl.php
  7. 111 0
      tripal_analysis_blast/theme/tripal_feature/tripal_feature_blast_results.tpl.php
  8. 1 1
      tripal_analysis_blast/tripal_analysis_blast.info
  9. 2 3
      tripal_analysis_blast/tripal_analysis_blast.install
  10. 1 1
      tripal_analysis_blast/tripal_analysis_blast.module
  11. 17 0
      tripal_analysis_go/theme/css/tripal_analysis_go.css
  12. 0 0
      tripal_analysis_go/theme/js/tripal_analysis_go.js
  13. 1 1
      tripal_analysis_go/tripal_analysis_go.info
  14. 98 0
      tripal_analysis_interpro/theme/node-chado_analysis_interpro.tpl.php
  15. 1 1
      tripal_analysis_interpro/tripal_analysis_interpro.info
  16. 2 2
      tripal_analysis_interpro/tripal_analysis_interpro.module
  17. 0 0
      tripal_analysis_kegg/theme/css/tripal_analysis_kegg.css
  18. 0 0
      tripal_analysis_kegg/theme/js/tripal_analysis_kegg.js
  19. 0 0
      tripal_analysis_kegg/theme/node-chado_analysis_kegg.tpl.php
  20. 53 0
      tripal_analysis_kegg/theme/tripal_analysis_kegg/tripal_analysis_kegg_base.tpl.php
  21. 11 0
      tripal_analysis_kegg/theme/tripal_analysis_kegg/tripal_analysis_kegg_report.tpl.php
  22. 46 0
      tripal_analysis_kegg/theme/tripal_feature/tripal_feature_kegg_terms.tpl.php
  23. 20 0
      tripal_analysis_kegg/theme/tripal_organism/tripal_organism_kegg_summary.tpl.php
  24. 1 1
      tripal_analysis_kegg/tripal_analysis_kegg.info
  25. 0 0
      tripal_analysis_unigene/theme/css/tripal_analysis_unigene.css
  26. 101 0
      tripal_analysis_unigene/theme/node-chado_analysis_unigene.tpl.php
  27. 86 0
      tripal_analysis_unigene/theme/tripal_analysis_unigene/tripal_analysis_unigene_base.tpl.php
  28. 61 0
      tripal_analysis_unigene/theme/tripal_feature/tripal_feature_unigenes.tpl.php
  29. 52 0
      tripal_analysis_unigene/theme/tripal_organism/tripal_organism_unigenes.tpl.php
  30. 1 1
      tripal_analysis_unigene/tripal_analysis_unigene.info
  31. 128 0
      tripal_core/tripal_core.api.inc
  32. 2 154
      tripal_core/tripal_core.module

+ 0 - 1
tripal_analysis/tripal_analysis.module

@@ -17,7 +17,6 @@
 require('tripal_analysis.api.inc');
 
 
-
 /**
  *
  *

+ 33 - 0
tripal_analysis_blast/theme/css/tripal_analysis_blast.css

@@ -0,0 +1,33 @@
+#tripal_analysis_blast-table {
+   width: 100%;
+	overflow:auto;
+}
+#tripal_analysis_blast-table td {
+  text-align: left;
+}
+#tripal_analysis_blast-table .tripal-table-even-row {
+   border-top: 0px solid #CCCCCC;
+   border-bottom: 0px solid #CCCCCC;
+}
+#tripal_analysis_blast-table .tripal-table-odd-row {
+   border-top: 0px solid #CCCCCC;
+   border-bottom: 0px solid #CCCCCC;
+}
+#tripal_analysis_blast-table .tripal_analysis_blast-result-first-row {
+   border-top: 1px solid #CCCCCC;
+}
+#tripal_analysis_blast-table .tripal_analysis_blast-result-last-row {
+   border-bottom: 1px solid #CCCCCC;
+}
+
+.tripal_analysis_blast-info-hsp-desc {
+	background-color: #FFFFFF;
+	border:0px solid #CCC5AE;
+	display:none;
+	overflow:auto;
+   width: 100%;
+}
+.tripal_analysis_blast-info-hsp-desc pre{
+	background-color: #FFFFFF;
+   border:none;
+}

+ 183 - 0
tripal_analysis_blast/theme/js/tripal_analysis_blast.js

@@ -0,0 +1,183 @@
+
+if (Drupal.jsEnabled) {
+   
+   $(document).ready(function(){
+	   // If Anlaysis admin page is shown, get the settings for selected database
+	   if ($("#edit-blastdb")[0]) {
+		   tripal_update_regex($("#edit-blastdb")[0]);
+		   tripal_set_genbank_style();
+	   }
+      // hide the alignment information on the blast results box
+      $(".tripal_analysis_blast-info-hsp-desc").hide();
+
+   });
+  
+   //------------------------------------------------------------
+   // Update the blast results based on the user selection
+   function tripal_update_blast(link,db_id){
+      tripal_startAjax();
+      $.ajax({
+         url: link.href,
+         dataType: 'json',
+         type: 'POST',
+         success: function(data){         
+            $("#blast_db_" + db_id).html(data.update);
+            $(".tripal_analysis_blast-info-hsp-desc").hide();
+            tripal_stopAjax();
+         }
+      });
+      return false;
+   }
+
+   //------------------------------------------------------------
+   // Update the blast results based on the user selection
+   function tripal_blast_toggle_alignment(analysis_id,hit_id){
+      var alignment_box = $("#tripal_analysis_blast-info-hsp-desc-"+analysis_id+"-"+hit_id);
+      var toggle_img = $("#tripal_analysis_blast-info-toggle-image-"+analysis_id+"-"+hit_id);
+	   var icon_url = toggle_img.attr("src");
+
+
+      if (alignment_box.is(':visible')) {
+         alignment_box.fadeOut('fast');
+	      var changed_icon_url = icon_url.replace(/arrow_d.png/,"arrow_r.png");
+	      toggle_img.attr("src", changed_icon_url);
+	   } else {
+         var width = alignment_box.parent().width();
+         alignment_box.css("width", width+'px');
+         alignment_box.fadeIn('slow');
+	      var icon_url = icon_url.replace(/arrow_r.png/,"arrow_d.png");
+	      toggle_img.attr("src", icon_url);
+	   }
+      return false;
+   }
+   
+   //------------------------------------------------------------
+   // Update regular expression for selected database
+   function tripal_update_regex(options){
+	   // Get the dbname from DOM
+	   var index = options.selectedIndex;
+	   var dbid = options[index].value;
+
+	   // Form the link for the following ajax call	   
+      var baseurl = tripal_get_base_url();
+      var link = baseurl + '/tripal_blast_regex/' + dbid;
+	   
+	   // Make ajax call to retrieve regular expressions
+	   $.ajax( {
+			url : link,
+			dataType : 'json',
+			type : 'POST',
+			success : tripal_set_parser,
+		});
+	}
+   
+   // Set parser for the admin page
+   function tripal_set_parser(data) {
+	   // Set title if it exists
+	   if (data.name) {
+			$("#edit-displayname").val(data.name);
+	   } else {
+			$("#edit-displayname").val("");
+	   }
+		
+	   // If genbank_style is TRUE, check the Genbank style box, clear all regular expressions, and disable
+	   // the text fields
+	   if (data.genbank_style == 1) {
+		   $("#edit-gb-style-parser").attr("checked", true);
+		   $("#edit-hit-id").val("");
+		   $("#edit-hit-def").val("");
+		   $("#edit-hit-accession").val("");
+		
+	   // Otherwise, uncheck the Genbank style box and set the regular expressions
+	   } else {
+			$("#edit-gb-style-parser").attr("checked", false);
+			if (data.reg1) {
+				$("#edit-hit-id").val(data.reg1);			
+			// Show default hit-id parser if it's not set
+			} else {
+				$("#edit-hit-id").val("^(.*?)\s.*$");
+			}
+			if (data.reg2) {
+				$("#edit-hit-def").val(data.reg2);
+			// Show default hit-def parser if it's not set
+			} else {
+				$("#edit-hit-def").val("^.*?\s(.*)$");
+			}
+			if (data.reg3) {
+				$("#edit-hit-accession").val(data.reg3);			
+			// Show default hit-accession parser if it's not set
+			} else {
+				$("#edit-hit-accession").val("^(.*?)\s.*$");
+			}
+		}
+		tripal_set_genbank_style();  
+   }
+   // ------------------------------------------------------------
+   // Use genbank style parser. Hide regular expression text feilds
+   function tripal_set_genbank_style (){
+	  // Disable regular expressions if genbank style parser is used (checked)
+	  if ($("#edit-gb-style-parser").is(":checked")) {
+		  $("#edit-hit-id-wrapper > label").css("color", "grey");
+		  $("#edit-hit-def-wrapper > label").css("color", "grey");
+		  $("#edit-hit-accession-wrapper > label").css("color", "grey");
+		  $("#edit-hit-id").attr('disabled', 'disabled');
+		  $("#edit-hit-def").attr('disabled', 'disabled');
+		  $("#edit-hit-accession").attr('disabled', 'disabled');
+	  } else {
+		  $("#edit-hit-id-wrapper > label").css("color", "black");
+		  $("#edit-hit-def-wrapper > label").css("color", "black");
+		  $("#edit-hit-accession-wrapper > label").css("color", "black");
+		  $("#edit-hit-id").removeAttr('disabled');
+		  $("#edit-hit-def").removeAttr('disabled');
+		  $("#edit-hit-accession").removeAttr('disabled');
+	  }
+   }
+   // -------------------------------------------------------------
+   // Function that toggles the blast droppable subbox content
+   function tripal_set_blast_subbox(db_id){
+	  
+	  $('.blast-hit-arrow-icon').hover(
+	     function() {
+	        $(this).css("cursor", "pointer");
+	     },
+	     function() {
+	        $(this).css("cursor", "pointer");
+	     }
+	  );
+     $('.blast-hit-arrow-icon').click(function() {
+	        
+     });
+   }
+   
+   	//------------------------------------------------------------
+	// Update the blast best hit report for selected page and sorting
+	function tripal_update_best_hit_report(obj, analysis_id, sort, descending, per_page){
+		var page = obj.selectedIndex + 1;
+		var baseurl = location.href.substring(0,location.href.lastIndexOf('/tripal_blast_report/'));
+		var link = baseurl + '/tripal_blast_report/' + analysis_id + "/" + page + "/" + sort + "/" + descending + "/" + per_page;
+
+		tripal_startAjax();
+		$.ajax({
+			url: link,
+			dataType: 'html',
+			type: 'POST',
+			success: function(data){
+				var d = document.createElement('div');
+				d.innerHTML = data;
+				var divs = d.getElementsByTagName("div");
+				for (var i = 0; i < divs.length; i ++) {
+					if (divs[i].getAttribute('id') == 'blast-hits-report') {	
+						var report_table = document.getElementById('blast-hits-report');
+						report_table.innerHTML = divs[i].innerHTML;
+						var table_breport = document.getElementById('tripal_blast_report_table');
+						var sel = document.getElementById('tripal_blast_report_page_selector');
+						sel.options[page - 1].selected = true;
+						tripal_stopAjax();
+					}
+				}
+			}
+		});
+		
+		return false;
+	}
+}

+ 98 - 0
tripal_analysis_blast/theme/node-chado_analysis_blast.tpl.php

@@ -0,0 +1,98 @@
+<?php
+// Purpose: This template provides the layout of the organism node (page)
+//   using the same templates used for the various feature content blocks.
+//
+// To Customize the Featture Node Page:
+//   - This Template: customize basic layout and which elements are included
+//   - Using Panels: Override the node page using Panels3 and place the blocks
+//       of content as you please. This method requires no programming. See
+//       the Tripal User Guide for more details
+//   - Block Templates: customize the content/layout of each block of stock 
+//       content. These templates are found in the tripal_stock subdirectory
+//
+// Variables Available:
+//   - $node: a standard object which contains all the fields associated with
+//       nodes including nid, type, title, taxonomy. It also includes stock
+//       specific fields such as stock_name, uniquename, stock_type, synonyms,
+//       properties, db_references, object_relationships, subject_relationships,
+//       organism, etc.
+//   NOTE: For a full listing of fields available in the node object the
+//       print_r $node line below or install the Drupal Devel module which 
+//       provides an extra tab at the top of the node page labelled Devel
+?>
+
+<?php
+ //uncomment this line to see a full listing of the fields avail. to $node
+ //print '<pre>'.print_r($variables,TRUE).'</pre>';
+drupal_add_css('./tripal-node-templates.css');
+
+$node = $variables['node'];
+$organism = $variables['node']->organism;
+?>
+
+<?php if ($teaser) { 
+  include('tripal_analysis_blast/tripal_analysis_blast_teaser.tpl.php'); 
+} else { ?>
+
+<script type="text/javascript">
+if (Drupal.jsEnabled) {
+   $(document).ready(function() {
+      // hide all tripal info boxes at the start
+      $(".tripal-info-box").hide();
+ 
+      // iterate through all of the info boxes and add their titles
+      // to the table of contents
+      $(".tripal-info-box-title").each(function(){
+        var parent = $(this).parent();
+        var id = $(parent).attr('id');
+        var title = $(this).text();
+        $('#tripal_analysis_blast_toc_list').append('<li><a href="#'+id+'" class="tripal_analysis_blast_toc_item">'+title+'</a></li>');
+      });
+
+      // when a title in the table of contents is clicked, then
+      // show the corresponding item in the details box
+      $(".tripal_analysis_blast_toc_item").click(function(){
+         $(".tripal-info-box").hide();
+         href = $(this).attr('href');
+         $(href).fadeIn('slow');
+         // we want to make sure our table of contents and the details
+         // box stay the same height
+         $("#tripal_analysis_blast_toc").height($(href).parent().height());
+         return false;
+      }); 
+
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_blast-"+block_title+"-box").show();
+      } else {
+         $("#tripal_analysis_blast-base-box").show();
+      }
+
+      $("#tripal_analysis_blast_toc").height($("#tripal_analysis_blast-base-box").parent().height());
+      
+   });
+}
+</script>
+
+
+<div id="tripal_analysis_blast_details" class="tripal_details">
+
+   <!-- Basic Details Theme -->
+   <?php include('tripal_analysis_blast/tripal_analysis_blast_base.tpl.php'); ?>
+
+   <?php print $content ?>
+</div>
+
+<!-- Table of contents -->
+<div id="tripal_analysis_blast_toc" class="tripal_toc">
+   <div id="tripal_analysis_blast_toc_title" class="tripal_toc_title">Resources</i></div>
+   <span id="tripal_analysis_blast_toc_desc" class="tripal_toc_desc"></span>
+   <ul id="tripal_analysis_blast_toc_list" class="tripal_toc_list">
+
+   </ul>
+</div>
+
+<?php } ?>

+ 78 - 0
tripal_analysis_blast/theme/tripal_analysis_blast/tripal_analysis_blast_base.tpl.php

@@ -0,0 +1,78 @@
+<?php
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+
+// the description is a text field so we want to expand that
+$analysis = tripal_core_expand_chado_vars($analysis,'field','analysis.description');
+
+// get the blast data 
+$blast = $node->analysis->tripal_analysis_blast;
+
+//dpm($analysis);
+
+?>
+<div id="tripal_analysis_blast-base-box" class="tripal_analysis_blast-info-box tripal-info-box">
+  <div class="tripal_analysis_blast-info-box-title tripal-info-box-title">Blast Analysis Details</div>
+  <div class="tripal_analysis_blast-info-box-desc tripal-info-box-desc"></div>
+   <table id="tripal_analysis_blast-table-base" class="tripal_analysis_blast-table tripal-table tripal-table-vert">
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-even-row">
+        <th>Analysis Name</th>
+        <td><?php print $analysis->name; ?></td>
+      </tr>
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-odd-row">
+        <th nowrap>Software</th>
+        <td><?php 
+          print $analysis->program; 
+          if($analysis->programversion){
+             print " (" . $analysis->programversion . ")"; 
+          }
+          if($analysis->algorithm){
+             print ". " . $analysis->algorithm; 
+          }
+          ?>
+        </td>
+      </tr>
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-even-row">
+        <th nowrap>Source</th>
+        <td><?php 
+          if($analysis->sourceuri){
+             print "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>"; 
+          } else {
+             print $analysis->sourcename; 
+          }
+          if($analysis->sourceversion){
+             print " (" . $analysis->sourceversion . ")"; 
+          }
+          ?>
+          </td>
+      </tr>
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-odd-row">
+        <th nowrap>Date performed</th>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></td>
+      </tr>
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-even-row">
+        <th nowrap>Description</th>
+        <td><?php print $analysis->description; ?></td>
+      </tr> 
+      <tr class="tripal_analysis_blast-table-even-row tripal-table-odd-row">
+        <th nowrap>Database</th>
+        <td><?php print $blast->db->name ?></td>
+      </tr> 
+      <tr class="tripal_analysis_blast-table-even-row tripal-table-even-row">
+        <th nowrap>Blast Arguments</th>
+        <td><?php print $blast->blastparameters ?></td>
+      </tr>  
+      <tr class="tripal_analysis_blast-table-odd-row tripal-table-odd-row">
+        <th>Report</th>
+        <td>
+        	<?php 
+        		if ($analysis->blast_report) {					
+        			print "<a href=$analysis->blast_report>View the best hit report</a>";
+        		} else {
+        			print "not available";
+        		}
+        	?>
+        	</td>
+      </tr>       	                                
+   </table>   
+</div>

+ 123 - 0
tripal_analysis_blast/theme/tripal_analysis_blast/tripal_analysis_blast_report.tpl.php

@@ -0,0 +1,123 @@
+<?php
+$report  = $variables['report_object'];
+$hits = $report->hits;
+?>
+
+<style type="text/css">
+#tripal_blast_report_current_page {
+	float: right;
+	margin-bottom: 5px;
+	margin-right: 20px;
+}
+#tripal_blast_report_pager {
+	float: right;
+	margin-bottom: 10px;
+	margin-right: 20px;
+}
+#tripal_blast_report_per_page {
+	float: left;
+	margin-bottom: 10px;
+}
+</style>
+
+<div id="tripal_ajaxLoading" style="display:none">
+	<div id="loadingText">Loading...</div>
+	<img src="<?php print url("sites/all/themes/theme_tripal/images/ajax-loader.gif") ?>">
+</div>
+
+<div id="blast-hits-report">
+	<strong>Analysis Date: </strong><?php print $report->time?> (<a href=<?php print $report->url ?>><?php print $report->name ?></a>)<br>
+	There are <strong><?php print $report->counter ?></strong> records. 
+	<div id=tripal_blast_report_current_page>page <strong><?php print $report->currentpage ?></strong> of <strong><?php print $report->no_page ?></strong>
+	</div>
+	
+	<table id="tripal_analysi_blast-report-table" class="tripal_analysis_blast-table tripal-table tripal-table-horz">
+		<tr class="tripal_analysis_blast-table-odd-row tripal-table-odd-row">
+			<th nowrap><?php if ($report->sort == 0) {print $report->symbol;} ?>
+				<a href=<?php print $report->byQuery ?>>Query</a>
+			</th>
+			<th nowrap><?php if ($report->sort == 1) {print $report->symbol;} ?>
+				<a href=<?php print $report->byMatchName ?>>Match Name</a>
+			</th>
+			<th nowrap><?php if ($report->sort == 2) {print $report->symbol;} ?>
+				<a href=<?php print $report->byDescription ?>>Description</a>
+			</th>
+			<th nowrap><?php if ($report->sort == 3) {print $report->symbol;} ?>
+				<a href=<?php print $report->byEvalue ?>>E-value</a>
+			</th>
+			<th nowrap><?php if ($report->sort == 4) {print $report->symbol;} ?>
+				<a href=<?php print $report->byIdentity ?>>%Identity</a>
+			</th>
+			<th nowrap><?php if ($report->sort == 5) {print $report->symbol;} ?>
+				<a href=<?php print $report->byLength ?>>Length</a>
+			</th>
+		</tr>
+		
+		<?php foreach($hits AS $hit) {?>
+		<tr class="<?php print $hit->class ?>">
+		                           <td nowrap><a href=<?php print $hit->q_url ?>><?php print $hit->query ?></a></td>
+		                           <td nowrap><a href=<?php print $hit->urlprefix.$hit->match ?> target=_blank><?php print $hit->match ?></td>
+		                           <td><?php print $hit->desc ?></td>
+		                           <td nowrap><?php print $hit->evalue ?></td>
+		                           <td nowrap><?php print $hit->identity ?></td>
+		                           <td nowrap><?php print $hit->length ?></td>
+		                         </tr>
+		<?php } ?>	
+			
+	</table>
+			<div id="tripal_blast_report_per_page">Show	
+				<?php 
+				$per_page = $report->per_page;
+				$path = $report->path;
+				if ($per_page == 10) {?>
+					<strong>10</strong> | 
+				<?php } else { 
+					$url_path = url($path."10");
+				?>	
+					<a href=<?php print $url_path ?>>10</a> | 
+				<?php } 
+				if ($per_page == 20) {
+				?>
+					<strong>20</strong> | 
+				<?php } else {
+					$url_path = url($path."20");
+				?>
+					<a href=<?php print $url_path ?>>20</a> | 
+				<?php } 
+				if ($per_page == 50) {
+				?>
+					<strong>50</strong> | 
+				<?php } else {
+					$url_path = url($path."50");
+				?>
+					<a href=<?php print $url_path ?>>50</a> | 
+				<?php }
+				if ($per_page == 100) {
+				?>
+					<strong>100</strong> | 
+				<?php } else {
+					$url_path = url($path."100");
+				?>
+					<a href=<?php print $url_path ?>>100</a> | 
+				<?php }
+				if ($per_page == 200) {
+				?>
+					<strong>200</strong> | 
+				<?php } else {
+					$url_path = url($path."200");
+				?>
+			   	<a href=<?php print $url_path ?>>200</a>
+				<?php } ?>
+				
+				records per page
+		</div>
+		<div id=tripal_blast_report_pager>page
+			<select id=tripal_blast_report_page_selector onChange="tripal_update_best_hit_report(this, <?php print $report->analysis_id ?>,<?php print $report->sort ?>, <?php print $report->descending ?>, <?php print $report->per_page ?>)">
+			<?php  for ($i = 1; $i <= $report->no_page; $i ++) { ?>
+				<option value=<?php print $i ?>><?php print $i ?></option>
+			<?php } ?>	                           
+			</select>
+		</div>
+</div>
+			
+	

+ 111 - 0
tripal_analysis_blast/theme/tripal_feature/tripal_feature_blast_results.tpl.php

@@ -0,0 +1,111 @@
+<?php
+$feature  = $variables['node']->feature;
+$blast_results_list = $feature->tripal_analysis_blast->blast_results_list;
+
+?>
+<div id="tripal_ajaxLoading" style="display:none">
+	<div id="loadingText">Loading...</div>
+	<img src="sites/all/themes/theme_tripal/images/ajax-loader.gif">
+</div>
+
+<?php 
+if(count($blast_results_list) > 0){
+   foreach ($blast_results_list as $blast_result) {
+	  $hits_array = $blast_result->hits_array;
+	  $db = $blast_result->db;
+     $analysis = $blast_result->analysis;
+?>
+<div id="blast_db_<?php print $db->db_id ?>">
+<div id="tripal_analysis_blast-results-<?php print "$db->db_id" ?>-box" class="tripal_analysis_blast-box tripal-info-box">
+	<div class="tripal-info-box-title tripal_analysis_blast-info-box-title"><?php print $db->name ?> Homologs</div>
+	<div class="tripal-info-box-desc tripal_analysis_blast-info-box-desc">
+	<strong>Analysis Date: </strong><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted) . " (<a href=".url("node/$analysis->nid").">$analysis->name</a>)"?><br>
+	<!--Query: <?php print "$blast_result->xml_tag"?><br>-->
+	
+	<?php 
+   if($blast_result->max != 10){    
+      $url = url("tripal_top_blast/$feature->feature_id/$db->db_id/10");
+		?><span><a onclick="return tripal_update_blast(this,<?php print $db->db_id?>)" href="<?php print $url ?>">Show Best 10 Hits</a></span><?php
+	} else { 
+		?><span>Best 10 Hits Shown</span><?php
+	} 
+	
+	if($blast_result->number_hits <= 10){ 
+	} 
+   else if ($blast_result->max != 25) { 
+  	   $url = url("tripal_top_blast/$feature->feature_id/$db->db_id/25"); 	
+		?><span> | <a onclick="return tripal_update_blast(this,<?php print"$db->db_id"?>)" href="<?php print $url ?>">Show Best 25 Hits</a></span><?php
+	}else {
+		?><span> | Best 25 Hits Shown</span><?php
+	} 
+	
+	if($blast_result->number_hits <= 25){
+	} 
+   else if ($blast_result->max != 0) {
+	   $url = url("tripal_top_blast/$feature->feature_id/$db->db_id/all"); 		
+		?><span> | <a onclick="return tripal_update_blast(this, <?php print $db->db_id ?>)" href="<?php print $url ?>">Show All Hits</a> </span><?php
+	} else {
+		?><span> | All Hits Shown</span><?php
+	} 
+   ?>
+	<br><br><span>Click a description for more details</span>
+   </div>
+	<table id="tripal_analysis_blast-table" class="tripal-table tripal-table-horz tripal_analysis_blast-table">
+		<tr>
+         <th>&nbsp;</th>
+			<th nowrap>Match Name</th>
+			<th nowrap>E value</th>
+			<th nowrap>Identity</th>
+			<th nowrap>Description</th>
+		</tr>
+		
+		<?php 
+      $i = 0; 
+      if(sizeof($hits_array)==0){?>
+        <tr>
+          <td colspan="5">    
+            <div class="tripal-no-results">There are no matches against <?php print $db->name?> for this <?php print $feature->type_id->name?>.</div> 
+          </td>
+        </tr><?php
+      }
+		foreach($hits_array AS $hit) { 
+         $class = 'tripal-table-odd-row tripal_analysis_blast-table-odd-row';
+         if($i % 2 == 0 ){
+            $class = 'tripal-table-even-row tripal_analysis_blast-table-odd-row';
+         }?>
+         <tr class="<?php print $class ?> tripal_analysis_blast-result-first-row">
+            <td><?php print $i+1 ?>.</td>
+		      <?php if ($hit['hit_url']) { ?>
+			      <td><a href="<?php print $hit['hit_url']?>" target="_blank"><?php print $hit['hit_name']?></a></td>
+		      <?php } else {?>
+			      <td><?php print $hit['hit_name'] ?></td>
+		      <?php } ?>
+			   <td nowrap><?php print $hit['best_evalue']?></td>
+			   <td nowrap><?php  print $hit['percent_identity']?></td>
+			   <td><?php print $hit['description']?></td>
+		   </tr>
+	      <tr class="<?php print $class ?>">
+		      <td colspan=5>
+			      <a class="blast-hit-arrow-icon" onclick="return tripal_blast_toggle_alignment(<?php print $analysis->analysis_id ?>,<?php print $i?>)"><img id="tripal_analysis_blast-info-toggle-image-<?php print $analysis->analysis_id ?>-<?php print $i?>" src=<?php print $hit['arrowr_url']?> align="top"> View Alignment</a>
+			      <div class="tripal_analysis_blast-info-hsp-title"></div>
+		      </td>
+	      </tr>
+	      <tr class="<?php print $class ?> tripal_analysis_blast-result-last-row">
+		      <td colspan=5>
+		      <?php 
+		      $hsps_array = $hit['hsp'];
+		      foreach ($hsps_array AS $hsp) { ?>
+			      <div class="tripal_analysis_blast-info-hsp-desc" id="tripal_analysis_blast-info-hsp-desc-<?php print $analysis->analysis_id ?>-<?php print $i?>">
+				      &nbsp;HSP <?php  print $hsp['hsp_num'] ?>
+				      <pre>Score: <?php print $hsp['bit_score'] ?> bits (<?php print $hsp['score'] ?>), Expect = <?php print $hsp['evalue'] ?><br>Identity = <?php print sprintf("%d/%d (%.2f%%)", $hsp['identity'], $hsp['align_len'], $hsp['identity']/$hsp['align_len']*100) ?>, Postives = <?php print sprintf("%d/%d (%.2f%%)", $hsp['positive'], $hsp['align_len'], $hsp['positive']/$hsp['align_len']*100)?>, Query Frame = <?php print $hsp['query_frame']?></a><br><br></a>Query: <?php print sprintf("%4d", $hsp['query_from'])?> <?php print $hsp['qseq'] ?> <?php print sprintf("%d", $hsp['query_to']); ?><br>            <?php print $hsp['midline'] ?><br>Sbjct: <?php print sprintf("%4d", $hsp['hit_from']) ?> <?php print $hsp['hseq']?> <?php print sprintf("%d",$hsp['hit_to']) ?></pre><br>
+			      </div>
+		      <?php } ?>
+		      </td>
+	      </tr>		
+         <?php $i++;
+	   } ?>
+	</table>
+</div>
+</div>
+  <?php } ?>
+<?php } ?>

+ 1 - 1
tripal_analysis_blast/tripal_analysis_blast.info

@@ -3,7 +3,7 @@ name = Tripal Blast
 description = An analysis sub-module for adding, editing, and displaying blast analysis results.
 core = 6.x
 project = tripal_analysis_blast
-package = Tripal Analyses 
+package = Tripal Extensions 
 version = 6.x-0.3b
 dependencies[] = tripal_core
 dependencies[] = tripal_feature

+ 2 - 3
tripal_analysis_blast/tripal_analysis_blast.install

@@ -12,8 +12,7 @@ function tripal_analysis_blast_install() {
    // for our blast result. Basically the registration is done by inserting
    // modulename into the drupal {tripal_analysis} table AND inserting required
    // information to the chado Analysis table. Also in tripal_analysis_blast.module,
-   // we need to define HOOK_get_settings() for the module to work properly.
-   
+   // we need to define HOOK_get_settings() for the module to work properly.   
    // Register the analysis type
    tripal_analysis_register_child('tripal_analysis_blast');
    
@@ -45,7 +44,7 @@ function tripal_analysis_blast_install() {
       db_query($sql_parser, $db->db_id, 'ExPASy TrEMBL', '^.*?\|(.*?)\s.*?$', '^.*?\|.*?\s(.*)$', '^(.*?)\|.*?\s.*?$', 0);
    }
    
-   // Add genbank parser
+   // Add NCBI genbank parser
    $previous_db = tripal_db_set_active ('chado');
    $results = db_query($sql_db, "%genbank%");
    tripal_db_set_active($previous_db);

+ 1 - 1
tripal_analysis_blast/tripal_analysis_blast.module

@@ -10,7 +10,7 @@ require_once "parse_blast_XML.inc";
 function tripal_analysis_blast_init(){
 	// Add javascript and style sheet
 	drupal_add_css(drupal_get_path('theme', 'tripal').'/css/tripal_analysis_blast.css');
-	drupal_add_js(drupal_get_path('theme', 'tripal').'/js/tripal_analysis_blast.js');
+	drupal_add_js( drupal_get_path('theme', 'tripal').'/js/tripal_analysis_blast.js');
 }
 
 /*******************************************************************************

+ 17 - 0
tripal_analysis_go/theme/css/tripal_analysis_go.css

@@ -0,0 +1,17 @@
+
+.tripal_go-info-box, .tripal_go_summary-info-box {
+   margin-top: 10px;
+   margin-left: 0px;
+   margin-right: 0px;
+   margin-bottom: 0px;
+   padding-top: 0px;
+   padding-left: 0px;
+   padding-bottom: 0px;
+   padding-right: 0px;
+   border-collapse: collapse;
+   z-index: 10;
+}
+
+.tripal_go_summary-info-box .tripal_cv_tree {
+   border-collapse: separate;
+}

+ 0 - 0
theme_tripal/js/tripal_analysis_go.js → tripal_analysis_go/theme/js/tripal_analysis_go.js


+ 1 - 1
tripal_analysis_go/tripal_analysis_go.info

@@ -3,7 +3,7 @@ name = Tripal GO
 description = An analysis sub-module for displaying GO analysis and GO assignments to features.
 core = 6.x
 project = tripal_analysis_go
-package = Tripal Analyses
+package = Tripal Extensions
 version = 6.x-0.3b
 dependencies[] = tripal_core
 dependencies[] = tripal_feature

+ 98 - 0
tripal_analysis_interpro/theme/node-chado_analysis_interpro.tpl.php

@@ -0,0 +1,98 @@
+<?php
+// Purpose: This template provides the layout of the organism node (page)
+//   using the same templates used for the various feature content blocks.
+//
+// To Customize the Featture Node Page:
+//   - This Template: customize basic layout and which elements are included
+//   - Using Panels: Override the node page using Panels3 and place the blocks
+//       of content as you please. This method requires no programming. See
+//       the Tripal User Guide for more details
+//   - Block Templates: customize the content/layout of each block of stock 
+//       content. These templates are found in the tripal_stock subdirectory
+//
+// Variables Available:
+//   - $node: a standard object which contains all the fields associated with
+//       nodes including nid, type, title, taxonomy. It also includes stock
+//       specific fields such as stock_name, uniquename, stock_type, synonyms,
+//       properties, db_references, object_relationships, subject_relationships,
+//       organism, etc.
+//   NOTE: For a full listing of fields available in the node object the
+//       print_r $node line below or install the Drupal Devel module which 
+//       provides an extra tab at the top of the node page labelled Devel
+?>
+
+<?php
+ //uncomment this line to see a full listing of the fields avail. to $node
+ //print '<pre>'.print_r($variables,TRUE).'</pre>';
+drupal_add_css('./tripal-node-templates.css');
+
+$node = $variables['node'];
+$organism = $variables['node']->organism;
+?>
+
+<?php if ($teaser) { 
+  include('tripal_analysis_interpro/tripal_analysis_interpro_teaser.tpl.php'); 
+} else { ?>
+
+<script type="text/javascript">
+if (Drupal.jsEnabled) {
+   $(document).ready(function() {
+      // hide all tripal info boxes at the start
+      $(".tripal-info-box").hide();
+ 
+      // iterate through all of the info boxes and add their titles
+      // to the table of contents
+      $(".tripal-info-box-title").each(function(){
+        var parent = $(this).parent();
+        var id = $(parent).attr('id');
+        var title = $(this).text();
+        $('#tripal_analysis_interpro_toc_list').append('<li><a href="#'+id+'" class="tripal_analysis_interpro_toc_item">'+title+'</a></li>');
+      });
+
+      // when a title in the table of contents is clicked, then
+      // show the corresponding item in the details box
+      $(".tripal_analysis_interpro_toc_item").click(function(){
+         $(".tripal-info-box").hide();
+         href = $(this).attr('href');
+         $(href).fadeIn('slow');
+         // we want to make sure our table of contents and the details
+         // box stay the same height
+         $("#tripal_analysis_interpro_toc").height($(href).parent().height());
+         return false;
+      }); 
+
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_interpro-"+block_title+"-box").show();
+      } else {
+         $("#tripal_analysis_interpro-base-box").show();
+      }
+
+      $("#tripal_analysis_interpro_toc").height($("#tripal_analysis_interpro-base-box").parent().height());
+      
+   });
+}
+</script>
+
+
+<div id="tripal_analysis_interpro_details" class="tripal_details">
+
+   <!-- Basic Details Theme -->
+   <?php include('tripal_analysis_interpro/tripal_analysis_interpro_base.tpl.php'); ?>
+
+   <?php print $content ?>
+</div>
+
+<!-- Table of contents -->
+<div id="tripal_analysis_interpro_toc" class="tripal_toc">
+   <div id="tripal_analysis_interpro_toc_title" class="tripal_toc_title">Resources</i></div>
+   <span id="tripal_analysis_interpro_toc_desc" class="tripal_toc_desc"></span>
+   <ul id="tripal_analysis_interpro_toc_list" class="tripal_toc_list">
+
+   </ul>
+</div>
+
+<?php } ?>

+ 1 - 1
tripal_analysis_interpro/tripal_analysis_interpro.info

@@ -3,7 +3,7 @@ name = Tripal Interpro
 description = An analysis sub-module for adding, editing, and displaying InterProScan analysis results.
 core = 6.x
 project = tripal_analysis_interpro
-package = Tripal Analyses
+package = Tripal Extensions
 version = 6.x-0.3b
 dependencies[] = tripal_core
 dependencies[] = tripal_feature

+ 2 - 2
tripal_analysis_interpro/tripal_analysis_interpro.module

@@ -7,10 +7,10 @@ require_once "parseInterpro.inc";
  * feature
  ******************************************************************************/
 function tripal_analysis_interpro_init(){
+
 	// Add javascript and style sheet
 	drupal_add_css(drupal_get_path('theme', 'tripal').'/css/tripal_analysis_interpro.css');
-	// Add javascript and style sheet
-   drupal_add_js(drupal_get_path('theme', 'tripal').'/js/tripal_analysis_interpro.js');
+   drupal_add_js( drupal_get_path('theme', 'tripal').'/js/tripal_analysis_interpro.js');
 }
 /*******************************************************************************
  *  Provide information to drupal about the node types that we're creating

+ 0 - 0
theme_tripal/css/tripal_analysis_kegg.css → tripal_analysis_kegg/theme/css/tripal_analysis_kegg.css


+ 0 - 0
theme_tripal/js/tripal_analysis_kegg.js → tripal_analysis_kegg/theme/js/tripal_analysis_kegg.js


+ 0 - 0
theme_tripal/node-chado_analysis_kegg.tpl.php → tripal_analysis_kegg/theme/node-chado_analysis_kegg.tpl.php


+ 53 - 0
tripal_analysis_kegg/theme/tripal_analysis_kegg/tripal_analysis_kegg_base.tpl.php

@@ -0,0 +1,53 @@
+<?php
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+
+// the description is a text field so we want to expand that
+$analysis = tripal_core_expand_chado_vars($analysis,'field','analysis.description');
+
+
+?>
+<div id="tripal_analysis_kegg-base-box" class="tripal_analysis_kegg-info-box tripal-info-box">
+  <div class="tripal_analysis_kegg-info-box-title tripal-info-box-title">KEGG Analysis Details</div>
+   <table id="tripal_analysis_kegg-table-base" class="tripal_analysis_kegg-table tripal-table tripal-table-vert">
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th>Analysis Name</th>
+        <td><?php print $analysis->name; ?></td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-odd-row">
+        <th nowrap>Software</th>
+        <td><?php 
+          print $analysis->program; 
+          if($analysis->programversion){
+             print " (" . $analysis->programversion . ")"; 
+          }
+          if($analysis->algorithm){
+             print ". " . $analysis->algorithm; 
+          }
+          ?>
+        </td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th nowrap>Source</th>
+        <td><?php 
+          if($analysis->sourceuri){
+             print "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>"; 
+          } else {
+             print $analysis->sourcename; 
+          }
+          if($analysis->sourceversion){
+             print " (" . $analysis->sourceversion . ")"; 
+          }
+          ?>
+          </td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-odd-row">
+        <th nowrap>Date performed</th>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></td>
+      </tr>
+      <tr class="tripal_analysis_kegg-table-odd-row tripal-table-even-row">
+        <th nowrap>Description</th>
+        <td><?php print $analysis->description; ?></td>
+      </tr>             	                                
+   </table>   
+</div>

+ 11 - 0
tripal_analysis_kegg/theme/tripal_analysis_kegg/tripal_analysis_kegg_report.tpl.php

@@ -0,0 +1,11 @@
+<?php
+$analysis = $node->analysis;
+$report = $analysis->tripal_analysis_kegg->kegg_report;
+//dpm($analysis);
+?>
+
+<div id="tripal_analysis_kegg-report-box" class="tripal_analysis_kegg-box tripal-info-box">
+  <div class="tripal_analysis_kegg-info-box-title tripal-info-box-title">KEGG Report</div>
+  <div class="tripal_analysis_kegg-info-box-desc tripal-info-box-desc"><?php print $analysis->name ?></div>
+  <?php print $report ?>
+</div>

+ 46 - 0
tripal_analysis_kegg/theme/tripal_feature/tripal_feature_kegg_terms.tpl.php

@@ -0,0 +1,46 @@
+<?php
+
+$feature  = $variables['node']->feature;
+$results = $feature->tripal_analysis_kegg->results;
+
+if($feature->cvname != 'gene' and count($results) > 0){ 
+   $i = 0;
+   foreach($results as $analysis_id => $analysisprops){ 
+     $analysis = $analysisprops['analysis'];
+     $terms = $analysisprops['terms']; 
+     ?>
+     <div id="tripal_feature-kegg_results_<?php print $i?>-box" class="tripal_analysis_kegg-box tripal-info-box">
+        <div class="tripal_feature-info-box-title tripal-info-box-title">KEGG Report <?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></div>
+        <div class="tripal_feature-info-box-desc tripal-info-box-desc"><?php 
+            if($analysis->nid){ ?>
+               Analysis name: <a href="<?php print url('node/'.$analysis->nid) ?>"><?php print $analysis->name?></a><?php
+            } else { ?>
+               Analysis name: <?php print $analysis->name;
+            } ?><br>
+            Date Performed: <?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?>
+        </div>
+
+     <div class="tripal_feature-kegg_results_subtitle">Annotated Terms</div>
+     <table id="tripal_feature-kegg_summary-<?php $i ?>-table" class="tripal_analysis_kegg-summary-table tripal-table tripal-table-horz">
+     <?php 
+     $j=0;
+     foreach($terms as $term){ 
+       $ipr_id = $term[0];
+       $ipr_name = $term[1];
+       $class = 'tripal_feature-table-odd-row tripal-table-odd-row';
+       if($j % 2 == 0 ){
+         $class = 'tripal_feature-table-even-row tripal-table-even-row';
+       }?>
+       <tr class="<?php print $class ?>">
+         <td><?php print $term ?></td>
+       </tr>
+       <?php
+       $j++;
+     } ?>
+     </table>     
+     </div> <?php
+     $i++;
+   } // end for each analysis 
+} // end if
+?>
+

+ 20 - 0
tripal_analysis_kegg/theme/tripal_organism/tripal_organism_kegg_summary.tpl.php

@@ -0,0 +1,20 @@
+<?php
+  $form = $organism->tripal_analysis_kegg->select_form->form;
+  $has_results = $organism->tripal_analysis_kegg->select_form->has_results;
+?>
+<div id="tripal_organism-kegg_summary-box" class="tripal_organism-info-box tripal-info-box">
+  <div  class="tripal_organism-info-box-title tripal-info-box-title">KEGG Analysis Reports</div>
+  <?php 
+     if($has_results){
+        print $form;
+     } else {
+       ?><div class="tripal-no-results">There are no KEGG reports available</div><?php
+     }
+  ?>
+   <div id="tripal_analysis_kegg_org_report"></div>
+   <div id="tripal_ajaxLoading" style="display:none">
+     <div id="loadingText">Loading...</div>
+   </div>   
+</div>
+
+

+ 1 - 1
tripal_analysis_kegg/tripal_analysis_kegg.info

@@ -3,7 +3,7 @@ name = Tripal Kegg
 description = An analysis sub-module for adding, editing, and displaying KEGG/KAAS analysis results.
 core = 6.x
 project = tripal_analysis_kegg
-package = Tripal Analyses
+package = Tripal Extensions
 version = 6.x-0.3b
 dependencies[] = tripal_core
 dependencies[] = tripal_feature

+ 0 - 0
theme_tripal/css/tripal_analysis_unigene.css → tripal_analysis_unigene/theme/css/tripal_analysis_unigene.css


+ 101 - 0
tripal_analysis_unigene/theme/node-chado_analysis_unigene.tpl.php

@@ -0,0 +1,101 @@
+<?php
+// Purpose: This template provides the layout of the organism node (page)
+//   using the same templates used for the various feature content blocks.
+//
+// To Customize the Featture Node Page:
+//   - This Template: customize basic layout and which elements are included
+//   - Using Panels: Override the node page using Panels3 and place the blocks
+//       of content as you please. This method requires no programming. See
+//       the Tripal User Guide for more details
+//   - Block Templates: customize the content/layout of each block of stock 
+//       content. These templates are found in the tripal_stock subdirectory
+//
+// Variables Available:
+//   - $node: a standard object which contains all the fields associated with
+//       nodes including nid, type, title, taxonomy. It also includes stock
+//       specific fields such as stock_name, uniquename, stock_type, synonyms,
+//       properties, db_references, object_relationships, subject_relationships,
+//       organism, etc.
+//   NOTE: For a full listing of fields available in the node object the
+//       print_r $node line below or install the Drupal Devel module which 
+//       provides an extra tab at the top of the node page labelled Devel
+?>
+
+<?php
+ //uncomment this line to see a full listing of the fields avail. to $node
+// print '<pre>'.print_r($node,TRUE).'</pre>';
+drupal_add_css('./tripal-node-templates.css');
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+$unigene_name = $analysis->tripal_analysis_unigene->unigene_name;
+
+//dpm($analysis);
+
+// get the unigene name from the properties list
+
+
+?>
+
+<?php if ($teaser) { 
+  include('tripal_analysis_unigene/tripal_analysis_unigene_teaser.tpl.php'); 
+} else { ?>
+
+<script type="text/javascript">
+if (Drupal.jsEnabled) {
+   $(document).ready(function() {
+      // hide all tripal info boxes at the start
+      $(".tripal-info-box").hide();
+ 
+      // iterate through all of the info boxes and add their titles
+      // to the table of contents
+      $(".tripal-info-box-title").each(function(){
+        var parent = $(this).parent();
+        var id = $(parent).attr('id');
+        var title = $(this).text();
+        $('#tripal_analysis_unigene_toc_list').append('<li><a href="#'+id+'" class="tripal_analysis_unigene_toc_item">'+title+'</a></li>');
+      });
+
+      // when a title in the table of contents is clicked, then
+      // show the corresponding item in the details box
+      $(".tripal_analysis_unigene_toc_item").click(function(){
+         $(".tripal-info-box").hide();
+         href = $(this).attr('href');
+         $(href).fadeIn('slow');
+         // we want to make sure our table of contents and the details
+         // box stay the same height
+         $("#tripal_analysis_unigene_toc").height($(href).parent().height());
+         return false;
+      }); 
+
+      // we want the base details to show up when the page is first shown 
+      // unless the user specified a specific block
+      var block = window.location.href.match(/\?block=.*/);
+      if(block != null){
+         block_title = block.toString().replace(/\?block=/g,'');
+         $("#tripal_analysis_unigene-"+block_title+"-box").show();
+      } else {
+         $("#tripal_analysis_unigene-base-box").show();
+      }
+      $("#tripal_analysis_unigene_toc").height($("#tripal_analysis_unigene-base-box").parent().height());
+   });
+}
+</script>
+
+<div id="tripal_analysis_unigene_details" class="tripal_details">
+
+   <!-- Basic Details Theme -->
+   <?php include('tripal_analysis_unigene/tripal_analysis_unigene_base.tpl.php'); ?>
+
+   <?php print $content ?>
+</div>
+
+<!-- Table of contents -->
+<div id="tripal_analysis_unigene_toc" class="tripal_toc">
+   <div id="tripal_analysis_unigene_toc_title" class="tripal_toc_title">Resources</div>
+   <span id="tripal_analysis_unigene_toc_desc" class="tripal_toc_desc"></span>
+   <ul id="tripal_analysis_unigene_toc_list" class="tripal_toc_list">
+
+   </ul>
+</div>
+
+<?php } ?>

+ 86 - 0
tripal_analysis_unigene/theme/tripal_analysis_unigene/tripal_analysis_unigene_base.tpl.php

@@ -0,0 +1,86 @@
+<?php
+$node = $variables['node'];
+$analysis = $variables['node']->analysis;
+
+// the description is a text field so we want to expand that
+$analysis = tripal_core_expand_chado_vars($analysis,'field','analysis.description');
+
+$unigene = $node->analysis->tripal_analysis_unigene;
+//dpm($node);
+
+?>
+<div id="tripal_analysis_unigene-base-box" class="tripal_analysis_unigene-info-box tripal-info-box">
+  <div class="tripal_analysis_unigene-info-box-title tripal-info-box-title">Unigene Details</div>
+  <div class="tripal_analysis_unigene-info-box-desc tripal-info-box-desc"></div>
+   <table id="tripal_analysis_unigene-table-base" class="tripal_analysis_unigene-table tripal-table tripal-table-vert">
+      <tr class="tripal_analysis_unigene-table-even-row tripal-table-even-row">
+        <th>Analysis Name</th>
+        <td><?php print $analysis->name; ?></td>
+      </tr>
+      <tr class="tripal_analysis_unigene-table-odd-row tripal-table-odd-row">
+        <th>Unigene Name</th>
+        <td><?php print $unigene->unigene_name; ?></td>
+      </tr>
+      <tr class="tripal_analysis_unigene-table-even-row tripal-table-even-row">
+        <th nowrap>Software</th>
+        <td><?php 
+          print $analysis->program; 
+          if($analysis->programversion){
+             print " (" . $analysis->programversion . ")"; 
+          }
+          if($analysis->algorithm){
+             print ". " . $analysis->algorithm; 
+          }
+          ?>
+        </td>
+      </tr>
+      <tr class="tripal_analysis_unigene-table-odd-row tripal-table-odd-row">
+        <th nowrap>Source</th>
+        <td><?php 
+          if($analysis->sourceuri){
+             print "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>"; 
+          } else {
+             print $analysis->sourcename; 
+          }
+          if($analysis->sourceversion){
+             print " (" . $analysis->sourceversion . ")"; 
+          }
+          ?>
+          </td>
+      </tr>
+      <tr class="tripal_analysis_unigene-table-even-row tripal-table-even-row">
+        <th nowrap>Date constructed</th>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$analysis->timeexecuted); ?></td>
+      </tr>
+      <tr class="tripal_analysis_unigene-table-odd-row tripal-table-odd-row">
+        <th nowrap>Description</th>
+        <td><?php print $analysis->description; ?></td>
+      </tr> 
+      <tr class="tripal_analysis_unigene-table-even-row tripal-table-even-row">
+        <th nowrap>Stats</th>
+        <td>
+             <?php if($unigene->num_reads){print "Number of reads: $unigene->num_reads<br>";} ?>
+             <?php if($unigene->num_clusters){print "Number of clusters: $unigene->num_clusters<br>";} ?>
+             <?php if($unigene->num_contigs){print "Number of contigs: $unigene->num_contigs<br>";} ?>
+             <?php if($unigene->num_singlets){print "Number of singlets: $unigene->num_singlets<br>";} ?>
+        </td>
+      </tr>  
+      <tr class="tripal_analysis_unigene-table-odd-row tripal-table-odd-row">
+        <th>Organisms</th>
+        <td><?php 
+            if($unigene->organisms and is_array($unigene->organisms)){
+               foreach($unigene->organisms as $organism){
+                  if($organism->nid){
+                     print "<i><a href=\"".url("node/$organism->nid")."\">$organism->genus $organism->species</i></a><br>";
+                  } else {
+                     print "<i>$organism->genus $organism->species</i><br>";
+                  }
+               }
+            } else {
+                // add message here with instructions for administrators to make this work.
+            }
+            ?>
+        </td>
+      </tr>       	                                
+   </table>   
+</div>

+ 61 - 0
tripal_analysis_unigene/theme/tripal_feature/tripal_feature_unigenes.tpl.php

@@ -0,0 +1,61 @@
+<?php
+$node = $variables['node'];
+$feature = $node->feature;
+$unigenes = $feature->tripal_analysis_unigene->unigenes;
+
+// if this feature has a unigene then we want to show the box
+if($unigenes){
+  //dpm($unigenes);
+?>
+<div id="tripal_feature-unigenes-box" class="tripal_feature-info-box tripal-info-box">
+  <div class="tripal_feature-info-box-title tripal-info-box-title">Unigenes</div>
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">This <?php print $feature->type_id->name ?> is part of the following unigenes:</div>
+  <?php if(count($unigenes) > 0){ ?>
+  <table id="tripal_feature-unigenes-table" class="tripal_feature-table tripal-table tripal-table-horz">
+    <tr>
+      <th>Unigene Name</th>
+      <th>Analysis Name</th>
+      <th>Sequence type in Unigene</th>
+    </tr>
+    <?php
+    $i = 0; 
+    foreach ($unigenes as $unigene){
+      $class = 'tripal-table-odd-row';
+      if($i % 2 == 0 ){
+         $class = 'tripal-table-even-row';
+      }
+      ?>
+      <tr class="<?php print $class ?>">
+        <td><?php 
+           if($unigene->nid){
+              print "<a href=\"".url("node/$unigene->nid")."\">$unigene->unigene_name</a>";
+           } else {
+              print $unigene->unigene_name;
+           }?>
+        </td>
+        <td><?php 
+           if($analysis->nid){
+              print "<a href=\"".url("node/$analysis->nid")."\">$analysis->name</a>";
+           } else {
+              print $analysis->name;
+           }?>
+        </td>
+        <td nowrap><?php 
+           if($unigene->singlet){
+              print "Singlet";
+           } else {
+              print $feature->type_id->name;
+           }?>
+        </td>
+      </tr>
+      <?php
+      $i++;  
+    } ?>
+  </table>
+  <?php } else { ?>
+    <div class="tripal-no-results">There are no unigenes for this feature</div> 
+  <?php }?>
+</div>
+<?php 
+}
+?>

+ 52 - 0
tripal_analysis_unigene/theme/tripal_organism/tripal_organism_unigenes.tpl.php

@@ -0,0 +1,52 @@
+<?php
+$node = $variables['node'];
+$organism = $node->organism;
+$unigenes = $organism->tripal_analysis_unigene->unigenes;
+
+//dpm($unigenes);
+?>
+<div id="tripal_organism-unigenes-box" class="tripal_feature-info-box tripal-info-box">
+  <div class="tripal_feature-info-box-title tripal-info-box-title">Unigenes</div>
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">Below is a list of unigenes available for <i><?php print $organism->genus ?> <?php print $organism->species ?></i>. Click the unigene name for further details.</div>
+  <?php if(count($unigenes) > 0){ ?>
+  <table id="tripal_organism-unigenes-table" class="tripal_feature-table tripal-table tripal-table-horz">
+    <tr>
+      <th>Unigene Name</th>
+      <th>Analysis Name</th>
+      <th>Date Constructed</th>
+      <th>Stats</th>
+    </tr>
+    <?php
+    $i = 0; 
+    foreach ($unigenes as $unigene){
+      $class = 'tripal-table-odd-row';
+      if($i % 2 == 0 ){
+         $class = 'tripal-table-even-row';
+      }
+      ?>
+      <tr class="<?php print $class ?>">
+        <td>
+           <?php 
+           if($unigene->nid){
+              print "<a href=\"".url("node/$unigene->nid")."\">$unigene->unigene_name</a>";
+           } else {
+              print $unigene->unigene_name;
+           }?>
+        </td>
+        <td><?php print $unigene->name; ?></td>
+        <td><?php print preg_replace("/^(\d+-\d+-\d+) .*/","$1",$unigene->timeexecuted); ?></td>
+        <td nowrap>
+             <?php if($unigene->num_reads){print "Reads: $unigene->num_reads<br>";} ?>
+             <?php if($unigene->num_clusters){print "Clusters: $unigene->num_clusters<br>";} ?>
+             <?php if($unigene->num_contigs){print "Contigs: $unigene->num_contigs<br>";} ?>
+             <?php if($unigene->num_singlets){print "Singlets: $unigene->num_singlets<br>";} ?>
+        </td>
+      </tr>
+      <?php
+      $i++;  
+    } ?>
+  </table>
+  <?php } else { ?>
+    <div class="tripal-no-results">There are no unigenes for this organism</div> 
+  <?php }?>
+</div>

+ 1 - 1
tripal_analysis_unigene/tripal_analysis_unigene.info

@@ -3,7 +3,7 @@ name = Tripal Unigene
 description = An analysis sub-module for displaying unigene analysis results.
 core = 6.x
 project = tripal_analysis_unigene
-package = Tripal Analyses
+package = Tripal Extensions
 version = 6.x-0.3b
 dependencies[] = tripal_core
 dependencies[] = tripal_feature

+ 128 - 0
tripal_core/tripal_core.api.inc

@@ -1535,3 +1535,131 @@ function tripal_core_delete_property($basetable, $record_id,$property,$cv_name){
    );
    return tripal_core_chado_delete($basetable.'prop',$match);
 }
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
+function tripal_create_moddir($module_name){
+   // make the data directory for this module
+   $data_dir = file_directory_path() . "/tripal/$module_name";
+   if(!file_check_directory($data_dir,FILE_CREATE_DIRECTORY|FILE_MODIFY_PERMISSIONS)){
+      $message = "Cannot create directory $data_dir. This module may not ".
+                 "behave correctly without this directory.  Please  create ".
+                 "the directory manually or fix the problem and reinstall.";
+      drupal_set_message($message,'error');      
+      watchdog('tripal_core',$message,array(),WATCHDOG_ERROR);
+   }
+}
+
+/**
+ *
+ *
+ * @ingroup tripal_core
+ */
+function tripal_get_moddir($module_name){
+   $data_dir = file_directory_path() . "/tripal/$module_name";
+   return $data_dir;
+}
+/**
+ * Set the Tripal Database
+ *
+ * The tripal_db_set_active function is used to prevent namespace collisions
+ * when chado and drupal are installed in the same database but in different
+ * schemas.  It is also used for backwards compatibility with older versions
+ * of tripal or in cases where chado is located outside of the Drupal database.
+ *
+ * @ingroup tripal_core
+ */
+function tripal_db_set_active($dbname){
+   global $db_url, $db_type;
+   $chado_exists = 0;
+
+   // only postgres can support search paths.  So if this is MysQL then
+   // just run the normal tripal_db_set_active function.
+   if(strcmp($db_type,'pgsql')==0){
+
+      // if the 'chado' database is in the $db_url variable then chado is 
+      // not in the same Drupal database
+      if(is_array($db_url)){ 
+         if(isset($db_url[$dbname])){
+            return db_set_active($dbname);
+         } 
+      }
+
+      // check to make sure the chado schema exists
+      $sql = "select nspname from pg_catalog.pg_namespace where nspname = 'chado'";
+      if(db_fetch_object(db_query($sql))){
+         $chado_exists = 1;
+      }
+
+      // here we make the assumption that the default database schema is
+      // 'public'.  This will most likely always be the case but if not,
+      // then this code will break
+      if($chado_exists && strcmp($dbname,'chado')==0){
+         db_query("set search_path to %s",'chado,public');  
+         return 'public,chado';
+      } 
+      elseif($chado_exists) {
+         db_query("set search_path to %s",'public,chado');  
+         return 'chado,public';
+      }
+      else {
+         return db_set_active($dbname);
+      }
+   }
+   else return db_set_active($dbname);
+}
+/**
+ * Purpose: Get max rank for a given set of criteria
+ *   This function was developed with the many property tables in chado in mind
+ *
+ * @param $tablename
+ *    The name of the chado table you want to select the max rank from this table must contain a 
+ *    rank column of type integer
+ * @param $where_options
+ *   where options should include the id and type for that table to correctly
+ *     group a set of records together where the only difference are the value and rank
+ * @code 
+ *  array(
+ *     <column_name> => array(
+ *	      'type' => <type of column: INT/STRING>,
+ *		   'value' => <the value you want to filter on>,
+ *			'exact' => <if TRUE use =; if FALSE use ~>,
+ *		)
+ *	)
+ * @endcode
+ * @return the maximum rank
+ *
+ * @ingroup tripal_core
+ */
+function tripal_get_max_chado_rank ($tablename, $where_options) {
+
+	$where= array();
+	//generate the where clause from supplied options
+	// the key is the column name
+	foreach ($where_options as $key => $val_array) {
+		if (preg_match('/INT/', $val_array['type'])) {
+			$where[] = $key."=".$val_array['value'];
+		} else {
+			if ($val_array['exact']) { $operator='='; }
+			else { $operator='~'; }
+			$where[] = $key.$operator."'".$val_array['value']."'";
+		}
+	}
+	
+  $previous_db = tripal_db_set_active('chado');
+  $result = db_fetch_object(db_query(
+    "SELECT max(rank) as max_rank, count(rank) as count FROM %s WHERE %s",
+    $tablename,
+    implode(' AND ',$where)
+  ));
+  tripal_db_set_active($previous_db);
+	//drupal_set_message("Max Rank Query=SELECT max(rank) as max_rank, count(rank) as count FROM ".$tablename." WHERE ".implode(' AND ',$where));
+	if ($result->count > 0) {
+	  return $result->max_rank;
+	} else {
+		return -1;
+	}
+}

+ 2 - 154
tripal_core/tripal_core.module

@@ -50,32 +50,7 @@ function tripal_core_init(){
    }
 }
 
-/**
- *
- *
- * @ingroup tripal_core
- */
-function tripal_create_moddir($module_name){
-   // make the data directory for this module
-   $data_dir = file_directory_path() . "/tripal/$module_name";
-   if(!file_check_directory($data_dir,FILE_CREATE_DIRECTORY|FILE_MODIFY_PERMISSIONS)){
-      $message = "Cannot create directory $data_dir. This module may not ".
-                 "behave correctly without this directory.  Please  create ".
-                 "the directory manually or fix the problem and reinstall.";
-      drupal_set_message($message,'error');      
-      watchdog('tripal_core',$message,array(),WATCHDOG_ERROR);
-   }
-}
 
-/**
- *
- *
- * @ingroup tripal_core
- */
-function tripal_get_moddir($module_name){
-   $data_dir = file_directory_path() . "/tripal/$module_name";
-   return $data_dir;
-}
 
 /**
  *
@@ -97,16 +72,6 @@ function tripal_core_menu() {
       'file path' => drupal_get_path('module', 'system'),
    );
 
-   // the administative settings menu
-/*   $items['admin/tripal/tripal_core'] = array(
-     'title' => 'Tripal core settings',
-     'description' => 'Tripal Settings',
-     'page callback' => 'drupal_get_form',
-     'page arguments' => array('tripal_core_admin'),
-     'access arguments' => array('access administration pages'),
-     'type' => MENU_NORMAL_ITEM,
-   );
- */
    $items['admin/tripal/tripal_jobs'] = array(
      'title' => 'Jobs',
      'description' => 'Jobs managed by Tripal',
@@ -221,32 +186,10 @@ function tripal_core_menu() {
   return $items;
 }
 
-/**
- *
- *
- * @ingroup tripal_core
- */
-function tripal_core_admin () {
-
 
-   $form['chado_feature_data_url'] = array (
-      '#title'       => t('URL for data files'),
-      '#type'        => t('textfield'),
-      '#description' => t("This is the base URL location (without a leading forward slash)  for where files (e.g. blast .xml files) related to each feature are stored. All files available for download or parsing that a feature needs for display should be located in this base directory."), 
-      '#required'    => TRUE,
-      '#default_value' => variable_get('chado_feature_data_url','sites/default/files/data'),
-   );
-   
-   return system_settings_form($form);
-}
 
 /**
- * Set the Tripal Database
  *
- * The tripal_db_set_active function is used to prevent namespace collisions
- * when chado and drupal are installed in the same database but in different
- * schemas.  It is also used for backwards compatibility with older versions
- * of tripal or in cases where chado is located outside of the Drupal database.
  *
  * @param $dbname
  *   The name of the database to switch to as indicated in settings.php
@@ -257,51 +200,6 @@ function tripal_core_admin () {
  *
  * @ingroup tripal_chado_api
  */
-function tripal_db_set_active($dbname){
-   global $db_url, $db_type;
-   $chado_exists = 0;
-
-   // only postgres can support search paths.  So if this is MysQL then
-   // just run the normal tripal_db_set_active function.
-   if(strcmp($db_type,'pgsql')==0){
-
-      // if the 'chado' database is in the $db_url variable then chado is 
-      // not in the same Drupal database
-      if(is_array($db_url)){ 
-         if(isset($db_url[$dbname])){
-            return db_set_active($dbname);
-         } 
-      }
-
-      // check to make sure the chado schema exists
-      $sql = "select nspname from pg_catalog.pg_namespace where nspname = 'chado'";
-      if(db_fetch_object(db_query($sql))){
-         $chado_exists = 1;
-      }
-
-      // here we make the assumption that the default database schema is
-      // 'public'.  This will most likely always be the case but if not,
-      // then this code will break
-      if($chado_exists && strcmp($dbname,'chado')==0){
-         db_query("set search_path to %s",'chado,public');  
-         return 'public,chado';
-      } 
-      elseif($chado_exists) {
-         db_query("set search_path to %s",'public,chado');  
-         return 'chado,public';
-      }
-      else {
-         return db_set_active($dbname);
-      }
-   }
-   else return db_set_active($dbname);
-}
-
-/**
- *
- *
- * @ingroup tripal_core
- */
 function tripal_core_is_chado_installed(){
    global $db_url, $db_type;
 
@@ -335,58 +233,6 @@ function tripal_core_views_api() {
    );
 }
 
-/**
- * Purpose: Get max rank for a given set of criteria
- *   This function was developed with the many property tables in chado in mind
- *
- * @param $tablename
- *    The name of the chado table you want to select the max rank from this table must contain a 
- *    rank column of type integer
- * @param $where_options
- *   where options should include the id and type for that table to correctly
- *     group a set of records together where the only difference are the value and rank
- * @code 
- *  array(
- *													<column_name> => array(
- *														'type' => <type of column: INT/STRING>,
- *														'value' => <the value you want to filter on>,
- *														'exact' => <if TRUE use =; if FALSE use ~>,
- *													)
- *				)
- * @endcode
- * @return the maximum rank
- *
- * @ingroup tripal_core
- */
-function tripal_get_max_chado_rank ($tablename, $where_options) {
-
-	$where= array();
-	//generate the where clause from supplied options
-	// the key is the column name
-	foreach ($where_options as $key => $val_array) {
-		if (preg_match('/INT/', $val_array['type'])) {
-			$where[] = $key."=".$val_array['value'];
-		} else {
-			if ($val_array['exact']) { $operator='='; }
-			else { $operator='~'; }
-			$where[] = $key.$operator."'".$val_array['value']."'";
-		}
-	}
-	
-  $previous_db = tripal_db_set_active('chado');
-  $result = db_fetch_object(db_query(
-    "SELECT max(rank) as max_rank, count(rank) as count FROM %s WHERE %s",
-    $tablename,
-    implode(' AND ',$where)
-  ));
-  tripal_db_set_active($previous_db);
-	//drupal_set_message("Max Rank Query=SELECT max(rank) as max_rank, count(rank) as count FROM ".$tablename." WHERE ".implode(' AND ',$where));
-	if ($result->count > 0) {
-	  return $result->max_rank;
-	} else {
-		return -1;
-	}
-}
 
 /**
  *
@@ -400,3 +246,5 @@ function tripal_core_theme () {
       ),
    );
 }
+
+