abreBanco();
verGetPost(array("cL", "cG", "cS", "nok"));
if (!isset($nok))
$nok=0;
// $cS= ((!isset($cS)) ? 14 : (int) $cS ); # Compr. estimado do Genoma
// $cL= ((!isset($cL)) ? 700 : (int) $cL ); # Compr. de Leitura do Inserto
// $cG= ((!isset($cG)) ? 6000000 : (int) $cG ); # Compr. p/ Sobreposição
/*
for ($x=0; $x<=80000; $x+=1000)
{
$cE= exp(-$cL*$x/$cG*(1-($cS/$cL)));
$y= ($x*$cE)*(1-$cE);
array_push($Y,$y);
array_push($X,$x);
#echo "
:$x:".$vX[$x];
}
*/
$contigs= $reads= $reads_ok= $X= $Y= array();
#array_push($contigs, 0);
#array_push($reads_ok, 0);
$n= $genopar->queryBanco("select data, contigs, reads_ok, `reads` from stats group by data");
while ($lin= $genopar->getArray())
{
array_push($contigs, $lin["contigs"]);
array_push($reads_ok, $lin["reads_ok"]);
array_push($reads, $lin["reads"]);
}
foreach ($contigs as $i => $contig)
{
$x= ($nok ? $reads[$i] : $reads_ok[$i]);
$cE= exp(-$cL*$x/$cG*(1-($cS/$cL)));
$y= ($x*$cE)*(1-$cE);
#echo "
:$x:$y:";
array_push($Y,$y);
array_push($X,$x);
}
$graph = new Graph(600,400);
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($X);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetLabelAngle(90);
$graph->img->SetMargin(50,40,40,65);
$graph->SetShadow();
$graph->SetGridDepth(DEPTH_BACK);
$graph->legend->Pos(0.1,0.1,'right','top');
$graph->title->Set("Modelo de Lander-Waterman");
if ($nok)
$graph->subtitle->Set("Utilizando Numero de Leituras Utilizadas na Montagem");
else
$graph->subtitle->Set("Utilizando Numero de Leituras Aceitas");
$graph->xaxis->SetTitlemargin(25);
$graph->yaxis->SetTitlemargin(35);
$graph->xaxis->title->Set("Numero de Leituras");
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->Set("Numero de Contigs");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$lineweight=1;
$pT = new LinePlot($Y);
$pT->SetColor("red");
$pT->SetCenter();
$pT->SetLegend("Modelo Teorico");
$pT->SetWeight($lineweight);
$graph->Add($pT);
$p1 = new LinePlot($contigs);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend("Dados Reais");
$p1->SetWeight($lineweight);
$graph->Add($p1);
$rede_seq = strtoupper($genopar->rede_seq);
$txt=new Text($rede_seq);
$txt->SetPos(2,2);
$txt->SetColor("snow1");
$txt->SetFont(FF_VERDANA, FS_BOLD, 7);
$graph->AddText($txt);
$graph->Stroke();
?>