Beispiel #1
0
 /**
 * Documentation for this function.
 */
 function onRerunReduce()
 {
     $req = $_REQUEST;
     $doflip = $req['doflip'];
     $modelID = $req['modelID'];
     $model = $_SESSION['models'][$modelID];
     $pdb = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $model['pdb'];
     $url = $_SESSION['dataURL'] . '/' . MP_DIR_MODELS . '/' . $model['pdb'];
     // If all changes were accepted, we will not need to re-run Reduce.
     // We're going to construct a lab notebook entry at the same time.
     $changes = decodeReduceUsermods($pdb);
     $rerun = false;
     $flags = '';
     $n = count($changes[0]);
     // How many changes are in the table?
     $autoflip = "<p>The following residues were flipped automatically by Reduce:\n<ul>\n";
     $userflip = "<p>The following residues were flipped manually by the user:\n<ul>\n";
     $userkeep = "<p>The following residues were NOT flipped, though Reduce recommended doing so:\n<ul>\n";
     for ($c = 0; $c < $n; $c++) {
         // Expect checks for ones flipped originally; expect no check for ones not flipped.
         $expected = $changes[4][$c] == "FLIP" || $changes[4][$c] == "CLS-FL";
         if ($expected) {
             if ($doflip[$c]) {
                 $autoflip .= "<li>{$changes[1][$c]} {$changes[2][$c]} {$changes[3][$c]} {$changes[13][$c]}</li>\n";
             } else {
                 $userkeep .= "<li>{$changes[1][$c]} {$changes[2][$c]} {$changes[3][$c]} {$changes[13][$c]}</li>\n";
                 $rerun = true;
             }
         } elseif ($doflip[$c]) {
             $userflip .= "<li>{$changes[1][$c]} {$changes[2][$c]} {$changes[3][$c]} {$changes[13][$c]}</li>\n";
         }
     }
     $autoflip .= "</ul>\n</p>\n";
     $userflip .= "</ul>\n</p>\n";
     $userkeep .= "</ul>\n</p>\n";
     $hcount = countReduceChanges($pdb);
     $parent = $_SESSION['models'][$model['parent']];
     $entry = "Reduce was run on {$parent['pdb']} to add and optimize hydrogens, and optimize Asn, Gln, and His flips, yielding {$model['pdb']}.\n";
     if ($hcount) {
         $entry .= "{$hcount['found']} hydrogens were found in the original model, and {$hcount['add']} hydrogens were added.\n";
         if ($hcount['std']) {
             $entry .= "{$hcount['std']} H were repositioned to standardize bond lengths.\n";
         }
         if ($hcount['adj']) {
             $entry .= "The positions of {$hcount['adj']} hydrogens were adjusted to optimize H-bonding.\n";
         }
     }
     if ($_SESSION['reduce_blength'] == 'ecloud') {
         $flags = 'electron-cloud';
     } else {
         $flags = 'nuclear';
     }
     $entry .= "<p>Reduce placed hydrogens at {$flags} positions.\n";
     $entry .= "<p>Reduce used <a href=http://kinemage.biochem.duke.edu/software/reduce.php> reduce_wwPDB_het_dict.txt </a> as the het dictonary.\n";
     if ($doflip && $n > 0) {
         $entry .= "<p>You can now download this atom-shifted and annotated <a href='{$url}'>PDB file with hydrogens</a>";
         $entry .= " or <a href='download_trimmed.php?{$_SESSION['sessTag']}&file={$pdb}'>without hydrogens (flips only)</a> <b>which should be re-refined before deposition.</b></p>\n";
     } else {
         $entry .= "<p>You can now download the optimized and annotated <a href='{$url}'>PDB file with hydrogens</a>";
         $entry .= " or <a href='download_trimmed.php?{$_SESSION['sessTag']}&file={$pdb}'>without hydrogens (flips only)</a>.</p>\n";
     }
     $nqkin = $_SESSION['dataDir'] . '/' . MP_DIR_KINS . "/{$model['prefix']}flipnq.kin";
     $hiskin = $_SESSION['dataDir'] . '/' . MP_DIR_KINS . "/{$model['prefix']}fliphis.kin";
     if (file_exists($nqkin) && file_exists($hiskin)) {
         $entry .= "<p>These Flipkin kinemages illustrate both flip states for all Asn/Gln/His.\n";
         $entry .= "Residues that Reduce <i>suggested</i> flipping are marked with stars (*) in the Views menu.\n";
         $entry .= "<ul>\n";
         $entry .= "<li>" . linkKinemage("{$model['prefix']}flipnq.kin") . "</li>\n";
         $entry .= "<li>" . linkKinemage("{$model['prefix']}fliphis.kin") . "</li>\n";
         $entry .= "</ul></p>\n";
     }
     if (strpos($autoflip, "<li>") !== false) {
         $entry .= $autoflip;
     }
     if (strpos($userflip, "<li>") !== false) {
         $entry .= $userflip;
     }
     if (strpos($userkeep, "<li>") !== false) {
         $entry .= $userkeep;
     }
     // Go ahead and make the notebook entry inline -- this can't take more than 1-2 sec.
     if ($_SESSION['reduce_blength'] == 'ecloud') {
         $flags = '-build';
     } else {
         $flags = '-build -nuclear';
     }
     if ($rerun) {
         $title = "Added H with {$flags} and user overrides to get {$model['pdb']}";
     } else {
         $title = "Added H with {$flags} to get {$model['pdb']}";
     }
     unset($_SESSION['bgjob']);
     // Clean up any old data
     $_SESSION['bgjob']['labbookEntry'] = addLabbookEntry($title, $entry, "{$parent['id']}|{$modelID}", "auto", "add_h.png");
     $_SESSION['bgjob']['modelID'] = $_REQUEST['modelID'];
     $_SESSION['bgjob']['doflip'] = $_REQUEST['doflip'];
     // User requested changes; re-launch Reduce
     if ($rerun) {
         mpLog("reduce-custom:User made changes to flips suggested by Reduce -build");
         // launch background job
         pageGoto("job_progress.php");
         launchBackground(MP_BASE_DIR . "/jobs/reduce-fix.php", "reduce_done.php", 5);
     } else {
         mpLog("reduce-accept:User accepted all flips proposed by Reduce -build as-is");
         pageGoto("reduce_done.php", $_SESSION['bgjob']);
     }
 }
Beispiel #2
0
    $tasks['flipkin'] = "Create Asn/Gln and His <code>flipkin</code> kinemages";
}
setProgress($tasks, 'reduce');
$prereduceid = $_SESSION['lastUsedModelID'];
$newModel = createModel($modelID . "FH");
$outname = $newModel['pdb'];
$outpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS;
if (!file_exists($outpath)) {
    mkdir($outpath, 0777);
}
// shouldn't ever happen, but might...
$outpath .= '/' . $outname;
reduceBuild($pdb, $outpath, $reduce_blength);
$newModel['stats'] = pdbstat($outpath);
$newModel['parent'] = $modelID;
$changes = decodeReduceUsermods($outpath);
// Check to see if any cliques couldn't be solved by looking for scores = -9.9e+99
// At the same time, check to see if anything at all was flipped...
$didnt_solve = $did_flip = false;
$n = count($changes[0]);
// How many changes are in the table?
for ($c = 0; $c < $n; $c++) {
    if ($changes[6][$c] == "-9.9e+99") {
        $didnt_solve = true;
    }
    if (!$did_flip && ($changes[4][$c] == "FLIP" || $changes[4][$c] == "CLS-FL")) {
        $did_flip = true;
    }
}
// transfer mtz to reduced model
if (isset($_SESSION['models'][$modelID]['mtz_file'])) {
Beispiel #3
0
//function someFunctionName() {}
#}}}########################################################################
# MAIN - the beginning of execution for this page
############################################################################
$doflip = $_SESSION['bgjob']['doflip'];
$nqh_regularize = $_SESSION['nqh_regularize'];
if (!$nqh_regularize) {
    $modelID = $_SESSION['bgjob']['modelID'];
    $model = $_SESSION['models'][$modelID];
} else {
    $minModelID = $_SESSION['bgjob']['modelID'];
    $modelID = $_SESSION['models'][$minModelID]['modelID_pre_min'];
    $model = $_SESSION['models'][$modelID];
}
$pdb = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $model['pdb'];
$changes = decodeReduceUsermods($pdb);
// If all changes were accepted, we will not need to re-run Reduce.
$rerun = false;
// Make a file of flip-noflip commands for Reduce
$rawDir = $_SESSION['dataDir'] . '/' . MP_DIR_RAWDATA;
if (!file_exists($rawDir)) {
    mkdir($rawDir, 0777);
}
$flipfile = "{$rawDir}/{$model['prefix']}fix.flips";
$fp = fopen($flipfile, "wb");
$n = count($changes[0]);
// How many changes are in the table?
for ($c = 0; $c < $n; $c++) {
    if ($doflip[$c]) {
        fwrite($fp, "F:" . $changes[0][$c] . "\n");
    } else {