<!-- display all articles of the database associated with a gene of interest -->
<html>
<head>
<title>ANISEED - Ascidian articles related to a given genes (Ciona intestinalis, Halocynthia roretzi)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="This page lists ascidian articles related to a given gene. For more information, contact aniseed@ibdm.univ-mrs.fr">
<meta name="keywords" content="Tassy, Daian, Dauga, Sobral, Lemaire, Ascidian articles, publication, literature, ascidian literature, Ciona gene, Ciona intestinalis expression data, Ciona intestinalis, Halocynthia roretzi, ascidian database, ciona intestinalis database.">
<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");


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

//// 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><a href="moltool-result-gene.php?clusterid=<?print $clustid;?>">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 id="current"><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>
<!-- EOF Onglet -->
<br><br>
<br><br>



<?

$function=$_GET["function"];
$regulation=$_GET["regulation"];
$wild=$_GET["wild"];


if ($function==1) $FUNCTION=" UNION SELECT distinct \"ARTICLE_ID\" from \"ARTICLE_GENE\" where \"TRANSCRIPT\" in (select \"NAME\" from \"GENE\" where \"GENE_ID\" in (SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clust') ) AND \"TYPE\"='Function'";

if ($regulation==1) $REGULATION=" UNION SELECT distinct \"ARTICLE_ID\" from \"ARTICLE_GENE\" where \"TRANSCRIPT\" in (select \"NAME\" from \"GENE\" where \"GENE_ID\" in (SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clust') ) AND \"TYPE\"='Regulation'";

if ($wild==1) $WILD=" UNION SELECT distinct \"ARTICLE_ID\" from \"ARTICLE_GENE\" where \"TRANSCRIPT\" in (select \"NAME\" from \"GENE\" where \"GENE_ID\" in (SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clust') ) AND \"TYPE\"='Wild type expression'";


/*$requete="
select * from \"ARTICLE\" where \"ARTICLE_ID\" in (
select distinct \"ARTICLE_ID\" from \"ARTICLE_GENE\" where \"TRANSCRIPT\" in (
select \"NAME\" from \"GENE\" where \"GENE_ID\" in (
SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clust')
)
)
";*/


$requete="select * from \"ARTICLE\" where \"ARTICLE_ID\" in ($FUNCTION$REGULATION$WILD)";

$requete=str_replace("( UNION","(",$requete);

if ($function+$regulation+$wild==0) $requete="select * from \"ARTICLE\" where \"ARTICLE_ID\" in (
SELECT distinct \"ARTICLE_ID\" from \"ARTICLE_GENE\" where \"TRANSCRIPT\" in (select \"NAME\" from \"GENE\" where \"GENE_ID\" in (SELECT \"GENE_MODEL_ID\" from \"GENE_CONCEPT\" where \"GENE_CLUSTER_ID\"='$clust') )
)";


//print $requete."<br>";
$stmt=pg_query($c,$requete);
/*
$NUM=pg_num_rows($stmt);
if ($NUM==1) print "<center><em><b>".$NUM." </b> article in the database is matching your query</center></em><br>";
else print "<center><em><b>$NUM </b> articles in the database are matching your query</center></em><br>";
*/

?>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="center"><font color="#456898" size="2"><b>Title</b></font></td><td align="center"><font color="#456898" size="2"><b>Journal</b></font></td><td align="center"><font color="#456898" size="2"><b>Authors</b></font></td><td align="center"><font color="#456898" size="2"><b>Aniseed data</b></font></td><td align="center"><font color="#456898" size="2"><b>Pubmed</b></font></td></tr>
<?

$AFFICH=0;

while ($row=pg_fetch_array($stmt))
{

$article_id=$row["ARTICLE_ID"];
$pmid=$row["PUBMED_ID"];

/////////////// FILTER THE STATUS OF THE ARTICLE TO KNOW WETHER ITS PUBLIC CURATED, OR NOT (IS NOT CURATED IF ALL THE EXPERIMENTS
//// ASSOCIATED WITH ARE NOT CURATED

$requete0="select distinct \"CHECKED\" from \"IN_SITU\" where \"IN_SITU_ID\" in (
SELECT \"BIO_ID\" from \"REFERENCE\" where \"PUBMED_ID\"='$pmid')";
$stmt0=pg_query($c,$requete0);
$s="";
while ($row0=pg_fetch_array($stmt0)) $s.=$row0["CHECKED"];
//print $pmid." ".$row["CHECKED"]."<br>";
//print $pmid." ".$s."<br>";

if ($s=="n") continue;

$AFFICH++;















$title=$row["TITLE"];
$paper=$row["PAPER"];
$auteur=$row["AUTHORS"];
$comments=$row["COMMENTS"];
print "<tr>";

print "<td style=\"border-top:1px solid black;\" valign=\"center\"><font color=\"#656565\" size=\"-2\">$title</font></td><td style=\"border-top:1px solid black;\" valign=\"center\" ><font color=\"#656565\" size=\"-2\">$paper</font></td><td style=\"border-top:1px solid black;\" valign=\"center\" ><font color=\"#656565\" size=\"-2\">$auteur</font><td style=\"border-top:1px solid black;\" valign=\"center\" align=\"center\"><font color=\"#656565\" size=\"-2\">

<!--<a href=\"biblio.php?pmid=$pmid\"><img src=\"pictures/mini-aniseed.jpg\" border=\"0\"></a>-->

<a href=\"view-article.php?id=$article_id\"><img src=\"pictures/mini-aniseed.jpg\" border=\"0\"></a>

</td></td><td style=\"border-top:1px solid black;\" valign=\"center\" align=\"center\"><font color=\"#656565\" size=\"-2\"><a href=\"http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=PubMed&cmd=Retrieve&list_uids=$pmid&dopt=Abstract\"><font color=\"#000000\" size=\"-2\"><img src=\"pictures/mini-pubmed.jpg\" border=\"0\"></a></font></td>";



print "</tr>";




}


print "</table>";



if ($AFFICH==0) 
	{
	print "<br><br><center><strong>Aniseed database doesn't contain any articles matching with your query</strong></center><br><br>";
	include ("frames_footer.php");
	return;
	}







include ("frames_footer.php");
?>