Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
View Ontology Changes:
authormiles <miles@localhost>
Wed, 27 Mar 2013 20:43:57 +0000 (20:43 +0000)
committermiles <miles@localhost>
Wed, 27 Mar 2013 20:43:57 +0000 (20:43 +0000)
        -namespace selection now fully functional, error messages
updated and made relevant

Info Choice Changes:
        -namespace selection support
        -minor javascript changes

svn path=/; revision=452

Personnel/miles/Web Page/infoChoice.php
Personnel/miles/Web Page/viewOntology.php

index c1a3d125698e29319a41433d7069c93c748bd7b4..352ed8b555578cafd65393e9105237a248434571 100644 (file)
@@ -4,10 +4,16 @@
 <?php
 if($_POST["type"] == "cluster") {
 
-      echo "<form name=\"Branch\" method=\"post\" action=\"viewOntology.php\">\n";
-      echo "<input type=\"submit\" value=\"View Ontology\">\n";
-      echo "<input type=\"hidden\" name=\"param\" value=\"\">\n";
-      echo "</form>\n";
+      echo "<form name=\"viewOntology\" method=\"post\" action=\"viewOntology.php\">\n";
+      echo "<p> Possible Ontologies: <br>";
+      echo "<input type=\"checkbox\" name=\"Anatomy\" value=\"Anatomy\">";
+      echo "Anatomy <br>";
+      echo "<input type=\"checkbox\" name=\"Growth\" value=\"Growth\">";
+      echo "Growth <br>";
+      echo "<input type=\"submit\" value=\"View Ontology\" onClick=process()>\n";
+      echo "<input type=\"hidden\" name=\"param\" value=\"null\">\n";
+      echo "<input type=\"hidden\" name=\"ontologies\" value=\"\">\n";
+      echo "</form>";
       echo "<br> <br>\n";
 
       $username="inparanoid-read-user";
@@ -138,10 +144,16 @@ mysql_close($connection);
 
       echo str_replace("_", " ", $species) . " has " . $count . " genes in cluster " . $clusterIndex . ": <br> <br>\n";
 
-      echo "<form name=\"Branch\" method=\"post\" action=\"viewOntology.php\">\n";
-      echo "<input type=\"submit\" value=\"View Ontology\">\n";
-      echo "<input type=\"hidden\" name=\"param\" value=\"\">\n";
-      echo "</form>\n";
+      echo "<form name=\"viewOntology\" method=\"post\" action=\"viewOntology.php\">\n";
+      echo "<p> Possible Ontologies: <br>";
+      echo "<input type=\"checkbox\" name=\"Anatomy\" value=\"Anatomy\">";
+      echo "Anatomy <br>";
+      echo "<input type=\"checkbox\" name=\"Growth\" value=\"Growth\">";
+      echo "Growth <br>";
+      echo "<input type=\"submit\" value=\"View Ontology\" onClick=process()>\n";
+      echo "<input type=\"hidden\" name=\"param\" value=\"null\">\n";
+      echo "<input type=\"hidden\" name=\"ontologies\" value=\"\">\n";
+      echo "</form>";
       echo "<br> <br>\n";
 
       $genes="";
@@ -166,8 +178,22 @@ mysql_close($connection);
 
 <script type="text/javascript">
 if(<?php echo (($_POST["type"] == "cluster") || ($_POST["type"] == "box")) ?> == 1) {
-  document.Branch.param.value = "<?php echo $genes ?>";
+  document.viewOntology.param.value = "<?php echo $genes ?>";
 }
+
+function process() {
+  var ontologies = "null";
+  if(document.viewOntology.Anatomy.checked) ontologies = document.viewOntology.Anatomy.value;
+  if(document.viewOntology.Growth.checked) {
+    if(ontologies == "null") ontologies = document.viewOntology.Growth.value;
+    else ontologies = ontologies + "," + document.viewOntology.Growth.value;
+  }
+  document.viewOntology.ontologies.value = ontologies;
+}
+
+
+
+//2533488419
 </script>
 
 </body>
index c956fc46a7bff951712efa22f5884193f2bf59c6..cfbeb700c032bb1d81ed1100082b4a23d5677128 100644 (file)
 $genes;
 $geneProductIDs = "";
 $terms = "";
+$ontologies;
+if($_POST["ontologies"] != "null") {
 
+$ontologies = explode(",",$_POST["ontologies"]);
 
-//get rid of any of those messy .somethings after the gene ID
-$tmp = explode(",",$_POST['param']);
-for($i = 0; $i < sizeof($tmp); $i ++) {
-  $newTmp = explode(".",$tmp[$i]);
-  $tmp[$i] = $newTmp[0];
-}
-$genes = $tmp;
+  for($i = 0; $i < sizeof($ontologies); $i++) {
+    if($ontologies[$i] == "Anatomy") $ontologies[$i] = "plant_anatomy";
+    if($ontologies[$i] == "Growth") $ontologies[$i] = "plant_structure_development_stage";
+
+  }
+
+  //get rid of any of those messy .somethings after the gene ID
+  $tmp = explode(",",$_POST['param']);
+  for($i = 0; $i < sizeof($tmp); $i ++) {
+    $newTmp = explode(".",$tmp[$i]);
+    $tmp[$i] = $newTmp[0];
+  }
+  $genes = $tmp;
 
 
-$username="po-read-user";
-$password="po-read-user_pw";
-$database="po_live";
-$url="floret.cgrb.oregonstate.edu:3306";
+  $username="po-read-user";
+  $password="po-read-user_pw";
+  //$database="po_live";
+  $database="po_live";
+  $url="floret.cgrb.oregonstate.local:3306";
 
-$connection=mysql_connect($url,$username,$password);
-mysql_select_db($database);
+  $connection=mysql_connect($url,$username,$password);
+  mysql_select_db($database);
 
-$logic = "where gene_product.full_name='";
-for($i = 0; $i < sizeof($genes); $i++) {
-  $toAdd = $genes[$i] . "'";
-  if($i + 1 < sizeof($genes)) {
-    $toAdd = $toAdd . " or gene_product.full_name='";
+  $logic = "where gene_product.full_name='";
+  for($i = 0; $i < sizeof($genes); $i++) {
+    $toAdd = $genes[$i] . "'";
+    if($i + 1 < sizeof($genes)) {
+      $toAdd = $toAdd . " or gene_product.full_name='";
+    }
+    $logic = $logic . $toAdd;
   }
-  $logic = $logic . $toAdd;
-}
 
-$query = "select full_name from gene_product " . $logic . " order by full_name";
-$results=mysql_query($query);
-$i = 0;
-$finalGenes = array();
-$row = mysql_fetch_row($results);
-while($row != null) {
-  $finalGenes[$i] = $row[0];
+
+
+
+  $query = "select full_name from gene_product " . $logic . " order by full_name";
+
+  $results=mysql_query($query);
+  $i = 0;
+  $finalGenes = array();
   $row = mysql_fetch_row($results);
-  $i ++; //NOTE
-  }
+  while($row != null) {
+    $finalGenes[$i] = $row[0];
+    $row = mysql_fetch_row($results);
+    $i ++; //NOTE
+    }
 
-$logic = "where gene_product.full_name='";
-for($i = 0; $i < sizeof($finalGenes); $i++) {
-  $toAdd = $finalGenes[$i] . "'";
-  if($i + 1 < sizeof($finalGenes)) {
-    $toAdd = $toAdd . " or gene_product.full_name='";
+  $logic = "where gene_product.full_name='";
+  for($i = 0; $i < sizeof($finalGenes); $i++) {
+    $toAdd = $finalGenes[$i] . "'";
+    if($i + 1 < sizeof($finalGenes)) {
+      $toAdd = $toAdd . " or gene_product.full_name='";
+    }
+    $logic = $logic . $toAdd;
   }
-  $logic = $logic . $toAdd;
-}
-//This all gets the list of terms for the x-axis
 
+  $ontLogic = "where ";
 
-$query="select concat(acc, \"- \", name),term_type from (select distinct name, acc,term_type from (select term_id from gene_product left join association on association.gene_product_id=gene_product.id " . $logic . ") as mytable left join term on term_id=term.id order by acc) as secondTable";
-$results=mysql_query($query);
+  for($i = 0; $i < sizeof($ontologies); $i++) {
+    $ontLogic = $ontLogic . "term_type='" . $ontologies[$i] . "' ";
+    if($i + 1 < sizeof($ontologies)) $ontLogic = $ontLogic . "or ";
+  };
+  //This all gets the list of terms for the x-axis
 
-$i = 0;
-for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) {
-  $add = "";
-  if($row[1]=="plant_anatomy") $add= " (A)";
-  if($row[1]=="plant_structure_development_stage") $add= " (G)";
-  $terms[$i][0] = $row[0];
-  $terms[$i][1] = $add;
-  $i++;
-  }
 
-//new testing stuff with optimized queries
+  $query="select concat(acc, \"- \", name),term_type from (select distinct name, acc,term_type from (select term_id from gene_product left join association on association.gene_product_id=gene_product.id " . $logic . ") as mytable left join term on term_id=term.id " . $ontLogic . "order by acc) as secondTable";
+  $results=mysql_query($query);
+
+  $i = 0;
+  for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) {
+    $add = "";
+    if($row[1]=="plant_anatomy") $add= " (A)";
+    if($row[1]=="plant_structure_development_stage") $add= " (G)";
+    $terms[$i][0] = $row[0];
+    $terms[$i][1] = $add;
+    $i++;
+    }
 
+  //new testing stuff with optimized queries
 
-$query = "select full_name,term_id,concat(acc, \"- \", name),evnum from (select full_name,term_id,count(*) as evnum from gene_product left join association on association.gene_product_id=gene_product.id " . $logic . "group by full_name,term_id order by full_name,term_id) as temp left join term on term.id=term_id order by full_name,acc";
-$results=mysql_query($query);
 
-$t = 0;
-$g = -1;
-$cellData;
-for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) {
-  if(($g == -1) || ($finalGenes[$g] != $row[0])) {
-    $g ++;
+  $query = "select full_name,term_id,concat(acc, \"- \", name),evnum from (select full_name,term_id,count(*) as evnum from gene_product left join association on association.gene_product_id=gene_product.id " . $logic . "group by full_name,term_id order by full_name,term_id) as temp left join term on term.id=term_id order by full_name,acc";
+  $results=mysql_query($query);
+
+  $t = 0;
+  $g = -1;
+  $cellData;
+  for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) {
+    if(($g == -1) || ($finalGenes[$g] != $row[0])) {
+      $g ++;
+      for($t = 0; $t < sizeof($terms); $t++) {
+       $cellData[$g][$t][0] = 0;
+      }
+    }
     for($t = 0; $t < sizeof($terms); $t++) {
-      $cellData[$g][$t][0] = 0;
+      if($row[2] == $terms[$t][0]) {
+       $cellData[$g][$t][0] = 1;
+       $cellData[$g][$t][1] = $row[3];
+      } //TODO optimize this by using PO ID's instead of the entire term string
     }
-  }
-  for($t = 0; $t < sizeof($terms); $t++) {
-    if($row[2] == $terms[$t][0]) {
-      $cellData[$g][$t][0] = 1;
-      $cellData[$g][$t][1] = $row[3];
-    } //TODO optimize this by using PO ID's instead of the entire term string
-  }
 
-}
+  }
 
-if(empty($cellData)) {
-echo "These genes are not yet annotated in our database.";
-}
-else {
-  $semiFinalCellData;
-  for ($i = 0; $i < sizeof($cellData); $i ++)
-    {
-    for($j = 0; $j < sizeof($cellData[$i]); $j++)
+  if(empty($cellData)) {
+  echo "These genes are not yet annotated in our database.";
+  }
+  else {
+    $semiFinalCellData;
+    for ($i = 0; $i < sizeof($cellData); $i ++)
       {
-      $semiFinalCellData[$i][$j] = implode(",",$cellData[$i][$j]);
+      for($j = 0; $j < sizeof($cellData[$i]); $j++)
+       {
+       $semiFinalCellData[$i][$j] = implode(",",$cellData[$i][$j]);
+       }
       }
-    }
 
 
-  $finalCellData;
-  for ($i = 0; $i < sizeof($semiFinalCellData); $i ++)
-    {
-    $finalCellData[$i] = implode(";", $semiFinalCellData[$i]);
+    $finalCellData;
+    for ($i = 0; $i < sizeof($semiFinalCellData); $i ++)
+      {
+      $finalCellData[$i] = implode(";", $semiFinalCellData[$i]);
+      }
+    $printTerms;
+    for($i = 0; $i < sizeof($terms); $i ++) {
+      $printTerms[$i] = $terms[$i][0] . $terms[$i][1];
     }
-  $printTerms;
-  for($i = 0; $i < sizeof($terms); $i ++) {
-    $printTerms[$i] = $terms[$i][0] . $terms[$i][1];
   }
-}
 
 
 
-$height = 800;
-$width = 1200;
+  $height = 800;
+  $width = 1200;
+} else {
+
+echo "No ontologies were selected!";
 
+}
 ?>
 <div id="Legend" style="float: right; height: 200px; width: 400px;">
 Note: The colors have no relevance to the data, they simply serve to distinguish rows visually. <br> <br>
@@ -429,7 +454,6 @@ function downloadTabDem() {
   document.downloadImage.submit();
 }
 
-
 </script>
 
 </body>