当前位置: 首页>>代码示例>>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;未经允许,请勿转载。