abreBanco();
$datas= $trims= $untrims= $reads= $reads_ok= $contig_reads= $sings= $covg= array();
$n= $genopar->queryBanco("select
data,
sum(bp_trim) as trim,
sum(bp_untrim) as untrim,
sum(`reads`) as contig_reads
from contigs
group by data");
while ($lin= $genopar->getArray())
{
$data= arrumaData($lin["data"],"AAAA-MM-DD");
array_push($datas, $data);
array_push($trims, $lin["trim"] / 1000);
array_push($untrims, $lin["untrim"] / 1000);
array_push($contig_reads, $lin["contig_reads"] / 1000);
#echo "
$data - ".$lin["trim"]." - ".$lin["untrim"]." - ".$lin["contig_reads"];
}
$n= $genopar->queryBanco("select data, tot_sing, `reads`, reads_ok from stats group by data");
while ($lin= $genopar->getArray())
{
array_push($sings, $lin["tot_sing"] / 1000);
array_push($reads, $lin["reads"] / 1000);
array_push($reads_ok, $lin["reads_ok"] / 1000);
#echo "
- ".$lin["tot_sing"];
}
foreach($trims as $num => $trim)
array_push($covg, ($trim + $sings[$num]));
#foreach($datas as $num => $data)
# print "
$num: $data - ".$trims[$num]." - ".$untrims[$num]." - ".$reads[$num]." - ".
# $sings[$num]." - ".$covg[$num];
$labelx= $datas;
$graph = new Graph(600,400);
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
$graph->xaxis->SetTickLabels($labelx);
$graph->xaxis->SetTextTickInterval(1);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetLabelAngle(90);
#$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
#$graph->xaxis->SetLabelAngle(-45);
#$graph->xaxis->SetLabelAlign('right','top');
$graph->img->SetMargin(55,55,30,85);
$graph->SetShadow();
$graph->SetGridDepth(DEPTH_BACK);
$graph->legend->Pos(0.1,0.05,'left','top');
$graph->title->Set("Historico de Bases - Cobertura do Genoma");
$graph->xaxis->SetTitlemargin(50);
$graph->yaxis->SetTitlemargin(40);
$graph->y2axis->SetTitlemargin(35);
$graph->xaxis->title->Set("Data de Montagem");
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->Set("Numero de Bases (x 1.000)");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->y2axis->title->Set("Numero de Leituras (x 1.000)");
$graph->y2axis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$lineweight=1;
$pT = new LinePlot($covg);
$pT->SetColor("blue");
$pT->SetCenter();
$pT->SetLegend("Cobertura Total");
$pT->SetWeight($lineweight);
$graph->Add($pT);
$p1 = new LinePlot($trims);
$p1->SetColor("darkmagenta");
$p1->SetCenter();
$p1->SetLegend("Bases Contig");
$p1->SetWeight($lineweight);
$graph->Add($p1);
$p3 = new LinePlot($sings);
$p3->SetColor("mediumseagreen");
$p3->SetCenter();
$p3->SetLegend("Bases Singlets");
$p3->SetWeight($lineweight);
$graph->Add($p3);
$p4 = new LinePlot($reads);
$p4->SetColor("red");
$p4->SetCenter();
$p4->SetLegend("Leituras");
$p4->SetWeight($lineweight);
$graph->AddY2($p4);
$graph->y2axis->SetColor("red");
$p5 = new LinePlot($contig_reads);
$p5->SetColor("red");
$p5->SetCenter();
$p5->SetLegend("Leituras/Contigs");
$p5->SetStyle('dotted');
$p5->SetWeight($lineweight);
$graph->AddY2($p5);
$graph->y2axis->SetColor("red");
$p6 = new LinePlot($reads_ok);
$p6->SetColor("red");
$p6->SetCenter();
$p6->SetLegend("Leituras Aceitas");
$p6->SetStyle('dashed');
$p6->SetWeight($lineweight);
$graph->AddY2($p6);
$graph->y2axis->SetColor("red");
$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();
?>