Пример #1
0
function baseineStatus($version, $baseline, $component, $runtype)
{
    $pass = $fail = $abort = $other = 0;
    $state = extractVersion($baseline, 2);
    $status = array();
    $runtype = $state[4];
    $sql = 'SELECT caseID, ' . $version . ' as version from baseline_cases_' . $runtype . ' where componentID = ' . $component . ' order by caseID;';
    $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)) {
        $caseID = $row[caseID];
        $status[$caseID] = $row['version'];
    }
    foreach ($status as $id => $value) {
        $basic = extractVersion($value, 2);
        $runtypeall = $basic[4];
        if ($runtypeall == $runtype) {
            switch ($basic[1]) {
                case "PASSED":
                    $pass = $pass + 1;
                    continue;
                case "FAILED":
                    $fail = $fail + 1;
                    continue;
                case "ABORTED":
                    $abort = $abort + 1;
                    continue;
                default:
                    $other = $other + 1;
                    continue;
            }
        }
    }
    $version = extractVersion($version, 1);
    $sql = 'UPDATE baseline SET pass = '******' ,fail  =' . $fail . ', abort = ' . $abort . ', skip = ' . $other . ' where version = \'' . $version . '\' and componentID = ' . $component . ' and  moduletype = \'' . $runtype . '\';';
    mysql_unbuffered_query($sql);
}
        $p = "/\\/\\/.*?/";
        $p2 = preg_split($p, $p1[1]);
        $rm = $p2[0];
        //remove numbers
        $rm = str_replace(range(0, 9), "", $rm);
        //remove newlines
        $rm = trim(str_replace("\n", "", $rm));
        //remove spaces
        $rm = preg_replace("/\\s\\s+/", "", $rm);
        $rm = preg_replace("/\\s/", "", $rm);
        $rm = strtoupper($rm);
    }
    return $rm;
}
function extractFeaturesRaw($gb_str)
{
    $rm = null;
    $p = "/FEATURES\\s+.*?/";
    $p1 = preg_split($p, $gb_str);
    if (isset($p1[1])) {
        $p = "/ORIGIN\\s+.*?/";
        $p2 = preg_split($p, $p1[1]);
        $rm = $p2[0];
    }
    return $rm;
}
$str = file_get_contents("/home/jose/tmp/genbank/tmp.gb");
$x = extractVersion($str);
print_r($x);
//parseRecordFromString($str);
//print_r($gb_fields);