<html>
<head>
<title>ANISEED anatomy - Ciona intestinalis and Halocynthia roretzy anatomy</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content=" Aniseed hosts over 4 200 anatomical identities (Ciona intestinalis anatomy and Halocynthia roretzi anatomy) concerning lineage and fate information, neighborhood relationships, shape of blastomeres, inductions, competence of cells. For more information, please contact aniseed@ibdm.univ-mrs.fr">
<meta name="keywords" content="Aniseed, Ciona intestinalis, Halocynthia roretzi, anatomy, lineage, fate, tunicate, ascidian, tunicate database, ciona intestinalis database, lemaire, tassy, daian, dauga, sobral">
<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/>.

*/
//connection
include("connection.php");


include("frames_header.php");
?>

<script language="JavaScript">
function getValue(){
    for(a=0; a< document.formu.length; a++){
        if(document.formu[a].checked==true){
			obj=document.formu[a];
            return obj.value;
        }
    }
}
</script>

<form action="" method="get" name="formu">
<?php
    $region="";
	$dev="";
    if(isset($_GET["region"]))
	    $region = $_GET["region"];
    if(isset($_GET["dev"]))
		$dev = $_GET["dev"];
	
	
	if( (strlen($dev)<=0)or(ereg("___",$dev)) ){
	    print "<center><h2><strong>No match</strong></h2><br>please select one developmental stage</center>";
		include("frames_footer.php");
	    return;
	}
	
	?>
  <link rel="stylesheet" type="text/css" media="screen" href="ongletv1.css" title="Version 1" />
<!-- Header pour l'onglet -->
<div id="header">
  <ul>
    <li id="current" ><a href="#">Anatomical dictionary</a></li>
    <!--<li><a onclick="this.href='embryo-view.php?species=<? print $species;?>&dev=<? print $dev; ?>'" href="">Anatomical dictionary (Embryo view)</a></li>-->
    <li><a onclick="this.href='short_hierarchy.php?region='+self.getValue()+'&dev=<?print $dev;?>'" href="">Anatomical territory summary card</a></li>
	<li><a onclick="this.href='lineage.php?idanat='+self.getValue()" href="#">Lineage</a></li>    
	<li><a onclick="this.href='insitu-result.php?BOOLanat=1&xref=2&idanat='+self.getValue()+':'" href="">Molecular Markers</a></li>

    <!--<li><a onclick="this.href='fates.php?idanat='+self.getValue()" href="#">Fate</a></li>-->
    
    <!--<li><a onclick="this.href='insitu-result.php?BOOLanat=1&xref=2&idanat='+self.getValue()+':'" href="#">InSitu data</a></li>-->
    <!--<li><a onclick="this.href='position.php?idanat='+self.getValue()" href="">Biometry</a></li>-->
    <!--<li><a onclick="this.href='induction.php?idanat='+self.getValue()" href="">Induction</a></li>-->

  </ul>
</div>
<!-- EOF Onglet -->

<br><br>

<?

	

	$requete= "SELECT \"NAME\", \"SPECIES\" FROM \"DEV_STAGE\" WHERE \"DEV_STAGE_ID\"= $dev";
    $stmt = pg_query($c,$requete);
    if( $row=pg_fetch_array($stmt)){
		//print "<br><br><font color=\"#D64242\" size=\"3\"><b>".$row["SPECIES"]."  (".$row["NAME"].")<br></b></font><br><br>";
	    //print "Select anatomical part below and click on buttons to access the relevant information.<br>";

//////////// AJOUT POUR LE DEV_STAGE_CARD ///////////////


$requete0="SELECT \"FABA_LINK\",\"TIME\",\"PERIOD_NAME\",\"DESCRIPTION\",\"STAGE_NAME\",\"GIF_LINK\" from \"DEV_STAGE_INFO\" where \"DEV_STAGE_ID\"='$dev'";
$stmt0=pg_query($c,$requete0);
$row0=pg_fetch_array($stmt0);

$faba=$row0["FABA_LINK"];


$faba_num=str_replace("http://chordate.bpni.bio.keio.ac.jp/faba/1.1/dev_3D/","",$faba);
$faba_num=str_replace("hpf.html","",$faba_num);




$faba_3D="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/3D.html?$faba_num";
$faba_slice="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/slice.html?$faba_num";
$faba_line="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/body_atlas.html?$faba_num";
$faba_time="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/timelapse.html?$faba_num";


$time=$row0["TIME"];

if (strlen($time)==0) $time="</b><i>Not defined</i><b>";


$time=str_replace("h", " hours ",$time);
$time=str_replace("min","m",$time);
$time=str_replace("minutes","m",$time);
$time=str_replace("m"," minutes",$time);
$time=str_replace("utes","",$time);

if (strlen($time)==0) $time="</b><i>Not defined</i><b>";


$period=$row0["PERIOD_NAME"];

if (strlen($period)==0) $period="</b><i>Not defined</i><b>";



$desc=$row0["DESCRIPTION"];

if (strlen($desc)==0) $desc="</b><i>Not defined</i><b>";

$stagename=$row0["STAGE_NAME"];

if (strlen($stagename)==0) $stagename="</b><i>Not defined</i><b>";

$gif=$row0["GIF_LINK"];



print "<br><br>";
print "<table width=\"100%\">";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Species :</b></font></td><td><font size=\"-1\"><b>".$row["SPECIES"]."</b></font></td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Stage Name :</b></font></td><td><font size=\"-1\" color=\"#FF9900\"><b>".$row["NAME"]."</b></font></td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Period Name :</b></font></td><td><font size=\"-1\"><b>$period</b></font></td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Hotta Stage Number :</b></font></td><td><font size=\"-1\"><b>$stagename</b></font></td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Time since fertilisation (18&deg) :</b></font></td><td><font size=\"-1\"><b>$time</b></font></td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Description :</b></font></td><td><font size=\"-1\"><b>$desc</b></font></td></tr>";
print "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Four-dimensional body atlas (FABA) :</b></font></td>";
print "<td>";


if (strlen($faba)==0) print "<font size=\"-1\"><i>Not defined</i></font>";
else
	{
$tmp=explode(",",$faba);
for ($i=0;$i<count($tmp);$i++)
	{
	if (count($tmp)!=1) 
		{

	$faba_num2=str_replace("http://chordate.bpni.bio.keio.ac.jp/faba/1.1/dev_3D/","",$tmp[$i]);
	$faba_num2=str_replace("hpf.html","",$faba_num2);

	$faba_3D2="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/3D.html?$faba_num2";
	$faba_slice2="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/slice.html?$faba_num2";
	$faba_line2="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/body_atlas.html?$faba_num2";
	$faba_time2="http://chordate.bpni.bio.keio.ac.jp/faba/1.1/timelapse.html?$faba_num2";

//		print "<a target=\"_blank\" href=\"".trim($tmp[$i])."\"><font size=\"-2\"><b>Link ".($i+1)."</b></font></a>&nbsp;&nbsp;";

		print "<table style=\"padding:5px; border:1px solid black;\">";
		print "<tr>";	
		print "<td><img width=\"120\" src=\"pictures/FABA/dev3D-$faba_num2.jpg\"></td>";	
			print "<td>";
			print "<table>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_3D2\"><img border=\"0\" src=\"pictures/3D_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_slice2\"><img border=\"0\" src=\"pictures/slice_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_line2\"><img border=\"0\" src=\"pictures/cellLineages_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_time2\"><img border=\"0\" src=\"pictures/timelapse_btn.png\"></a></td></tr>";
			print "</table>";
			print "</td>";
		print "</tr>";
		print "</table>	";


		}
	else 
		{


// 		print " <a target=\"_blank\" href=\"".trim($tmp[$i])."\"><font size=\"-2\"><b>Link</b></font></a>&nbsp;&nbsp;";

		
		

		print "<table style=\"padding:5px; border:1px solid black;\">";
		print "<tr>";	
		print "<td><img width=\"120\" src=\"pictures/FABA/dev3D-$faba_num.jpg\"></td>";	
			print "<td>";
			print "<table>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_3D\"><img border=\"0\" src=\"pictures/3D_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_slice\"><img border=\"0\" src=\"pictures/slice_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_line\"><img border=\"0\" src=\"pictures/cellLineages_btn.png\"></a></td></tr>";
				print "<tr><td><a target=\"_blank\" href=\"$faba_time\"><img border=\"0\" src=\"pictures/timelapse_btn.png\"></a></td></tr>";
			print "</table>";
			print "</td>";
		print "</tr>";
		print "</table>	";
		



		}
	}
print "</td></tr>";
	}



////// PREVIOUS NEXT
print "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Previous developmental stage :</b></font></td>";


$requete0="SELECT \"DEV_STAGE_ID\",\"NAME\" from \"DEV_STAGE\" where \"DEV_PERCENT\"<(select \"DEV_PERCENT\" from \"DEV_STAGE\" where \"DEV_STAGE_ID\"='$dev' and \"SPECIES\"='".$row["SPECIES"]."') and \"SPECIES\"='".$row["SPECIES"]."'order by \"DEV_PERCENT\" desc";
$stmt0=pg_query($c,$requete0);
$row0=pg_fetch_array($stmt0);

print "<td><a href=\"anatomy.php?species=".$row["SPECIES"]."&dev=".$row0["DEV_STAGE_ID"]."\"><font size=\"-2\"><b>".$row0["NAME"]."</b></font></a></td></tr>";

print "<tr><td width=\"30%\"><font color=\"#D64242\" size=\"2\"><b>Next developmental stage :</b></font></td>";

$requete0="SELECT \"DEV_STAGE_ID\",\"NAME\" from \"DEV_STAGE\" where \"DEV_PERCENT\">(select \"DEV_PERCENT\" from \"DEV_STAGE\" where \"DEV_STAGE_ID\"='$dev' and \"SPECIES\"='".$row["SPECIES"]."') and \"SPECIES\"='".$row["SPECIES"]."'order by \"DEV_PERCENT\" asc";
$stmt0=pg_query($c,$requete0);
$row0=pg_fetch_array($stmt0);

print "<td><a href=\"anatomy.php?species=".$row["SPECIES"]."&dev=".$row0["DEV_STAGE_ID"]."\"><font size=\"-2\"><b>".$row0["NAME"]."</b></font></a></td></tr>";





print "</table>";


print "<hr style=\"border-top:1px solid black;\">";






//////////////////////////////////////////////////////////


print "<br><font color=\"#D64242\" size=\"2\"><b>Anatomical Ontology</b></font><br><font size=\"-1\"><i>(For details, tick a territory and go to the \"anatomical territory summary card\" tab)</i></font><br>";


	/* SIMULATION D'UNE REQUETE SUR HIERARCHIE PAR UNE PROCEDURE DE REQUETES RECURSIVES */

/* VARIANTE DANS LA REQUETE POUR LA CONNEXION ET LE RESULTAT DU SELECT */
/* VARIANTE SUR LE PASSAGE EN PARAMETRE DU NIVEAU COURANT DE RECURSIVITE POUR L'AFFICHAGE DES BARRES VERTICALES */


$nivo=0;


function select_recursif_descendant_2($conn,$start,$res,$nivo)
{
global $dev;
//global $level;
global $region;
//global $nivo;
/*ON ECRIT SA REQUETE*/

//print "la";
if ($start!='')
{
$requete2="SELECT * FROM \"ANAT_ENTITY\" WHERE  \"DEV_STAGE_ID\"= ".$dev." and  \"CHILD_OF\"= $start order by \"NAME\"";
/*$requete2="SELECT * FROM \"ANAT_ENTITY\" WHERE  \"DEV_STAGE_ID\"= ".$dev." and  \"CHILD_OF\"= $start and \"ANAT_ID\"<>(
select \"ANAT_ID\" from \"ANAT_ENTITY\" where \"DEV_STAGE_ID\"='".$dev."' and \"NAME\"='No expression' and \"SPECIES\"=(
select \"SPECIES\" from \"ANAT_ENTITY\" where \"DEV_STAGE_ID\"='$dev'
)
) order by \"NAME\"";
*/
//print $start;
$level++;
}
else {
$requete2="SELECT * FROM \"ANAT_ENTITY\" WHERE  \"DEV_STAGE_ID\"= ".$dev." and  \"CHILD_OF\" is null order by \"NAME\"";
/*$requete2="SELECT * FROM \"ANAT_ENTITY\" WHERE  \"DEV_STAGE_ID\"= ".$dev." and  \"CHILD_OF\" is null and \"ANAT_ID\"<>(
select \"ANAT_ID\" from \"ANAT_ENTITY\" where \"DEV_STAGE_ID\"='".$dev."' and \"NAME\"='No expression' and \"SPECIES\"=(
select \"SPECIES\" from \"DEV_STAGE\" where \"DEV_STAGE_ID\"='".$dev."'
)
)
 order by \"NAME\"";

print $requete2;*/
//$level=0;
}

$stmt2=pg_query($conn,$requete2);

//if (pg_num_rows($stmt2)==0) {$level--;}

if (pg_num_rows($stmt2)!=0) $nivo++;//print "Nz";
if (pg_num_rows($stmt2)==0) $nivo--;//print "Ze";

while($row2=pg_fetch_array($stmt2))
	{
//$res=select_recursif_descendant_2($conn,$row2["ANAT_ID"],$res);
	
			for($a=0;$a<$nivo-1;++$a){
				if( $nivo>1 )
					echo '&nbsp;&nbsp;<font color="#999999">|</font>&nbsp;&nbsp;';
			}
	
			
			if( $row2["TYPE"]=='cell' ){

				if ($row2["NAME"]!="No expression")
				{
				print "<img src=\"pictures/cell.gif\">";
				//print "CELLULE";
				}
				
				}
			else if( $row2["TYPE"]=='organism' ){
				print "<img src=\"pictures/tetard.gif\">";
				//print "ORGANISME";
				}
			else	{
				print "<img src=\"pictures/region.gif\">";
				//print "REGION";
				
				}
			
			
			if($row2["ANAT_ID"]==$region){
				echo '<A NAME="tag"> <font size="-2" color="#FF9900"><strong>'.$row2["NAME"]."</strong></font> </A>";
				//print "<input name=\"region\" type=\"radio\" value=\"".$row2["ANAT_ID"]."\" ";
				print "<input onclick=\"embryo_img.src='newtree.php?anat=".$row2["ANAT_ID"]."'\" name=\"region\" type=\"radio\" value=\"".$row2["ANAT_ID"]."\" ";

				    print "checked ";
				print ">";
			}else{


				if ($row2["NAME"]!="No expression")
				{//No expression

				print "<font size=\"-2\"><strong>".$row2["NAME"]."</strong></font>";
				
				if((strlen($region)>0)){
					print "<input onclick=\"embryo_img.src='newtree.php?anat=".$row2["ANAT_ID"]."'\" name=\"region\" type=\"radio\" value=\"".$row2["ANAT_ID"]."\">";
				}else{
					print "<input onclick=\"embryo_img.src='newtree.php?anat=".$row2["ANAT_ID"]."'\" name=\"region\" type=\"radio\" value=\"".$row2["ANAT_ID"]."\"";
			       
				if ($nivo==1) print "checked";
				 /*if(OCIResult($stmt, "LEVEL")==1)
					    print "checked ";*/
					print ">";//."<strong>".OCIResult($stmt, "ANAT_ID")."</strong>";
				}

				}//No expression

			}

		print '<br>';


	
	$res=select_recursif_descendant_2($conn,$row2["ANAT_ID"],$res,$nivo);

	
	}

return $res;
}



print "<TABLE width=\"100%\">";
print "<TR>";
print "<TD valign=\"top\" width=\"60%\">";

$res=select_recursif_descendant_2($c,null,$res,$nivo);

print "</TD>";

print "<TD valign=\"top\" align=\"center\" width=\"40%\">";

//print "schema";
/*
if (strlen($region)==0) 
	{
	$requete="SELECT \"NAME\" from \"DEV_STAGE\" where \"DEV_STAGE_ID\"='$dev'";
	$stmt=pg_query($c,$requete);
	$row=pg_fetch_array($stmt);

	$nm=$row["NAME"];
	$tmp=explode("-",$nm);
	$nmn=$tmp[0];

	if ($nm=="Early 32-cell stage") print "<img name=\"embryo_img\" src=\"imagemap/32/early32anim.gif\">&nbsp;<img name=\"embryo_img\" src=\"imagemap/32/early32vege.gif\">"; 
	else if ($nm=="Late 32-cell stage") print "<img name=\"embryo_img\" src=\"imagemap/late32/late32anim.gif\">&nbsp;<img name=\"embryo_img\" src=\"imagemap/late32/late32vege.gif\">"; 
	else if (file_exists("imagemap/$nmn/".$nmn."anim.gif")) print "<img name=\"embryo_img\" src=\"imagemap/$nmn/".$nmn."anim.gif\">&nbsp;<img name=\"embryo_img\" src=\"imagemap/$nmn/".$nmn."vege.gif\">"; 
 	else print "<font size=\"2\"><b>Embryo schema not found for $nm</b></font>";

	}
else */


if (strlen($region)==0)
{
//print "<img name=\"embryo_img\" title=\"Click on an anatomical part to display its embryo schema\" src=\"\">";

//print "<br>";
print "<img name=\"embryo_img\">";
print "<br><br>";
print "<font size=\"-1\"><em>Click on an anatomical part to display its embryo schema</em></font>";
}
else 
	{
	$requete1="SELECT \"NAME\" from \"ANAT_ENTITY\" where \"ANAT_ID\"='$region'";
	$stmt1=pg_query($c,$requete1);
	$row1=pg_fetch_array($stmt1);
	if ($row1["NAME"]!="Whole embryo") print "<img name=\"embryo_img\" src=\"newtree.php?anat=$region\">";

	}

print "</TD>";

print "</TR>";
print "</table>";





/* FIN DE LA SIMULATION */

}else{ print "<br><br><center><h2><strong>No match</strong></h2></center><br><br>"; }
?>
















</form>

<br>
<br>
<? print '<a href="FLATexport-anatomy.php?region='.$region.'&dev='.$dev.'">Display tree in raw text format</a>'; ?>

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

</html>