function displayKin($context) { echo $this->pageHeader("Kinemage {$context['kinName']} added"); echo "Your kinemage has been uploaded. You may now view it in KiNG:\n"; echo "<ul><li>" . linkKinemage($context['kinName']) . "</li></ul>\n"; echo "<p>" . makeEventForm("onReturn"); echo "<input type='submit' name='cmd' value='Continue >'>\n</form></p>\n"; echo $this->pageFooter(); }
/** * Context must contain the following keys: * newModel the ID of the model just added * cnit a set of CNIT codes for residues that were processed * sswingChanges the changes for pdbSwapCoords() produced by SSWING */ function display($context) { echo $this->pageHeader("Review SSwing changes"); $modelID = $context['newModel']; $model = $_SESSION['models'][$modelID]; $cnit = $context['cnit']; ?> <p> Please examine the kinemage below to see the effects of changes made by SSWING. Afterwards, please select which of the changes you would like to accept as-is. Residues that are not selected will be restored to their original conformation. </p><?php echo "<p>" . linkKinemage("{$model['prefix']}sswing.kin") . "</p>\n"; echo makeEventForm("onMakeFinalPDB") . "<p>"; foreach ($cnit as $res) { echo "<br><input type='checkbox' name='cnit[{$res}]' value='{$res}' checked> {$res}\n"; } echo "</p><p><input type='submit' name='cmd' value='Generate modified PDB file >'></p>\n"; echo "</form>\n"; echo $this->pageFooter(); }
$tasks['dots'] = "Calculate contact dots using Probe"; } if ($doList) { $tasks['list'] = "List atomic contacts found by Probe"; } $tasks['notebook'] = "Make lab notebook entry"; // Actually run things $entry = ""; if ($doProbe) { setProgress($tasks, 'kin'); // updates the progress display if running as a background job exec($prekin_cmd1); setProgress($tasks, 'dots'); // updates the progress display if running as a background job exec($probe_cmd1); $entry .= "<p>Your kinemage is ready for viewing in KiNG: " . linkKinemage($outname) . "</p>\n"; $entry .= "<p>The actual commands used were as follows:\n<ul>\n"; $entry .= "<li><code>prekin -lots {$model['pdb']} > {$outname}</code></li>\n"; $entry .= "<li><code>probe {$flags} {$model['pdb']} >> {$outname}</code></li>\n"; $entry .= "</ul>\n"; } if ($doList) { setProgress($tasks, 'list'); // updates the progress display if running as a background job exec($probe_cmd2); $entry .= "Types of contacts include the following:"; $entry .= "<p><code>hb</code> = hydrogen bond; <code>wc</code> = wide contact; <code>cc</code> = close contact; <code>so</code> = small overlap; <code>bo</code> = big overlap"; $entry .= "<p>The list of contacts is as follows:</p>\n"; $entry .= "<p><pre>\n"; $entry .= @file_get_contents($list_out); $entry .= "</pre></p>\n";
//echo "For $pdbName\n"; if (preg_match("/" . $modelID . ".*\\.[0-9]*-[0-9]*\\.pdb/", $pdbName)) { //echo "Found $pdbName\n"; $filledPdbFile = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $pdbName; $pdburl = $_SESSION['dataURL'] . '/' . MP_DIR_MODELS . '/' . $pdbName; $pdbEntries .= "<p>File <a href='{$pdburl}'>{$pdbName}</a> (" . formatFilesize(filesize($filledPdbFile)) . ").</p>\n"; $gapCount += 1; } else { if (preg_match("/.kin/", $pdbName)) { // because JiffiLoop puts all output files in one directory, this moves the output kin to the kin directory. //echo "kin file name: ".$pdbName."\n"; $origKinFile = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $pdbName; $newKinFile = $kinDir . '/' . $pdbName; rename($origKinFile, $newKinFile); $jiffiKin = $pdbName; } } } //$pdbout = $_SESSION['dataDir'].'/'.MP_DIR_MODELS.'/'.$pdbpath; //$pdburl = $_SESSION['dataURL'].'/'.MP_DIR_MODELS.'/'.$pdbpath; $entry = "Jiffiloop was run on {$model['pdb']}; {$gapCount} JiffiLoop PDB files were found. If there are no files shown here, JiffiLoop likely crashed; please contact the developers.\n"; //$entry .= "<p>You can now <a href='$pdburl'>download the annotated PDB file</a> (".formatFilesize(filesize($pdb)).").</p>\n"; $entry .= $pdbEntries; $entry .= "<p>A kinemage of the fragments from this run is ready for viewing in KiNG: " . linkKinemage($jiffiKin) . "</p>\n"; $_SESSION['bgjob']['labbookEntry'] = addLabbookEntry("Filled gaps in {$modelID}.", $entry, "{$modelID}|{$newModel['id']}", "auto", "add_h.png"); setProgress($tasks, null); ############################################################################ // Clean up and go home unset($_SESSION['bgjob']['processID']); $_SESSION['bgjob']['endTime'] = time(); $_SESSION['bgjob']['isRunning'] = false;
/** * 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']); } }
$flag = "-cass"; break; } // Do this after file name or it'll get junked up! if ($rainbow) { $flag .= " -colornc"; } // Color ramp N --> C ? if ($cpkballs) { $flag .= " -show 'mc,sc,ht,at'"; } $tasks['kin'] = "Make kinemage using <code>Prekin {$flag}</code>"; setProgress($tasks, 'kin'); // updates the progress display if running as a background job $outfile = "{$kinDir}/{$model['prefix']}{$scriptName}.kin"; if ($scriptName == "halfbonds") { $cmd = "prekin {$flag} {$infile} | php -f " . MP_BASE_DIR . "/lib/halfbonds.php > {$outfile}"; } else { $cmd = "prekin {$flag} {$infile} > {$outfile}"; } exec($cmd); // Lab notebook entry / results page $entry = ""; $entry .= "<p>Your kinemage is ready for viewing in KiNG: " . linkKinemage("{$model['prefix']}{$scriptName}.kin") . "</p>\n"; $_SESSION['bgjob']['labbookEntry'] = addLabbookEntry("Made simple kinemage of {$model['pdb']}", $entry, $modelID, "auto", "porin_barrel.png"); setProgress($tasks, null); ############################################################################ // Clean up and go home unset($_SESSION['bgjob']['processID']); $_SESSION['bgjob']['endTime'] = time(); $_SESSION['bgjob']['isRunning'] = false;
makeRamachandranPDF($infile, $outfile); $labbookEntry .= "<h3>Multi-model Ramachandran plot</h3>\n"; $labbookEntry .= "<p>" . linkAnyFile("{$ensemble['prefix']}rama.pdf", "Ramachandran plot PDF") . "</p>\n"; } if ($opts['doMultiGraph']) { setProgress($tasks, 'multigraph'); // updates the progress display if running as a background job $outfile = "{$kinDir}/{$ensemble['prefix']}multigraph.kin"; makeChartKin($infiles, $outfile); $labbookEntry .= "<div class='alert'>\n<center><h3>ALPHA TEST</h3></center>\n"; $labbookEntry .= "Not suitable for use by the general public: " . linkKinemage("{$ensemble['prefix']}multigraph.kin", "Multi-criterion graph"); $labbookEntry .= "</div>\n"; } if ($opts['doMultiModelChart']) { setProgress($tasks, 'multichart'); // updates the progress display if running as a background job $outfile = "{$kinDir}/{$ensemble['prefix']}mmmcc.kin"; // Multi-Model Multi-Criterion Chart writeMultimodelChart($infiles, $outfile); $labbookEntry .= "<div class='alert'>\n<center><h3>ALPHA TEST</h3></center>\n"; $labbookEntry .= "Not suitable for use by the general public: " . linkKinemage("{$ensemble['prefix']}mmmcc.kin", "Multi-chart mockup"); $labbookEntry .= "</div>\n"; } setProgress($tasks, null); //----------------------------------------------------------------- $_SESSION['bgjob']['labbookEntry'] = addLabbookEntry("Analysis output: all-atom contacts and geometry for {$ensemble['pdb']}", $labbookEntry, $ensID, "auto", "clash_rama.png"); ############################################################################ // Clean up and go home unset($_SESSION['bgjob']['processID']); $_SESSION['bgjob']['endTime'] = time(); $_SESSION['bgjob']['isRunning'] = false;