From e34923f19fcdbe0b49e7881664b8b89dfe8820b7 Mon Sep 17 00:00:00 2001 From: miles Date: Wed, 27 Mar 2013 19:04:12 +0000 Subject: [PATCH] View Ontology Changes: -now strips out any genes that haven't been annotated from the search paramters, and doesn't display them in the ontology -supports cluster and box ontologies from Heatmap svn path=/; revision=451 --- Personnel/miles/Web Page/infoChoice.php | 10 +++-- Personnel/miles/Web Page/viewOntology.php | 46 +++++++++++++---------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/Personnel/miles/Web Page/infoChoice.php b/Personnel/miles/Web Page/infoChoice.php index fa18081..c1a3d12 100644 --- a/Personnel/miles/Web Page/infoChoice.php +++ b/Personnel/miles/Web Page/infoChoice.php @@ -40,11 +40,14 @@ if($_POST["type"] == "cluster") { $results=mysql_query($query); $i = 0; - $genes; + $tempgenes = array(); + $row = mysql_fetch_row($results); while($row != null) { - $genes[$i] = $row[0]; + $tempgenes[$i] = $row[0]; $row = mysql_fetch_row($results); + $i ++; } + $genes = implode(",",$tempgenes); mysql_close($connection); @@ -162,9 +165,8 @@ mysql_close($connection); ?> diff --git a/Personnel/miles/Web Page/viewOntology.php b/Personnel/miles/Web Page/viewOntology.php index 318fca3..c956fc4 100644 --- a/Personnel/miles/Web Page/viewOntology.php +++ b/Personnel/miles/Web Page/viewOntology.php @@ -26,8 +26,6 @@ $url="floret.cgrb.oregonstate.edu:3306"; $connection=mysql_connect($url,$username,$password); mysql_select_db($database); - -//This all gets the list of terms for the x-axis $logic = "where gene_product.full_name='"; for($i = 0; $i < sizeof($genes); $i++) { $toAdd = $genes[$i] . "'"; @@ -37,6 +35,28 @@ for($i = 0; $i < sizeof($genes); $i++) { $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]; + $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 = $logic . $toAdd; +} +//This all gets the list of terms for the x-axis + + $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); @@ -52,26 +72,15 @@ for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($resu //new testing stuff with optimized queries -$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; -} $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"; -echo $query; $results=mysql_query($query); $t = 0; $g = -1; $cellData; -$finalGenes; -$fg = 0; for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { - if(($g == -1) || ($genes[$g] != $row[0])) { + if(($g == -1) || ($finalGenes[$g] != $row[0])) { $g ++; for($t = 0; $t < sizeof($terms); $t++) { $cellData[$g][$t][0] = 0; @@ -142,7 +151,7 @@ Your browser does not support the canvas element.
- +
@@ -199,7 +208,7 @@ for(var i=0; i"; +var rawGenes = ""; var genes = rawGenes.split(","); var geneCount = genes.length; @@ -426,8 +435,5 @@ function downloadTabDem() { -- 2.34.1