} 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);
- }
-
+ $username="inparanoid-read-user";
+ $password="inparanoid-read-user_pw";
+ $database="inparanoid_data";
+ $url="floret.cgrb.oregonstate.edu:3306";
+
+ $input = explode(",",$_POST['param']);
+ $orderLogic = $_POST['orderBy'];
+
+ $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=";
+ }
+ }
+
+ echo "<form name=\"sortbygene\" method=\"post\" action=\"infoChoice.php\">\n";
+ echo "<input type=\"hidden\" name=\"param\" value=\"" . $_POST['param'] ."\">\n";
+ echo "<input type=\"hidden\" name=\"type\" value=\"" . $_POST['type'] ."\">\n";
+ echo "<input type=\"hidden\" name=\"orderBy\" value=\"order by gene,super_id\">\n";
+ echo "<input type=\"submit\" name=\"Sort Page by Gene\" value=\"Sort Page by Gene\">\n";
+ echo "</form>";
+ echo "<br> <br>\n";
+
+ echo "<form name=\"sortbycluster\" method=\"post\" action=\"infoChoice.php\">\n";
+ echo "<input type=\"hidden\" name=\"param\" value=\"" . $_POST['param'] ."\">\n";
+ echo "<input type=\"hidden\" name=\"type\" value=\"" . $_POST['type'] ."\">\n";
+ echo "<input type=\"hidden\" name=\"orderBy\" value=\"order by super_id,gene\">\n";
+ echo "<input type=\"submit\" name=\"Sort Page by Cluster ID\" value=\"Sort Page by Cluster ID\">\n";
+ echo "</form>";
+ echo "<br> <br>\n";
$connection=mysql_connect($url,$username,$password);
mysql_select_db($database);
-$query="select gene,super_id from super_clust where species=\"" . $species . "\" and (" . $clusters . ")";
+$query="select gene,super_id,species from super_clust where species=\"" . $species . "\" and (" . $clusters . ") " . $orderLogic;
$results=mysql_query($query);
$numRows = mysql_num_rows($results);
$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;
+ $data[$i][0] = $row[0];
+ $data[$i][1] = $row[1];
+ $i++;
}
-
-sort($data);
+/*
+sort($data);*/
$i = 0;
-$species = str_replace(" ", "_", $species);
-
+$species = str_replace(" ", "_",$species);
while($i < sizeof($data)) {
-$temp = explode(",", $data[$i]);
-$str = $temp[1] . " ----------- " . $temp[0];
-echo "<a href=\"http://planteome.cgrb.oregonstate.edu/node/11?species=" . $species . "&gene=" . $temp[1] . "\">" . $str . "</a> <br>";
+$gene = $data[$i][0];
+$cluster = $data[$i][1];
+echo "<a href=\"http://planteome.cgrb.oregonstate.edu/node/11?species=" . $species . "&gene=" . $gene . "\">" . $gene . " ----------- " . $cluster . "</a> <br>";
$i++;
}