<html>
<head>
<title>ANISEED - Interpro domain result (Ciona intestinalis, Halocynthia roretzi)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Interproscan was performed for each Ciona intestinalis protein. This page lists the Interpro terms corresponding to your query.">
<meta name="keywords" content="Tassy, Lemaire, Ciona intestinalis, Halocynthia roretzi, ascidian database, ciona intestinalis database, ciona intestinalis protein, functional annotation, Interpro domain, Interproscan, protein domain, functionnal motif.">
<meta name = "robots" content = "index, follow, all">
<META HTTP-EQUIV="Content-Language" CONTENT="EN">
<style type="text/css">
</style>
</head>

<?php
/*
    ANISEED, NISEED System and Database
    Copyright (C) 2007 Olivier Tassy, Fabrice Daian, Patrick Lemaire

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
include("connection.php");
include("frames_header.php");
?>

<?php
	$id="";
	$term="";
	$mode="";
	$genelist="";
	if(isset($_POST["id"]))
		$id=$_POST["id"];
	if(isset($_POST["term"]))
		$term=$_POST["term"];
	if(isset($_POST["mode"]))
		$mode=$_POST["mode"];
	if(isset($_POST["genelist"]))
		$genelist=$_POST["genelist"];
	
	if (isset($_POST["notin"]))
		$notin=$_POST["notin"];
	if (isset($_POST["notin2"]))
		$notin=$_POST["notin2"];


		

	if((strlen($id)<=0)and(strlen($term)<=0)){
	    print "<br><br><center><strong>Please enter a word or an id to search for.</strong></center><br><br>";
	    include("frames_footer.php");
		return;
	}

/*
    //directly send given IP ids to the result page
    if($mode=="id"){
	    print '<form action="IP-result2.php" method="post" name="form">';
	    print '<input name="genelist" type="hidden" value="'.$genelist.'">';
	    $id=strtoupper($id);
	    $words = split (" ", $id);
		for($a=0; $a<count($words); ++$a)
		    print '<input name="ip[]" type="hidden" value="'.$words[$a].'">';
		
		//automatic submit
		print '<script language="JavaScript"> window.document.form.submit(); </script>';
		exit();
		return;
	}
*/

	//connection

	
    if(strlen($genelist)>0)
		print "<center><H2><font color=\"#FF6600\">Refine subset mode</font></H2></center>";
	
	print '<form action="IP-result2.php" method="post" name="form">';

    print '<input name="genelist" type="hidden" value="'.$genelist.'">';
	
	print '<input name="notin" type="hidden" value="'.$notin.'">';

	print "&nbsp;&nbsp;<strong>Species: </strong>&nbsp;<select name=\"species\" size=\"1\">
	           <option value=\"\"></option>";
			   
	$requete="Select \"NAME\" from \"SPECIES\" order by \"NAME\"";
	$stmt = pg_query($c,$requete);
	while( $row=pg_fetch_array($stmt) ){
		$name=$row["NAME"];
		print "<option>$name</option>";
	}
	print	   "</select>";
	
	
    //////print'<br><br>&nbsp;&nbsp;<strong>Protein molecular weight&nbsp;<select name="mwc" size="1"><option value="0">></option><option value="1"><</option></select>&nbsp;<input name="mw" type="text" value="0" size="10">&nbsp;Da</strong>';

	print "<br><br>&nbsp;&nbsp;<input border=\"1\" name=\"submit\" type=\"image\" src=\"pictures/button-GO.jpg\" onClick=\"submit\"><br><br>";
    print"<font size=\"-1\">Select Interpro terms of interest and click on \"get corresponding gene\" button.</font>";
	
	if($mode=="term"){
	    $term=strtoupper($term);
	    $words = split (" ", $term);
	    $query="(UPPER(\"NAME\") like '%$words[0]%')";
		for($a=1; $a<count($words); ++$a)
		    $query .= " and (UPPER(\"NAME\") like '%$words[$a]%')";
		
	    $requete2="select \"IP_ID\", \"NAME\", \"TYPE\" from \"INTERPRO\" where ".$query." order by \"TYPE\"";
	    $stmt2 = pg_query($c,$requete2);
        print "<center><table width=\"99%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">";
		print '<tr align="center" valign="middle"><td><font color="#456898" size="2"><b>IP ID</b></font></td><td><font color="#456898" size="2"><b>Type</b></font></td><td><font color="#456898" size="2"><b>Term</b></font></td></tr>';
        $count=0;
		while($row2=pg_fetch_array($stmt2)){
		        ++$count;
				print "<tr align=\"center\"><td><input name=\"ip[]\" type=\"checkbox\" value=\"".$row2["IP_ID"]."\"><a target=\"_BLANK\" href=\"http://www.ebi.ac.uk/interpro/IEntry?ac=".$row2["IP_ID"]."\">".$row2["IP_ID"]."</a></td><td>".$row2["TYPE"]."</td><td>".$row2["NAME"]."</td></tr>";
		}
		print "</TABLE></center>";
		
		if($count==0)
		    print "<br><br><center><h2><strong>No match</strong></h2></center><br><br>";
		else
		    print "<br><center>$count result(s)</center><br>";
    }else{
	
	    $id=strtoupper($id);
	    $id=ereg_replace(" ","','",$id);
	
	    $requete2="select \"IP_ID\",\"NAME\", \"TYPE\" from \"INTERPRO\" where \"IP_ID\" in ('".$id."') order by \"TYPE\"";
	    $stmt2 = pg_query($c,$requete2);
        print "<center><table width=\"99%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">";
		print '<tr align="center" valign="middle"><td><font color="#456898" size="2"><b>IP ID</b></font></td><td><font color="#456898" size="2"><b>Type</b></font></td><td><font color="#456898" size="2"><b>Term</b></font></td></tr>';
        $count=0;
		while($row3=pg_fetch_array($stmt2)){
		        ++$count;
				print "<tr align=\"center\"><td><input name=\"ip[]\" type=\"checkbox\" value=\"".$row3["IP_ID"]."\" checked><a target=\"_BLANK\" href=\"http://www.ebi.ac.uk/interpro/IEntry?ac=".$row3["IP_ID"]."\"><font color=\"#000000\" size=\"-1\">".$row3["IP_ID"]."</font></a></td><td><font color=\"#656565\" size=\"-1\">".$row3["TYPE"]."</font></td><td><font color=\"#656565\" size=\"-1\">".$row3["NAME"]."</font></td></tr>";
		}
		print "</TABLE></center>";
		
		if($count==0)
		    print "<br><br><center><h2><strong>No match</strong></h2></center><br><br>";
		else
		    print "<br><center>$count result(s)</center><br>";
	}
	
	print '</form>';
?>
<?php
    include("frames_footer.php");
?>