/*
###############################################################################
Programa GENOPAR - Laboratório Central de BioInformática
Augusto Felipe Favetti (AFF) augusto@genopar.org
Luiz Fernando Bittencourt (LFB) luiz@genopar.org
====================================================================
Listagem de Contigs existentes / status / Lab. Responsavel
Desenvolvida: 19-Set-2003 - AFF
###############################################################################
*/
require ("../lib/genopar.lib.php");
if(!doAuth(LVLPES))
exit;
$genopar = new Genopar(__FILE__);
$genopar->abrePagina("Annotation Status");
$genopar->abreBanco('annotV1');
#monta tabela de Status
$genopar->queryBanco("SELECT * FROM validation");
$STATUS=array();
while ($lin= $genopar->getArray())
$STATUS[$lin['val_cod']]= $lin['status'];
#monta tabela de LABs
$genopar->queryBanco("SELECT lab, count(*) as contigs FROM contig_annot group by lab");
$lCONTIGS=array();
while ($lin= $genopar->getArray())
$lCONTIGS[$lin['lab']]= $lin['contigs'];
$genopar->queryBanco("SELECT contig_num, bp_untrim, qual_med, `reads` FROM contigs WHERE qual_med>20");
$cSIZE=array();
$cQUAL=array();
$cREADS=array();
while ($lin= $genopar->getArray())
{
$cSIZE[$lin['contig_num']]=$lin['bp_untrim'];
$cQUAL[$lin['contig_num']]=$lin['qual_med'];
$cREADS[$lin['contig_num']]=$lin['reads'];
}
$genopar->queryBanco("SELECT left(id,3) as contig_num, validation, count(*) AS orfs FROM annot GROUP BY left(id,3), validation");
$cORFS=array();
while ($lin= $genopar->getArray())
$cORFS[(int)$lin['contig_num']][$lin['validation']]=$lin['orfs'];
$genopar->queryBanco("SELECT * FROM contig_annot");
$cLAB=array();
while ($lin= $genopar->getArray())
$cLAB[$lin['contig']]=$lin['lab'];
#### TABELA STATUS POR CONTIG
echo "
| Contig # |
Size |
Avg. Qual |
Reads |
LAB |
# ORFs / Status |
| TOTAL |
Unverif. |
Valid |
Hipoth. |
Cons. Hip. |
Pending |
Rebuilt |
Invalid |
";
$lSIZE=array();
$lORFS=array();
$ORFS=array();
foreach ($cSIZE as $contig => $size)
{
$orfsT= $cORFS[$contig][0]+$cORFS[$contig][1]+$cORFS[$contig][2]+$cORFS[$contig][3]+$cORFS[$contig][4]+$cORFS[$contig][99]+$cORFS[$contig]['-1'];
echo "
| $contig |
$size |
".$cQUAL[$contig]." |
".$cREADS[$contig]." |
".$cLAB[$contig]." |
$orfsT |
".$cORFS[$contig][0]." |
".$cORFS[$contig][1]." |
".$cORFS[$contig][2]." |
".$cORFS[$contig][3]." |
".$cORFS[$contig][4]." |
".$cORFS[$contig][99]." |
".$cORFS[$contig]['-1']." |
";
# SOMATORIOS
$lab= $cLAB[$contig];
if ($lab != '')
{
$lSIZE[$lab]+= $size;
$lORFS[$lab][0]+= $cORFS[$contig][0];
$lORFS[$lab][1]+= $cORFS[$contig][1];
$lORFS[$lab][2]+= $cORFS[$contig][2];
$lORFS[$lab][3]+= $cORFS[$contig][3];
$lORFS[$lab][4]+= $cORFS[$contig][4];
$lORFS[$lab][99]+= $cORFS[$contig][99];
$lORFS[$lab]['-1']+= $cORFS[$contig]['-1'];
}
$ORFS['T']+= $orfsT;
$ORFS[0]+= $cORFS[$contig][0];
$ORFS[1]+= $cORFS[$contig][1];
$ORFS[2]+= $cORFS[$contig][2];
$ORFS[3]+= $cORFS[$contig][3];
$ORFS[4]+= $cORFS[$contig][4];
$ORFS[99]+= $cORFS[$contig][99];
$ORFS['-1']+= $cORFS[$contig]['-1'];
}
echo "
| TOTAL |
".$ORFS['T']." |
".$ORFS[0]." |
".$ORFS[1]." |
".$ORFS[2]." |
".$ORFS[3]." |
".$ORFS[4]." |
".$ORFS[99]." |
".$ORFS['-1']." |
";
echo "
";
$ORFS2=array();
### STATUS POR LAB
echo "
| LAB |
# Contigs |
Total Size |
# ORFs / Status |
| TOTAL |
Unverif. |
Valid |
Hipoth. |
Cons. Hip. |
Pending |
Rebuilt |
Invalid |
";
foreach ($lCONTIGS as $lab => $contigs)
{
$orfT= $lORFS[$lab][0]+$lORFS[$lab][1]+$lORFS[$lab][2]+$lORFS[$lab][3]+$lORFS[$lab][4]+$lORFS[$lab][99]+$lORFS[$lab]['-1'];
echo "
| $lab |
$contigs |
".$lSIZE[$lab]." |
$orfT |
".$lORFS[$lab][0]." |
".$lORFS[$lab][1]." |
".$lORFS[$lab][2]." |
".$lORFS[$lab][3]." |
".$lORFS[$lab][4]." |
".$lORFS[$lab][99]." |
".$lORFS[$lab]['-1']." |
";
$ORFS2['T']+= $orfT;
$ORFS2[0]+= $lORFS[$lab][0];
$ORFS2[1]+= $lORFS[$lab][1];
$ORFS2[2]+= $lORFS[$lab][2];
$ORFS2[3]+= $lORFS[$lab][3];
$ORFS2[4]+= $lORFS[$lab][4];
$ORFS2[99]+= $lORFS[$lab][99];
$ORFS2['-1']+= $lORFS[$lab]['-1'];
}
echo "
| TOTAL |
".$ORFS2['T']." |
".$ORFS2[0]." |
".$ORFS2[1]." |
".$ORFS2[2]." |
".$ORFS2[3]." |
".$ORFS2[4]." |
".$ORFS2[99]." |
".$ORFS2['-1']." |
";
echo "
";
$genopar->fechaPagina();
?>