abrePagina("Contig Annotation Page"); $genopar->abreForm(); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo "Assembly: "; echo ""; $genopar->select("mtg", $mtgs, "","", TRUE); echo "
"; $genopar->submit(); echo "
"; $genopar->fechaForm(); $genopar->fechaPagina(); } if (strlen($UserAuth_group)!=2) $table='FP'; else $table= $UserAuth_group; $genopar->abrePagina("Contig Annotation Page [$mtg]"); echo ' '; $genopar->abreBanco(); $size=$reverse=$showInvalid=$showQual=$start=$end=$showTable=$geraFrames=$showClones=$COGcolors=''; $zoom=10; $kb=10; verGetPost(array("processa", "contig", "start", "end", "reverse", "showInvalid", "COGcolors", "geraFrames", "zoom", "showQual", "showTable", "kb", "showClones")); if ($geraFrames == '') $geraFrames = 0; if (!$processa) $geraFrames = 1; if ($showInvalid == '') $showInvalid=0; if ($reverse == '') $reverse = 0; if ($COGcolors == '') $COGcolors = 0; if ($zoom == '' or $zoom<1 or $zoom>19) $zoom=10; $n= $genopar->queryBanco("SELECT id as contig, tam FROM contig WHERE idMontagem='$mtg' ORDER BY id"); $contig_lab= array(); while ($lin= $genopar->getArray()){ array_push($contig_lab, $lin['contig']); $contigs[$lin['contig']]=$lin['tam']; } // $n= $genopar->queryBanco('select contig_num, bp_untrim from contigs where bp_trim>0 and qual_med>20 order by contig_num'); // // $contigs= array(); // while ($lin= $genopar->getArray()) // $contigs[$lin['contig_num']]=$lin['tam']; $kbArray = array(1,5,10,20,50,100); $owArray = array(50,100, 150, 200, 300); $ohArray = array(10,20,50); echo '

'; echo '

'; $genopar->input("mtg", "hidden", $mtg); echo " "; if ($processa=='Fasta'){ if ($start == "" or $start < 1) $start= 1; elseif ($start > $contigs[$contig]) $start = $contigs[$contig]; if (($end == "") or ($end > $contigs[$contig])) $end = $contigs[$contig]; if ($start < $end && $reverse){ $tmp = $end; $end = $start; $start = $tmp; }elseif($start > $end && !$reverse){ $tmp = $end; $end = $start; $start = $tmp; } } echo " "; echo ""; echo ""; echo ""; echo " "; echo "
Contig: Start: End:
Zoom: KB:"; $genopar->select("kb", $kbArray, $kb, "", FALSE); echo " Frames
Invalid ORFs COG colors Info Table
Quality Clones ORF height (px)"; $genopar->select("orfHeight", $ohArray, $orfHeight); echo "
Reverse Complement
"; // // // Com escala // // // // // Sem escala // // // // "; // echo "ORF width (px)"; $genopar->select("orfWidth", $owArray, $orfWidth); // echo ""; // echo "ORF height (px)"; $genopar->select("orfHeight", $ohArray, $orfHeight); // echo ""; // echo " // echo '

'; if ($processa=='Graphic'){ $ctgLength = $contigs[$contig]; if ($escala){ if ($showClones == 1 || $showQual != ''){ if ($kb != '') $kb *= 1000; else $kb = 0; if ($start == '') $ini = 0; else $ini = $start; if ($end == ''){ if ($kb > 0) $fim = $ini + $kb; else $fim = $ctgLength; }else{ if ($kb > 0 && $ini + $kb <= $end) $fim = $ini + $kb; else $fim = $end; } for(;;){ if ($ctgLength < $ini || ($fim > 0 && $fim < $ini)) break; $imgSrc = geraGraphAnnot($mtg,$contig,$ini,$fim,"",$zoom,$geraFrames,$showInvalid, $showQual, $showClones, $COGcolors); if ($showQual != ''){ list($width, $height, $type, $attr) = getimagesize($imgSrc); $qualSrc = "qual$contig.$ini.$fim.$width.$geraFrames.png"; $qualGraphFile = "/genome/web/html/HS/annotV1/tmp/$qualSrc"; $ctgQualFile = "/genome/data/montagens/HS/20030818/edit_dir/20030818.fasta.screen.contigs.qual"; system("/genome/bin/HS/geraQualGraph.pl $ctgQualFile $contig $width $ini $fim $qualGraphFile"); } if ($showClones == 1) showClones($genopar, $contig, $ini, $fim, $size, $zoom); echo "

"; if ($showQual != ''){ echo "
";} echo ""; echo "

"; ob_flush(); flush(); $areaFile_name= "tmp/area.ctg$contig.$ini.$fim.$zoom.$showInvalid"; if (is_readable($areaFile_name)){ $areaFile = fopen($areaFile_name, 'r'); $i = 0; while (!feof($areaFile)){ $line = fgets($areaFile, 4096); echo "$line\n"; if (preg_match("/TITLE/i", $line) && $showTable){ $array = preg_split("/'/", $line); $str = $array[1]; $info = preg_split("/
/", $str); foreach ($info as $data){ if ($data == '') continue; if (preg_match("/<..?>/", $data)){ $split = preg_split("/<..?>/",$data); $key = $split[1]; $value = $split[2]; }else{ $key = 'Gene Id'; $value = $data; } $tbl[$i][$key] = trim($value); $keys[$key] = 1; } $i++; } } fclose($areaFile); } if ($kb > 0){ $ini += $kb; $fim += $kb; if ($end != '' && $fim > $end) $fim = $end; }else{ break; } } } else{ $toSplitSize = 500000; if ($kb != '') $kb *= 1000; else $kb = 0; if ($start == '') $ini = 1; else $ini = $start; if ($end == '') $fim = $ctgLength; else $fim = $end; tabelaEstatistica($genopar, $mtg, $contig, $ini, $fim, $COGcolors); if ($fim - $ini > $toSplitSize){ $stop = $fim; $split = 1; $regionStart = $ini; $regionEnd = $regionStart + $toSplitSize; for( $regionStart = $ini, $regionEnd = $ini + $toSplitSize - 1; $regionStart < $stop; $regionStart += $toSplitSize, $regionEnd += $toSplitSize){ if ($regionEnd > $fim) $regionEnd = $fim; $imgSrc = geraSingleGraphAnnot($mtg,$contig,$regionStart,$regionEnd,"",$zoom,$geraFrames,$showInvalid, $showQual, $showClones, $kb,$COGcolors); echo "

"; echo ""; echo "

"; ob_flush(); flush(); $areaFile_name= "tmp/area.ctg$contig.$regionStart.$regionEnd.$zoom.$showInvalid"; if (is_readable($areaFile_name)){ $areaFile = fopen($areaFile_name, 'r'); $i = 0; while (!feof($areaFile)){ $line = fgets($areaFile, 4096); echo "$line\n"; if (preg_match("/TITLE/i", $line) && $showTable){ $array = preg_split("/'/", $line); $str = $array[1]; $info = preg_split("/
/", $str); foreach ($info as $data){ if ($data == '') continue; if (preg_match("/<..?>/", $data)){ $split = preg_split("/<..?>/",$data); $key = $split[1]; $value = $split[2]; }else{ $key = 'Gene Id'; $value = $data; } $tbl[$i][$key] = trim($value); $keys[$key] = 1; } $i++; } } fclose($areaFile); } } }else{ $imgSrc = geraSingleGraphAnnot($mtg,$contig,$ini,$fim,"",$zoom,$geraFrames,$showInvalid, $showQual, $showClones, $kb,$COGcolors); echo "

"; echo ""; echo "

"; ob_flush(); flush(); $areaFile_name= "tmp/area.ctg$contig.$ini.$fim.$zoom.$showInvalid"; if (is_readable($areaFile_name)){ $areaFile = fopen($areaFile_name, 'r'); $i = 0; while (!feof($areaFile)){ $line = fgets($areaFile, 4096); echo "$line\n"; if (preg_match("/TITLE/i", $line) && $showTable){ $array = preg_split("/'/", $line); $str = $array[1]; $info = preg_split("/
/", $str); foreach ($info as $data){ if ($data == '') continue; if (preg_match("/<..?>/", $data)){ $split = preg_split("/<..?>/",$data); $key = $split[1]; $value = $split[2]; }else{ $key = 'Gene Id'; $value = $data; } $tbl[$i][$key] = trim($value); $keys[$key] = 1; } $i++; } } fclose($areaFile); } } } if ($showTable && count($keys) > 0){ $genopar->abreForm("showSeqORF(); return false;", "frm"); echo ' '; echo ''; echo ""; foreach ($keys as $k => $v) echo ""; echo ''; $color = '#CCCCEE'; for ($i=0; $i"; echo ""; foreach ($keys as $k => $v) echo ""; echo ''; if ($color == '#CCCCEE') $color = '#DDDDFF'; else $color = '#CCCCEE'; } $col = count($keys) + 1; echo ""; echo '
"; $genopar->input("all", "checkbox", "on", "onClick=\"CheckAll(); return true;\""); echo "$k
"; $genopar->input("ORF".$tbl[$i]['ORF'], "checkbox", "ORF".$tbl[$i]['ORF']); echo "".$tbl[$i][$k]."
FASTA: nt - aa

'; $genopar->fechaForm(); } }/*else{ if ($start == '') $ini = 0; else $ini = $start; if ($end == '') $fim = $ctgLength; else $fim = $end; $imgSrc = geraNoScaleGraphAnnot($mtg,$contig, $ini, $fim, $orfWidth, $orfHeight); echo "

"; echo ""; echo "

"; }*/ } elseif ($processa=='Fasta'){ $fcontig="../Fasta/$mtg/Contigs/n/Contig".$contig.".fas"; if ($start > $end) $reverse= 1; if ( !(is_readable($fcontig)) ) $genopar->error("

Não foi possível ler contig do arquivo: $fcontig"); $file = fopen($fcontig, 'r'); $header = trim(fgets($file, 4096)); $header .= " [$start..$end]\n"; $SEQ=''; for ($linha= 1; !feof($file); $linhas++){ $line = fgets($file, 4096); $SEQ.= trim($line); } $seq= substr($SEQ,$start-1,$end-$start+1); if ($reverse) { $size = $start-$end+1; $array = str_split(substr($SEQ, 0, $size)); $array = array_reverse($array); $seq = ''; foreach ($array as $nt){ $seq .= complement($nt); } } else { $size = $end-$start+1; $seq= strtoupper(substr($SEQ,$start-1,$size)); } $seqn=""; $cols = 80; for($i=0;$i'; $rows=10; echo ($reverse?"Reverse Complement ":"")."Nucleotide Sequence: ($size pb)


"; // $URLBASE = "http://www.ncbi.nlm.nih.gov"; // $progs = "