當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DatabaseManager::insertClause方法代碼示例

本文整理匯總了PHP中DatabaseManager::insertClause方法的典型用法代碼示例。如果您正苦於以下問題:PHP DatabaseManager::insertClause方法的具體用法?PHP DatabaseManager::insertClause怎麽用?PHP DatabaseManager::insertClause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager::insertClause方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: performLikelihoodRateFilter

 static function performLikelihoodRateFilter($con, $previousTable, $currentTable, $args)
 {
     if ($args == null || count($args) == 0) {
         return;
     } else {
         if (count($args) != 2) {
             REDLog::writeErrLog("Args for Likelihood Rate Test Filter are incomplete, please have a check");
         }
     }
     $dnaVcfTable = $args[0];
     $threshold = (double) $args[1];
     TableCreator::createFilterTable($con, $previousTable, $currentTable);
     REDLog::writeInfoLog("Start performing Likelihood Rate Test Filter");
     $sqlClause1 = "select {$previousTable}.chrom,{$previousTable}.pos,{$previousTable}.AD,\n{$dnaVcfTable}.qual from {$previousTable},{$dnaVcfTable} where {$previousTable}.chrom=\n{$dnaVcfTable}.chrom and {$previousTable}.pos={$dnaVcfTable}.pos";
     $rs = DatabaseManager::query1($con, $sqlClause1);
     $i = 0;
     while ($row = mysqli_fetch_array($rs)) {
         $chr = (string) $row[0];
         $pos = (int) $row[1];
         $ad = (string) $row[2];
         $qual = (double) $row[3];
         $pb = new SiteBean();
         $pb->SiteBean1($chr, $pos);
         $pb->setAd($ad);
         $pb->setQual($qual);
         $siteBeans[$i] = $pb;
         $i++;
     }
     DatabaseManager::setAutoCommit($con, false);
     $count = 0;
     for ($j = 0; $j < $i; $j++) {
         $str = $siteBeans[$j]->getAd();
         $section = explode("/", $str);
         $ref = (int) $section[0];
         $alt = (int) $section[1];
         if ($ref + $alt > 0) {
             $f_ml = 1.0 * $ref / ($ref + $alt);
             $y = pow($f_ml, $ref) * pow(1 - $f_ml, $alt);
             $y = log($y) / log(10.0);
             $judge = $y + $siteBeans[$j]->getQual() / 10.0;
             if ($judge >= $threshold) {
                 $siteChr = $siteBeans[$j]->getChr();
                 $sitePos = $siteBeans[$j]->getPos();
                 $sqlClause2 = "insert into {$currentTable} select * from {$previousTable} where chrom='" . $siteChr . "' and pos=" . $sitePos;
                 DatabaseManager::insertClause($con, $sqlClause2);
                 if (++$count % 10000 == 0) {
                     DatabaseManager::commit($con);
                 }
             }
         }
     }
     DatabaseManager::commit($con);
     DatabaseManager::setAutoCommit($con, true);
     REDLog::writeInfoLog("End performing Likelihood Rate Test Filter");
 }
開發者ID:Taruca,項目名稱:lib,代碼行數:55,代碼來源:LikelihoodRateFilter.php

示例2: performEditingTypeFilter

 static function performEditingTypeFilter($con, $previousTable, $currentTable, $args)
 {
     REDLog::writeInfoLog('Star executing Editing Type Filter');
     TableCreator::createFilterTable($con, $previousTable, $currentTable);
     $refAlt = $args;
     $refAlt2 = REDTools::getNegativeStrandEditingType($refAlt);
     $sql11 = substr($refAlt, 0, 1);
     $sql12 = substr($refAlt, 1);
     $sql21 = substr($refAlt2, 0, 1);
     $sql22 = substr($refAlt2, 1);
     $sql1 = "insert into " . $currentTable . " select * from " . $previousTable . " WHERE REF='{$sql11}' AND ALT='{$sql12}' AND GT!='0/0'";
     $v = DatabaseManager::insertClause($con, $sql1);
     if (!$v) {
         REDLog::writeErrLog('There is a syntax error for SQL clause:' . $sql1);
     }
     $sql2 = "insert into " . $currentTable . " select * from " . $previousTable . " WHERE REF='{$sql21}' AND ALT='{$sql22}' AND GT!='0/0'";
     $v = DatabaseManager::insertClause($con, $sql2);
     if (!$v) {
         REDLog::writeErrLog('There is a syntax error for SQL clause:' . $sql2);
     }
     REDLog::writeInfoLog('End executing Editing Type Filter');
 }
開發者ID:Taruca,項目名稱:lib,代碼行數:22,代碼來源:EditingTypeFilter.php


注:本文中的DatabaseManager::insertClause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。