Exemple #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']);
     }
 }
reduceNoBuild($pdb, $outpath, $reduce_blength);
$newModel['stats'] = pdbstat($outpath);
$newModel['parent'] = $modelID;
if ($reduce_blength == 'ecloud') {
    $newModel['history'] = "Derived from {$model['pdb']} by Reduce -nobuild9999";
}
if ($reduce_blength == 'nuclear') {
    $newModel['history'] = "Derived from {$model['pdb']} by Reduce -nobuild9999 -nuclear";
}
$newModel['isUserSupplied'] = $model['isUserSupplied'];
$newModel['isReduced'] = true;
$_SESSION['models'][$newModel['id']] = $newModel;
$_SESSION['bgjob']['modelID'] = $newModel['id'];
$_SESSION['lastUsedModelID'] = $newModel['id'];
// this is now the current model
$hcount = countReduceChanges($outpath);
setProgress($tasks, 'notebook');
$pdb = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $outname;
$url = $_SESSION['dataURL'] . '/' . MP_DIR_MODELS . '/' . $outname;
$entry = "Reduce was run on {$model['pdb']} to add and optimize missing hydrogens, resulting in {$newModel['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";
    }
}
$entry .= "Asn/Gln/His flips were not optimized.\n";
$entry .= "<p>You can now <a href='{$url}'>download the annotated PDB file</a> (" . formatFilesize(filesize($pdb)) . ").</p>\n";
Exemple #3
0
if ($method == 'build') {
    $newEnsID = reduceEnsemble($oldEnsID, 'reduceBuild');
} elseif ($method == 'nobuild') {
    $newEnsID = reduceEnsemble($oldEnsID, 'reduceNoBuild');
} else {
    $newEnsID = reduceEnsemble($oldEnsID);
}
$newEns = $_SESSION['ensembles'][$newEnsID];
$_SESSION['lastUsedModelID'] = $newEnsID;
// this is now the current model
setProgress($tasks, 'notebook');
$pdb = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newEns['pdb'];
$url = $_SESSION['dataURL'] . '/' . MP_DIR_MODELS . '/' . $newEns['pdb'];
// This should find the line for the first model, at least.
// Some USER MOD records may be munged by the model-joining process.
$hcount = countReduceChanges($pdb);
$entry = "Reduce was run on all models of {$oldEns['pdb']} to add and optimize missing hydrogens, resulting in {$newEns['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";
    }
}
$entry .= "Asn/Gln/His flips were " . ($method == 'build' ? "" : "not") . " optimized.\n";
if ($reduce_blength == 'ecloud') {
    $flags = 'electron-cloud';
} else {
    $flags = 'nuclear';