From 10a657e12d47a28aa8c14350180b42f041a556cb Mon Sep 17 00:00:00 2001 From: miles Date: Wed, 13 Mar 2013 01:11:04 +0000 Subject: [PATCH] svn path=/; revision=433 --- Personnel/miles/Web Page/infoChoice.php | 146 ++++++++++++++++++++++ Personnel/miles/Web Page/viewOntology.php | 145 +++++++++++++++++++++ 2 files changed, 291 insertions(+) create mode 100644 Personnel/miles/Web Page/infoChoice.php create mode 100644 Personnel/miles/Web Page/viewOntology.php diff --git a/Personnel/miles/Web Page/infoChoice.php b/Personnel/miles/Web Page/infoChoice.php new file mode 100644 index 0000000..0d0a694 --- /dev/null +++ b/Personnel/miles/Web Page/infoChoice.php @@ -0,0 +1,146 @@ + + + +
"; + + $row = mysql_fetch_row($results); + while($row != null) { + $str=$row[1] . " (" . $row[0] . ")"; + echo "" . $str . "
"; + $row = mysql_fetch_row($results); + } + + mysql_close($connection); + +} else if($_POST["type"] == "species") { + $username="inparanoid-read-user"; + $password="inparanoid-read-user_pw"; + $database="inparanoid_data"; + $url="floret.cgrb.oregonstate.edu:3306"; + + $input = explode(",",$_POST['param']); + + $species = $input[0]; + $clusterCount = sizeof($input)-1; + + // creating logic statements + $clusters = "super_id="; + for($i=0; $i < $clusterCount; $i++) { + $clusters = $clusters . $input[$i+1]; + if(($i+1) < (sizeof($input)-1)) { + $clusters = $clusters . " or super_id="; + } + } + + // setting key values for mapping from gene ids to iterative ids (for user's sake) + $ids; + for($i=0; $i<$clusterCount; $i++) { + $ids[(string)$input[($i+1)]] = (string) ($i+1); + } + +$connection=mysql_connect($url,$username,$password); +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 " . $numRows . " genes in the surveyed clusters:

"; + +echo "GENE ID -------------------- CLUSTER ID
"; + +$data; +$i=0; +for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { + $data[$i] = $ids[(string)$row[1]] . "," . $row[0]; + $i = $i+1; + } + +sort($data); +$i = 0; +$species = str_replace(" ", "_", $species); + +while($i < sizeof($data)) { +$temp = explode(",", $data[$i]); +$str = $temp[1] . " ----------- " . $temp[0]; +echo "" . $str . "
"; +$i++; +} + +//id + gene -> sort -> split -> print; +// $row = mysql_fetch_row($results); + +mysql_close($connection); + +} else if($_POST["type"] == "box") { + $username="inparanoid-read-user"; + $password="inparanoid-read-user_pw"; + $database="inparanoid_data"; + $url="floret.cgrb.oregonstate.edu:3306"; + $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); + + $query="select gene from super_clust where super_id=" . $cluster . " && species=\"" . $species . "\" order by gene"; + $results=mysql_query($query); + + if(!$results) { + echo "DB Error, could not list tables"; + } + + echo str_replace("_", " ", $species) . " has " . $count . " genes in cluster " . $clusterIndex . ":

\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo "

\n"; + + $genes=""; + $row = mysql_fetch_row($results); + while($row != null) { + echo "" . $row[0] . "
"; + $genes = $genes . $row[0] . ","; + $row = mysql_fetch_row($results); + } + mysql_close($connection); +} + +?> + + + + + \ No newline at end of file diff --git a/Personnel/miles/Web Page/viewOntology.php b/Personnel/miles/Web Page/viewOntology.php new file mode 100644 index 0000000..1a8e4b6 --- /dev/null +++ b/Personnel/miles/Web Page/viewOntology.php @@ -0,0 +1,145 @@ + + + + logic: " . $logic . "
"; +$query="select id from gene_product " . $logic . " order by id"; +$results=mysql_query($query); + + +$i = 0; +for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { + $geneProductIDs[$i] = $row[0]; + $i++; + } + +$logic = "where gene_product_id="; +for($i = 0; $i + 1 < sizeof($geneProductIDs); $i++) { + $toAdd = $geneProductIDs[$i]; + if($i + 2 < sizeof($geneProductIDs)) { + $toAdd = $toAdd . " or gene_product_id="; + } + $logic = $logic . $toAdd; +} + +$query="select term_id from association " . $logic . " order by term_id"; +$results=mysql_query($query); + +$i = 0; +for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { + $termIDs[$i] = $row[0]; + $i++; + } + +$logic = "where id='"; +for($i = 0; $i + 1 < sizeof($termIDs); $i++) { + $toAdd = $termIDs[$i] . "'"; + if($i + 2 < sizeof($termIDs)) { + $toAdd = $toAdd . " or id='"; + } + $logic = $logic . $toAdd; +} + +$query="select name from term " . $logic . " order by name"; +$results=mysql_query($query); + +$i = 0; +for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { + $terms[$i] = $row[0]; + $i++; + } + +?> + +
+ +Your browser does not support the canvas element. +
+ +
+ +
+ + + + + + -- 2.34.1