<html>
<head>
<title>ANISEED - Molecular tool result (Ciona intestinalis, Halocynthia roretzi)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="This page will list Ciona intestinalis molecular tools linked to a specific transcript model. Click on Ciona tool you are interested in.">
<meta name="keywords" content="molecular tool, transcript model, Ciona intestinalis, Halocynthia roretzi, ascidian database, ciona intestinalis database, Tassy, Lemaire, Daian, Sobral, Dauga.">
<meta name = "robots" content = "index, follow, all">
<META HTTP-EQUIV="Content-Language" CONTENT="EN">
<style type="text/css">
</style>
</head>

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

$gene=$_GET["clusterid"];
$clustid=$gene;
$aniseed_gm=str_replace("cluster","aniseedV3_",$clustid);

//// get gene models related to the gene give by clustid
$gm=(array) null;
$requete="select \"NAME\" from \"GENE\" where \"GENE_ID\" in (
SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clustid'
)";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt)) $gm[count($gm)]=$row["NAME"];


//// get name of the clustid
$name=(array) null;
$manual=(array) null;
$requete="SELECT \"GENE_CLUSTER_NAME\",\"MANUAL\" from \"GENE_CONCEPT_NAME\" where \"GENE_CLUSTER_ID\"='$clustid'";
$stmt=pg_query($c,$requete) or die (pg_last_error($c));
while ($row=pg_fetch_array($stmt))
	 {
  	 
	if ($row["MANUAL"]=="y") $manual[count($manual)]=$row["GENE_CLUSTER_NAME"];
	else $name[count($name)]=$row["GENE_CLUSTER_NAME"];
	 }


if( (count($name)==0) || (count($manual)==0) )
	{

	$requete="SELECT \"GENE_CLUSTER_NAME_BLAST\" from \"GENE_CONCEPT_NAME_BLAST\" where \"GENE_CLUSTER_ID\"='$clustid'";
	$stmt=pg_query($c,$requete);
	while ($row=pg_fetch_array($stmt))$name[count($name)]=$row["GENE_CLUSTER_NAME_BLAST"];
	}


//// fetch go term associated to different gm related to the clust
$go=(array) null;
$requete="SELECT \"GO_ID\" from \"GO_DESCRIPTION\" where \"MOL_ID\" in (
select \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clustid'
)";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt)) $go[$row["GO_ID"]]++;

///// fetch interpro
$interpro=(array) null;
$requete="SELECT \"IP_ID\" from \"IP_DESCRIPTION\" where \"MOL_ID\" in (
select \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clustid'
)";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt)) $interpro[$row["IP_ID"]]++;

?>

  <link rel="stylesheet" type="text/css" media="screen" href="ongletv1.css" title="Version 1" />

<!-- Header pour l'onglet -->
<?
//// agregation des modeles de genes

$agreg_gm="";
for ($i=0;$i<count($gm);$i++)
	{
	if (strlen($agreg_gm)==0) $agreg_gm=$gm[$i];
	else $agreg_gm.=":".$gm[$i];
	}


?>

<link rel="stylesheet" type="text/css" media="screen" href="ongletv1.css" title="Version 1" />

<div id="header">
  <ul>    
        <li><a href="gene-card.php?clusterid=<?print $clustid;?>">Gene Card</a></li>
        <li><a href="ESTcluster-gene.php?clusterid=<? print $clustid; ?>">ESTs cluster</a></li>
        <li><a href="insitu-result.php?target=<?print $agreg_gm;?>&MOLtype=2&Order=DEV_STAGE_ID&fromgenecard=1">Detailed Expression</a></li>
        <li><a href="gene-picture.php?clusterid=<? print $clustid; ?>">Expression at a glance <i><small><small><b><font color="crimson">New</font></b></small></small></i></a></li>
	<li id="current"><a href="#">Molecular tool</a></li>
        <li ><a href="gene-regulation-card.php?clusterid=<?print $clustid; ?>">Upstream regulators</a></li>
        <li ><a href="gene-function-card.php?clusterid=<?print $clustid; ?>">Downstream targets</a></li>
        <li><a href="bib-mol.php?clusterid=<? print $clustid; ?>&function=1&regulation=1&wild=1">Articles</a></li>
        <!-- <li><a href="#" style="color:white;">Microarray probe</a></li> -->
        <!--<li><a href="#" style="color:white;">Export</a></li> -->
  </ul>
</div>
<br><br>
<br><br>

<?
print "<center><font color=\"#D64242\" size=\"3\"><b>Matching Molecular tools</b></font></center><br>";


$requete="select * from \"MOLECULAR_TOOL\" where \"ASSOCIATED_GENE_ID\" in (
select \"NAME\" from \"GENE\" where \"GENE_ID\" in (
SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='".str_replace("aniseedV3_","cluster",$gene)."'
)
)
";


$stmt=pg_query($c,$requete) or die (pg_last_error($c));

$NUM=pg_num_rows($stmt);
if ($NUM==1) print "<center><font color=\"black\" size=\"-1\">$NUM Result</font></center>";
if ($NUM>1) print "<center><font color=\"black\" size=\"-1\">$NUM Results</font></center>";

print "<br>";

print "<table cellpadding=\"3\" cellspacing=\"2\" width=\"100%\">";
print "<tr><td align=\"center\"><font color=\"#486898\" size=\"-1\"><b>Name</b></font></td><td align=\"center\"><font color=\"#486898\" size=\"-1\"><b>Type of Tool</b></font></td></tr>";

$I=0;
while ($row=pg_fetch_array($stmt))
{

$name=$row["NAME"];
$type=$row["TYPE"];
$moltoolid=$row["MOLECULAR_TOOL_ID"];


//print $name." ".$type."<br>";
if ($I%2==1) $bgcolor="#AAAAAA"; else $bgcolor="#DDDDDD";

print "<tr><td style=\"background-color:$bgcolor;\" align=\"center\"><a href=\"moltool-card.php?id=$moltoolid\"><font size=\"-1\">$name</font></a></td><td style=\"background-color:$bgcolor;\" align=\"center\"><font size=\"-1\">$type</font></td></tr>";


$I++;
}

print "</table>";

include ("frames_footer.php");
?>