$sql = ""; $sqlparam = array(); } print "Updating flat_summary...\n"; $snap = "latest"; // If any are missing, just generate those $join = "LEFT JOIN flat_summary fs ON v.variant_id=fs.variant_id WHERE fs.variant_id IS NULL"; $tot = theDb()->getOne("SELECT COUNT(*) FROM variants v {$join}"); if ($tot == 0) { // If none are missing, refresh all $join = ""; $tot = theDb()->getOne("SELECT COUNT(*) FROM variants v"); } $q = theDb()->query("SELECT DISTINCT v.variant_id FROM variants v {$join}"); $n = 0; while ($row =& $q->fetchRow()) { ++$n; print "\r{$n} / {$tot} "; $flat = evidence_get_assoc_flat_summary($snap, $row["variant_id"]); $sql .= "(?, ?, ?, ?, ?),"; $sqlparam[] = $row["variant_id"]; $sqlparam[] = json_encode($flat); $sqlparam[] = $flat["autoscore"]; $sqlparam[] = $flat["webscore"]; $sqlparam[] = $flat["n_genomes"]; if (count($sqlparam) > 100) { sqlflush(&$sql, &$sqlparam); } } sqlflush(&$sql, &$sqlparam); print "\n";
function evidence_update_flat_summary($variant_id) { $flat = evidence_get_assoc_flat_summary("latest", $variant_id); theDb()->query("REPLACE INTO flat_summary\n\t\t\tSET variant_id=?, flat_summary=?,\n\t\t\tautoscore=?, webscore=?, n_genomes=?", array($variant_id, json_encode($flat), $flat["autoscore"], $flat["webscore"], $flat["n_genomes"])); }
$html .= "<BR /><SPAN class=\"searchurl\">" . htmlspecialchars($url_abbrev) . "</SPAN>"; } else { $html .= $content; } $html . "</LI>"; $lasttag = $r["tag"]; } if ($lasttag !== FALSE) { $html .= "</UL>\n"; } $html .= "</DIV>\n"; } $html .= "<H2>Other <I>in silico</I> analyses<BR /> </H2>\n<DIV id=\"in_silico\">\n<UL>\n"; if ($aa) { $html .= "<LI>NBLOSUM100 score = <STRONG>" . ereg_replace("-", "–", 0 - blosum100($row0["variant_aa_from"], $row0["variant_aa_to"])) . "</STRONG></LI>\n"; } $autoscore_html = $row0["autoscore"]; if ($autoscore_html > 0) { $autoscore_html = "<SPAN onmouseover=\"Tip('" . htmlspecialchars($row0["autoscore_flags"]) . "',BALLOON,true,FIX,[this,-18,0],FOLLOWMOUSE,false,ABOVE,true,WIDTH,-400);\" onmouseout=\"UnTip();\">" . $autoscore_html . "</SPAN>"; } $html .= "<LI>GET-Evidence autoscore = <STRONG>" . $autoscore_html . "</STRONG>"; $html .= "</LI>\n"; $html .= "</UL>\n"; $html .= "</DIV>"; $html .= "<H2>Edit history<BR /> </H2>\n<DIV id=\"edit_history\">"; $html .= evidence_render_history($variant_id); $html .= "</DIV>"; $gOut["content"] .= $html; // $gOut["content"] .= "<!--\n" . ereg_replace ("-->", "\\-\\-\\>", json_encode ($report)) . "-->\n"; $gOut["content"] .= "<!--\n" . ereg_replace("-->", "\\-\\-\\>", json_encode(evidence_get_assoc_flat_summary("latest", $variant_id))) . "-->\n"; go();