<?php
include("connection.php");
include("frames_header.php");
?>


<?php
	
	$name=$_GET["name"];
	//$name=strtoupper($name);
	if(strlen($name)==0){
	    print '<center><h2><strong>Missing parameter: gene name.</strong></h2></center>';
		include("frames_footer.php");
		return;
	}
	
	
	
	$species=$_GET["species"];

print "<h2><strong><em>Add/Remove GO annotation from Gene</em></strong> </h2>";

print "<center>";



	print "<br><hr><br>";


	print "<strong>Add a new annotation for <i>$name</i>  </strong> <br><br>";
	
	print '<form name="formulaire" action="go4.php" method="get" target="_blank">';
	
	print '<input name="GO" type="text" size="15" lenght="10" align="center" value="GO:"> <br><br>';
	print "<input name=\"name\" type=\"hidden\" value=\"$name\" >";

	print '<input name="submit" type="image" src="pictures/button-add.jpg" onClick="submit">';
		

	print '</form>';
		






	print "<br><hr><br>";


		$requete="SELECT \"GENE_ID\" FROM \"GENE\" WHERE \"NAME\"='$name'";

		$stmt=pg_query($c,$requete);

		$row=pg_fetch_array($stmt);

		$molid=$row["GENE_ID"];

		//print "<br>$molid<br>";


	

		print "<center><strong>Remove annotations from <i>$name</i> <br></strong></name>";

		//$molid='759730';

		$requete="SELECT \"GO_ID\" FROM \"GO_DESCRIPTION\" WHERE \"MOL_ID\"='$molid'";
		$stmt=pg_query($c,$requete);
		print "<br>";
		

		//print '<table align="center" border="1">';

		print '<table width="99%" border="0" cellspacing="0" cellpadding="0">';
		print '<tr align="center" valign="middle" bgcolor="#990000"><td> </td><td>GO id</td><td background="pictures/barre-red.jpg">GO Term</td></tr>';

		print '<tr align="center" valign="middle"> ';




		while ($row=pg_fetch_array($stmt))
		{
				print '<tr align="center" valign="middle">';
		print '<td>';	
		print "<a href=\"go3.php?species=$species&name=$name&GO=".$row["GO_ID"]."\"> <img border=\"0\" 		src=\"pictures/button-remove.jpg\"></a><br>";
		print '</td>';
		print '<td>';
		print "&nbsp;&nbsp;".$row["GO_ID"];
		print '</td>';

			$requete="SELECT \"GO_TERM\" FROM \"GO\" WHERE \"GO_ID\"='".$row["GO_ID"]."'";
			$stmt2=pg_query($c,$requete);
			$row2=pg_fetch_array($stmt2);
			print '<td>';
			print $row2["GO_TERM"];
			print '</td>';

		

		}
		
		print '</table>';




?>


</center>


<?
include ("frames_footer.php");
?>