Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Final modifications. Working download link and image generation. Notes
authormiles <miles@localhost>
Wed, 15 Aug 2012 19:09:12 +0000 (19:09 +0000)
committermiles <miles@localhost>
Wed, 15 Aug 2012 19:09:12 +0000 (19:09 +0000)
for future: Downloadable image doesn't have special grey and gold
squares representing 0 and 1 genes, respectively. Possibility of
modification later. If the visual effects of the scroll bars on
heatMap.php page becomes an issue, consider surrounding current div tag
with an additional div tag in order to simulate scrolling.

svn path=/; revision=376

Personnel/miles/Web Page/ClusterInfo.php
Personnel/miles/Web Page/ClusterSpeciesInfo.php
Personnel/miles/Web Page/Heatmap.jar
Personnel/miles/Web Page/SpeciesInfo.php
Personnel/miles/Web Page/heatMap.php

index dda7d0fddd56f8f721dc3203b13c13fb3f94532c..af1718e9a926c8a501f1d0a3bda452a6945debfe 100644 (file)
@@ -16,15 +16,19 @@ $password="inparanoid-read-user_pw";
 $database="inparanoid_data";
 $url="floret.cgrb.oregonstate.edu:3306";
 
+$info = explode(",",$_POST['param']);
+
 $connection=mysql_connect($url,$username,$password);
 mysql_select_db($database);
-$query="select species, gene from super_clust where super_id=" . $_POST['param'] . " order by species";
+$query="select species, gene from super_clust where super_id=" . $info[0] . " order by species";
 $results=mysql_query($query);
 
+$numRows = mysql_num_rows($results);
+
 if(!$results) {
   echo "DB Error, could not list tables";
   }
-echo "Genes contained within this cluster: <br /> <br />";
+echo "Cluster " . $info[1] . " contains " . $numRows . " genes: <br /> <br />";
 
 $row = mysql_fetch_row($results);
 while($row != null) {
index 98a8c97f80858c3aa5edc9853bc5b7f1e19820d3..0602cb301662e47920050d93b441f085c4682fdd 100644 (file)
@@ -15,6 +15,7 @@ $info=explode(",", $_POST['param']);
 $cluster=$info[0];
 $species=$info[1];
 $clusterIndex=$info[2];
+$count = $info[3];
 
 $connection=mysql_connect($url,$username,$password);
 mysql_select_db($database);
@@ -26,7 +27,7 @@ if(!$results) {
   echo "DB Error, could not list tables";
   }
 
-echo str_replace("_", " ", $species) . " has the following genes in cluster " . $clusterIndex . ": <br /> <br />";
+echo str_replace("_", " ", $species) . " has " . $count . " genes in cluster " . $clusterIndex . ": <br /> <br />";
 
 $row = mysql_fetch_row($results);
 while($row != null) {
index fa7e9ece6f6c86655088b95fd1f8b60f49dce0e3..a39e06fda33d376313e7a9076be78eeb90852a05 100644 (file)
Binary files a/Personnel/miles/Web Page/Heatmap.jar and b/Personnel/miles/Web Page/Heatmap.jar differ
index 15a317c272cab79d7c00f8a83dd838c31f377dc6..62c8e94499298d5d10975ec977684827e94c94c4 100644 (file)
@@ -40,10 +40,12 @@ mysql_select_db($database);
 $query="select gene,super_id from super_clust where species=\"" . $species . "\" and (" . $clusters . ")";
 $results=mysql_query($query);
 
+$numRows = mysql_num_rows($results);
+
 if(!$results) {
   echo "DB Error, could not list tables";
   }
-echo str_replace("_"," ",$species) . " has the following genes: <br /> <br />";
+echo str_replace("_"," ",$species) . " has " . $numRows . " genes in the surveyed clusters: <br /> <br />";
 
 echo "GENE ID  --------------------  CLUSTER ID <br \>";
 
index 294e0f71041b208442496e0baecaf9a0dcdf052d..e3124c7f30f2dea53a5ff654ead6c0596d5ca89d 100644 (file)
@@ -18,7 +18,8 @@ if(!preg_match("/[a-zA-Z0-9\.]/", substr($input,-1))) {
   $input = substr_replace($input ,"",-1);
   }
 }
-exec("java -jar Heatmap.jar " . $input, $output);
+$finalInput = "webpage " . $input;
+exec("java -Djava.awt.headless=true -jar Heatmap.jar " . $finalInput, $output);
 
 //main heatmap data parsing
 $tmp;
@@ -111,8 +112,6 @@ $height = 25 * $clusterCount + 200 + 20 * sizeof($clickableGenes);
 
 <br> <br> <br> <br> <br> <br>
 
-
-<body>
 Click on a species name, cluster number, or cell for more information.
 <br> Scroll down to see more clusters, right to see more species (if any exist).
 <br>
@@ -127,12 +126,17 @@ Click on a species name, cluster number, or cell for more information.
 <input type="submit" value="Jump to Cluster:" onClick="return jumpToCluster()"/>
 <input type="text" name="cluster" />
 </form>
-</body>
 
 <div id="canvasDiv" style="overflow: auto; height: 515px; width: 1100px;" onscroll="drawMap();">
 <canvas id="myCanvas" width="1500" height="1000" style="border:1px solid #c3c3c3;">
 Your browser does not support the canvas element.
-</canvas>
+</canvas> </div>
+
+<form name="downloadImage" >
+<input type="button" value="Download as JPG" onClick="generateImage()"/>
+</form>
+
+</body>
 
 <script type="text/javascript">
 
@@ -351,7 +355,7 @@ function drawKey() {
     heatMap.fillStyle="#" + redcolor + "00" + bluecolor;
     heatMap.fillRect(1030, 5+cellSize+(k-1)*(cellSize+5) + (topOffset-topScrollOffset),cellSize,cellSize);
     heatMap.fillStyle="#000000";
-    var key = Math.floor((k-2)*((maxCount-2)/2) + 2);
+    var key = Math.floor((k-2)*((maxCount-2)/(i-3)) + 2);
   //  var key = Math.floor((k+1)*(maxCount-2)/i);
     var txt = "= " + key;
     heatMap.fillText(txt,1060,5+(3/2*cellSize)+(k-1)*(cellSize+5) + (topOffset-topScrollOffset));
@@ -360,8 +364,6 @@ function drawKey() {
 
 }
 
-alert(maxCount);
-
 
 // drawing the clickable genes
 // for(var i=0; i<clickableGenes.length; i++) {
@@ -379,8 +381,7 @@ function showInfo(event) {
   if((x<leftOffset-leftScrollOffset) && (y>topOffset-topScrollOffset) && ((y+scrolledTop)<(topOffset + cellSize*clusterCount))) {
     var index = Math.floor(((y+topScrollOffset)-topOffset)/cellSize) + Math.floor(scrolledTop/25);
     var cluster = allClusterIDs[index];
-    getClusterInfo(cluster);
-    alert(index);
+    getClusterInfo(cluster, index);
   }
   if((y<topOffset-topScrollOffset) && (x>leftOffset-leftScrollOffset)) {
     var index = Math.floor(((x+leftScrollOffset)-leftOffset)/cellSize) + Math.floor(scrolledLeft/25);
@@ -392,7 +393,7 @@ function showInfo(event) {
     var cluster = allClusterIDs[clusterIndex];
     var index = Math.floor(((x+leftScrollOffset)-leftOffset)/cellSize) + Math.floor(scrolledLeft/25);
     var species = allSpecies[index];
-    getBoxInfo(cluster, species, clusterIndex+1);
+    getBoxInfo(cluster, species, clusterIndex, index);
   }
   if(((y+scrolledTop)>(topOffset + cellSize*clusterCount))) {
     var index = Math.floor((y+topScrollOffset-topOffset+cellSize*clusterCount)/cellSize)+Math.floor(scrolledTop/25);
@@ -454,24 +455,27 @@ function showInfo(event) {
 }
 
 
-function getClusterInfo(cluster) {
+function getClusterInfo(cluster, index) {
   document.infoForm.action = "ClusterInfo.php";
-  document.infoForm.param.value = cluster;
+  var userIndex = index+1;
+  document.infoForm.param.value = cluster + "," + userIndex;
   document.infoForm.submit();
   }
 
 
 function getSpeciesInfo(species) {
   document.infoForm.action = "SpeciesInfo.php";
-  var pass = [species]
+  var pass = [species];
   pass = pass.concat(allClusterIDs);
-  document.infoForm.param.value = (pass);
+  document.infoForm.param.value = pass;
   document.infoForm.submit();
   }
 
-function getBoxInfo(cluster, species, userIndex) {
+function getBoxInfo(cluster, species, clusterIndex, speciesIndex) {
+  var userIndex = clusterIndex+1;
+  var count = heatMapData[speciesIndex][clusterIndex];
   document.infoForm.action = "ClusterSpeciesInfo.php";
-  document.infoForm.param.value = cluster + "," + species + "," + userIndex;
+  document.infoForm.param.value = cluster + "," + species + "," + userIndex + "," + count;
   document.infoForm.submit();
   }
 
@@ -482,6 +486,12 @@ function jumpToCluster() {
   return false;
 }
 
+function generateImage() {
+  document.infoForm.action="download.php";
+  document.infoForm.param.value = "unset DISPLAY && java -Djava.awt.headless=true -jar Heatmap.jar image " + "<?php echo $input; ?>";
+  document.infoForm.submit();
+}
+
 drawMap(true);
 
 canvas.addEventListener('mouseup', showInfo, false);
@@ -492,20 +502,5 @@ canvas.addEventListener('mouseup', showInfo, false);
 
 
 <!--
-10. Linkability from clickable genes?
-13. Update user instructions on use
-14. Jump-to-cluster Box
-
-CHECK 1. Scrolling up/left
-CHECK 2. Stop scrolling past the end
-CHECK 3. Fix so that you can see the key
-CHECK 4. Draw 7 ref points on key, not 5
-CHECK 5. Fix clickability
-CHECK 6. Resizable boxes
-CHECK 7. Make hardcoded numbers into variables
-CHECK 8. Fix heatmap initialization
-CHECK 9. Fix text size/positioning for resizable boxes
-CHECK 11. Fix weird row at the bottom of the heatmap that isn't rendering
-CHECK 12. Fix upwards scroll speed
-
--->
\ No newline at end of file
+
+-->