Note: The colors have no relevance to the data, they simply serve to distinguish rows visually.

The numbers printed inside each cell represent the confidence rating of the ontological assignment; a higher number indicates more confidence.

An "A" after the term name signifies that it relates to anatomy, a "G" signifies that it relates to growth, development, or structure

Click on a gene or term for detailed annotations from Plant Ontology.

Select or deselect terms to be downloaded using the boxes underneath the term names.
\n"; echo "

Include Ontologies:
"; for($i = 0; $i < sizeof($ontologies); $i++) { echo ""; echo $ontologies[$i] . "
"; } echo ""; echo ""; echo "

\n"; echo "

"; //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"; $database="po_live"; $url="floret.cgrb.oregonstate.local:3306"; $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 = $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; } $ontLogic = "where "; 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 $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 term_type,acc) as secondTable"; $results=mysql_query($query); $i = 0; for($row = mysql_fetch_row($results); $row != null; $row = mysql_fetch_row($results)) { $add = ""; $terms[$i][0] = $row[0]; $terms[$i][1] = $row[1]; $i++; } //new testing stuff with optimized queries $query = "select full_name,term_id,concat(acc, \"- \", name),evnum,term_type 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,term_type,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++) { 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 have no annotations in the database.

"; } else { $semiFinalCellData; for ($i = 0; $i < sizeof($cellData); $i ++) { 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]); } $printTerms; for($i = 0; $i < sizeof($terms); $i ++) { $printTerms[$i] = implode(";",$terms[$i]); } } echo sizeof($terms); $height = 800; $width = 1200; $maxTermSize = 0; for($i = 0; $i < sizeof($terms); $i ++) { if(strlen($terms[$i][0]) > $maxTermSize) $maxTermSize = strlen($terms[$i][0]); } } else { echo "

No ontologies were selected!

"; } ?>
Your browser does not support the canvas element.