return $ind;
}
-//getting the information from SQL in order to create clickable gene IDs below the heatMap
-$query = "select gene, species, super_id from super_clust where " . $logic . " order by species";
-mysql_select_db($database);
-$results=mysql_query($query);
-if(!$results) {
- echo "<br \> Database error, could not list tables.";
- }
-
-$clickableGenes;
-$k=0;
-for($row=mysql_fetch_row($results); $row != null; $k++) {
- $clickableGenes[$k] = ($row[0] . "," . $row[1] . "," . (array_search2d($row[2], $allClusterIDs)+1));
- $row=mysql_fetch_row($results);
-
-
-
-
$width = 25*$speciesCount + 100;
-$height = 25 * $clusterCount + 200 + 20 * sizeof($clickableGenes);
-}
+$height = 25 * $clusterCount + 200;
?>
var maxCount = <?php echo $maxCount; ?>;
var clusterCount = <?php echo $clusterCount; ?>;
-var rawClickableGenes = "<?php echo implode(";", $clickableGenes); ?>";
-var rareClickableGenes = rawClickableGenes.split(";");
-var clickableGenes = new Array(rareClickableGenes.length);
-for(var i=0; i<rareClickableGenes.length; i++) {
- clickableGenes[i] = rareClickableGenes[i].split(",");
-}
var canvas = document.getElementById("myCanvas");
var heatMap = canvas.getContext("2d");
}
-// drawing the clickable genes
-// for(var i=0; i<clickableGenes.length; i++) {
-// rawspecies = clickableGenes[i][1];
-// species = rawspecies.replace("_", " ");
-// var txt = clickableGenes[i][0] + " from " + species + " in cluster " + clickableGenes[i][2];
-// heatMap.fillText(txt, 25, i*20 + 215 + 25 * clusterCount);
-// }
-
-
function showInfo(event) {
var x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft - canvas.offsetLeft;
var y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop - canvas.offsetTop;
var species = allSpecies[index];
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);
- var xVal = 0;
- var yVal = 0;
- var species = clickableGenes[index][1];
- var cluster = clickableGenes[index][2] - 1;
- yVal = scrolledTop + topOffset + cluster*cellSize;
- for(var i=0; i < allSpecies.length; i++) {
- if(allSpecies[i] == species) {
- xVal = scrolledLeft + leftOffset + i*cellSize;
- }
- }
- heatMap.strokeStyle = "#22FF99";
- heatMap.strokeRect(xVal+borderWidth/2,yVal+borderWidth/2, cellSize-2*borderWidth, cellSize-2*borderWidth);
- heatMap.strokeRect(xVal+borderWidth,yVal+borderWidth, cellSize-3*borderWidth, cellSize-3*borderWidth);
- var xCoord = leftOffset+lastX*cellSize;
- var yCoord = topOffset+lastY*cellSize;
- heatMap.fillStyle = lastColor;
- heatMap.fillRect(xCoord, yCoord, cellSize-borderWidth, cellSize-borderWidth);
- if(lastX == ((xVal+scrolledLeft)-leftOffset)/cellSize) {
- //TODO find out if this if statement can just be {}, or if i need to actually draw the rectangle
- heatMap.strokeStyle = "#22FF99";
- heatMap.strokeRect(xVal+borderWidth/2,yVal+borderWidth/2, cellSize-2*borderWidth, cellSize-2*borderWidth);
- heatMap.strokeRect(xVal+borderWidth,yVal+borderWidth, cellSize-3*borderWidth, cellSize-3*borderWidth);
- } else {
- lastX = ((xVal+scrolledLeft)-leftOffset)/cellSize;
- lastY = cluster;
- }
- var count = parseInt(heatMapData[lastX][lastY]);
- var redcolor = "00";
- var bluecolor = "00";
- var greencolor = "00";
- if(count == 0) {
- redcolor = "5C";
- greencolor = "5C";
- bluecolor = "5C";
- }
- else if(count == 1) {
- redcolor = "CF";
- greencolor = "B5";
- bluecolor = "2B";
- }
- else {
- count = count - 2;
- var redfrequency = Math.floor((count / (maxCount-2)) * 255);
- redcolor = redfrequency.toString(16);
- var bluefrequency = 255 - redfrequency;
- bluecolor = bluefrequency.toString(16);
- if(redcolor == "0") {
- redcolor = "00";
- }
- if(bluecolor == "0") {
- bluecolor = "00";
- }
- }
- lastColor = "#" + redcolor + greencolor + bluecolor;
- }
}