Example #1
0
function getMaps($code)
{
    global $map_notebook_msg;
    $map_notebook_msg = "";
    $prog = getProgressTasks();
    if ($_SESSION['bgjob']['eds_2fofc']) {
        $prog['2fofc'] = "Download 2Fo-Fc map from the EDS";
    }
    if ($_SESSION['bgjob']['eds_fofc']) {
        $prog['fofc'] = "Download Fo-Fc (difference) map from the EDS";
    }
    $mapDir = "{$_SESSION['dataDir']}/" . MP_DIR_EDMAPS;
    if (!file_exists($mapDir)) {
        mkdir($mapDir, 0777);
    }
    if ($_SESSION['bgjob']['eds_2fofc']) {
        setProgress($prog, '2fofc');
        $mapName = "{$code}.omap.gz";
        $mapPath = "{$mapDir}/{$mapName}";
        if (!file_exists($mapPame)) {
            $tmpMap = getEdsMap($code, 'omap', '2fofc');
            if ($tmpMap && copy($tmpMap, $mapPath)) {
                unlink($tmpMap);
                $_SESSION['edmaps'][$mapName] = $mapName;
                mpLog("edmap-eds:User requested 2Fo-Fc map for {$code} from the EDS");
                $map_notebook_msg .= "<p>The 2Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n";
            } else {
                $map_notebook_msg .= "<p><div class='alert'>The 2Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n";
            }
        } else {
            echo "Map file already exists";
        }
    }
    if ($_SESSION['bgjob']['eds_fofc']) {
        setProgress($prog, 'fofc');
        $mapName = "{$code}-diff.omap.gz";
        $mapPath = "{$mapDir}/{$mapName}";
        if (!file_exists($mapPame)) {
            $tmpMap = getEdsMap($code, 'omap', 'fofc');
            if ($tmpMap && copy($tmpMap, $mapPath)) {
                unlink($tmpMap);
                $_SESSION['edmaps'][$mapName] = $mapName;
                mpLog("edmap-eds:User requested Fo-Fc map for {$code} from the EDS");
                $map_notebook_msg .= "<p>The Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n";
            } else {
                $map_notebook_msg .= "<p><div class='alert'>The Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n";
            }
        }
    }
    setProgress($prog, null);
}
Example #2
0
function removeHydrogens($inpath, $outpath)
{
    $tasks = getProgressTasks();
    $tasks['reducetrim'] = "Remove hydrogens to avoid possible conflict with hydrogen lengths";
    $tmp1 = mpTempfile("tmp_pdb_");
    setProgress($tasks, 'reducetrim');
    reduceTrim($inpath, $tmp1);
    copy($tmp1, $outpath);
    // Clean up temp files
    unlink($tmp1);
    setProgress($tasks, null);
    // all done
}