Ejemplo n.º 1
0
function test_lists($info1, $info2)
{
    if ($info1["gid"] != $info2["gid"]) {
        echo "&diffgen";
        return;
    }
    if (gene_names_check($info1["ldir"], $info1["gdir"], $unfound1, $duplicates1) || gene_names_check($info2["ldir"], $info2["gdir"], $unfound2, $duplicates2)) {
        echo "&check";
        return;
    }
    $genes1 = file($info1['ldir'] . "/list.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $genes2 = file($info2['ldir'] . "/list.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $positions = file($info1['gdir'] . "/position.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $genes12 = array_intersect($genes1, $genes2);
    $n1 = count($genes1);
    $n2 = count($genes2);
    $n12 = count($genes12);
    $ntot = count($positions);
    $ntm1 = $ntot - $n1;
    $command = "./randomizzatore/hyper {$n12} {$n1} {$ntm1} {$n2}";
    //    echo $command . "\n";
    $pval = exec($command);
    echo $n1 . "&" . $n2 . "&" . $n12 . "&" . $ntot . "&" . $pval . "\n";
    echo "&end\n";
}
Ejemplo n.º 2
0
function return_unfound_and_duplicates($info)
{
    gene_names_check($info["ldir"], $info["gdir"], $unfound, $duplicates);
    if (isset($unfound)) {
        echo "&unfounds\n";
        $syntable = open_syntable($info["gdir"] . "/synonim.txt");
        foreach ($unfound as $gene) {
            $syn = isset($syntable[$gene]) ? $syntable[$gene] : false;
            if ($syn) {
                echo "{$gene}&{$syn}\n";
            } else {
                echo $gene . "\n";
            }
        }
    }
    if (isset($duplicates)) {
        echo "&duplicates\n";
        foreach ($duplicates as $gene) {
            echo $gene . "\n";
        }
    }
    echo "&end\n";
}
Ejemplo n.º 3
0
function look_if_available($info)
{
    global $dbh;
    if (isset($info["ljob"])) {
        $query = sprintf("SELECT exit_code FROM jobs WHERE rec_id=%u", $info['ljob']);
        $result = $dbh->query($query);
        $ecode = $result->fetchColumn();
        if (isset($ecode) && $ecode == 0) {
            // The results are available
            echo "&available";
            return;
        } else {
            if (isset($ecode) && $ecode != 0) {
                // The processing encountered an error
                echo "&procerror&{$ecode}";
                return;
            } else {
                echo "&waiting";
                return;
            }
        }
    }
    if (gene_names_check($info["ldir"], $info["gdir"], $unfound, $duplicates)) {
        echo "&synon";
        return;
    }
    $jid = start_job("graficatore/cluster.sh {$info['ldir']} {$info['gdir']} " . "10000 {$info['lcode']}", $info['ldir'] . "/jobout.txt", $info['ldir'] . "/joberr.txt");
    $query = sprintf("UPDATE lists SET job_id=%u WHERE rec_id=%u", $jid, $info['lid']);
    if ($dbh->exec($query) != 1) {
        echo "&procerror&12";
        return;
    }
    $info = list_load_info($info['lid']);
    // waiting
    echo "&waiting";
    return;
}