/** * Documentation for this function. */ function onMakeFinalPDB() { $context = getContext(); $newModel = $_SESSION['models'][$context['newModel']]; $oldModel = $_SESSION['models'][$newModel['parent']]; $newPDB = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb']; $oldPDB = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $oldModel['pdb']; $url = $_SESSION['dataURL'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb']; // Put our money where our mouth is and calculate that new PDB file $all_changes = $context['sswingChanges']; $usercnit = $_REQUEST['cnit']; // Remove changes for residues that weren't selected foreach ($all_changes as $k => $v) { $res = substr($k, 0, 9); if (!isset($usercnit[$res])) { unset($all_changes[$k]); } else { $changed_res[$res] = $res; } // used below for the lab notebook } // Make PDB file pdbSwapCoords($oldPDB, $newPDB, $all_changes); // Make up the lab notebook entry $text = "The following residues were automatically refit by SSWING, creating {$newModel['pdb']} from {$oldModel['pdb']}:\n<ul>\n"; foreach ($changed_res as $res) { $text .= "<li>{$res}</li>\n"; } $text .= "</ul>\n"; $text .= "<p>You can now <a href='{$url}'>download the optimized and annotated PDB file</a> (" . formatFilesize(filesize($newPDB)) . ").</p>\n"; $entryNum = addLabbookEntry("Refit sidechains with SSWING to get {$newModel['pdb']}", $text, "{$oldModel['id']}|{$newModel['id']}", 'auto'); $ctx = array('labbookEntry' => $entryNum); pageGoto("generic_done.php", $ctx); }
/** * Documentation for this function. */ function onTryAgain() { if ($_REQUEST['cmd'] == '< Try again') { pageGoto("upload_setup.php"); } else { pageReturn(); } }
/** * Launches Prekin when the user submits the form. */ function onChooseOptions() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['modelID'])) { $ctx = array(); $ctx['modelID'] = $req['modelID']; pageGoto("editpdb_setup2.php", $ctx); } }
/** * Documentation for this function. */ function onRunAnalysis() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['ensID'])) { $_SESSION['lastUsedModelID'] = $req['ensID']; // this is now the current "model" unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("aacgeom:Running all-atom contact and geometric analyses"); // The chartXXX vars aren't defined in this interface (yet), but they don't hurt anything... if ($req['kinClashes'] || $req['kinHbonds'] || $req['kinContacts'] || $req['chartClashlist']) { mpLog("aacgeom-aac:Generataing all-atom contact data of some type"); } if ($req['kinRama'] || $req['chartRama']) { mpLog("aacgeom-rama:Doing Ramachandran analysis"); } if ($req['kinRota'] || $req['chartRota']) { mpLog("aacgeom-rota:Doing rotamer analysis"); } if ($req['kinCBdev'] || $req['chartCBdev']) { mpLog("aacgeom-cbdev:Doing C-beta deviation analysis"); } if ($req['kinBaseP'] || $req['chartBaseP']) { mpLog("aacgeom-basep:Validating base-phosphate distances vs sugar puckers"); } // doMultiGraph hasn't been renamed to doCharts yet... if ($req['doKinemage']) { mpLog("aacgeom-mkin:Multi-criterion validation kinemage"); } //if($req['doCharts']) mpLog("aacgeom-mchart:Multi-criterion validation chart"); if ($req['doMultiGraph']) { mpLog("aacgeom-mchart:Multi-criterion validation chart"); } // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/ens_aacgeom.php", "generic_done.php", 5); } }
/** * Documentation for this function. */ function onStartSSwing() { $req = $_REQUEST; if ($req['cmd'] == 'Go back') { $c = getContext(); $ctx['modelID'] = $c['modelID']; $ctx['map'] = $c['map']; pageGoto("sswing_setup1.php", $ctx); return; } $ctx = getContext(); unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob']['modelID'] = $ctx['modelID']; $_SESSION['bgjob']['edmap'] = $ctx['map']; $_SESSION['bgjob']['cnit'] = $req['cnit']; $_SESSION['bgjob']['fastSearch'] = $req['fastSearch']; mpLog("sswing:Launched SSWING to refit " . count($_req['cnit']) . " residue(s)"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/sswing.php", "sswing_choose.php", 5); }
/** * Launches Prekin when the user submits the form. */ function onRunProbe() { $req = $_REQUEST; //if($req['cmd'] == 'Cancel') if ($req['cmd'] == 'Go back') { pageGoto("interface_setup1.php"); return; } // Otherwise, moving forward: $_SESSION['lastUsedModelID'] = $req['modelID']; // this is now the current model unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("interface:Visualizing interface contacts with complex Probe run"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/interface-vis.php", "generic_done.php", 5); }
/** * This function calls the notebook editor so the user can modify the notebook * entry. Control is transfered to another page, namely, notebook_edit.php. * When that page is done, it will call pageReturn(), and control will return * to this class--display() will be called again to show the entry. * * This function gets called when the user clicks the link made by display() * * $arg contains the entry number of the notebook entry to edit. It was specified * by the call to makeEventURL() that occurs in display(), above. * $req is filled in with the usually info from the form submission, but * we don't need to use it for anything here. */ function onPdbConvert() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } if (isset($req['modelID'])) { $_SESSION['lastUsedModelID'] = $req['modelID']; // this is now the current model unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("convertPdb:Converted '{$req['modelID']}' to PDBv2.3"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/pdb_convert.php", "generic_done.php", 3); } else { $context = getContext(); if (isset($req['modelID'])) { $context['modelID'] = $req['modelID']; } //if(isset($req['scriptName'])) $context['scriptName'] = $req['scriptName']; setContext($context); } }
/** * Documentation for this function. */ function onFeedbackSend() { $req = $_REQUEST; $subject = "MolProbity feedback: {$req['inRegardTo']}"; $msg_text = "\n" . "User name : {$req['senderName']}\n" . "User email : {$req['senderEmail']}\n" . "Subject : {$req['inRegardTo']}\n" . "\n\n" . wordwrap($req['feedbackText'], 76); // Write a local copy of the email in case sendmail isn't working $tmpfile = tempnam(MP_BASE_DIR . '/feedback', 'email_'); chmod($tmpfile, 0666 & ~MP_UMASK); // tempnam gets wrong permissions sometimes? $h = fopen($tmpfile, 'wb'); fwrite($h, $msg_text); fclose($h); $ok = mpSendEmail($req['senderName'], $req['senderEmail'], $subject, $msg_text); mpLog("feedback:Sent with subject {$req['inRegardTo']}; success={$ok}"); pageGoto("feedback_done.php", $msg_text); }
$isNewSess = mpStartSession(true); // New sessions must define where they start! // Default is welcome page unless URL is like index.php?start=____ if ($isNewSess) { if (date('F j') == 'April 1') { pageGoto("april_fools.php"); } else { switch ($_REQUEST['start']) { case "sitemap": pageGoto("sitemap.php"); break; case "xray": pageGoto("helper_xray.php"); break; default: pageGoto("welcome.php"); break; //default: pageGoto("april_fools.php"); break; } } } // Process submitted event ///////////////////////////////////////////////////// $page = end($_SESSION['pages']); // not a ref; read only $delegate = makeDelegateObject(); if ($isNewSess) { // new code for directly telling molprobity to fetch a pdb file with a get in the html call if (isset($_GET["pdbCode"])) { $pdbCode = $_GET["pdbCode"]; mpLog("new-session:New session started by calling MolProbity directly with " . $pdbCode); mpLog("browser-detect:" . $_SERVER['HTTP_USER_AGENT']);
/** * $arg is the name of the page to go to. */ function onGoto($page, $ctx = null) { pageGoto($page, $ctx); }
function onSubmitAnswer() { // Start session regardless of the answer pageGoto("welcome.php"); }
/** * 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']); } }
function doUploadError($type, $path = null) { $error_codes = array(UPLOAD_ERR_INI_SIZE => 'upload size exceeded upload_max_filesize (' . formatFilesize(ini_get('upload_max_filesize')) . ') in php.ini', UPLOAD_ERR_FORM_SIZE => 'upload size exceeded MAX_FILE_SIZE directive specified in the HTML form', UPLOAD_ERR_PARTIAL => 'the file was only partially uploaded', UPLOAD_ERR_NO_FILE => 'no file was specified for upload'); $errno = $_FILES['uploadFile']['error']; if ($errno && $error_codes[$errno]) { $msg = "File upload failed because " . $error_codes[$errno] . "."; } elseif ($errno) { $msg = "File upload failed with unrecognized error code {$_FILES[uploadFile][error]}."; } elseif ($path != null && file_exists($path)) { $msg = "File upload failed because another file of the same name already exists."; } elseif ($_FILES['uploadFile']['size'] <= 0) { $msg = "File upload failed because of zero file size (no contents)."; } else { $msg = "File upload failed for an unknown reason."; } pageGoto("upload_other_done.php", array('type' => $type, 'errorMsg' => $msg)); }
/** * This function calls the notebook editor so the user can modify the notebook * entry. Control is transfered to another page, namely, notebook_edit.php. * When that page is done, it will call pageReturn(), and control will return * to this class--display() will be called again to show the entry. * * This function gets called when the user clicks the link made by display() * * $arg contains the entry number of the notebook entry to edit. It was specified * by the call to makeEventURL() that occurs in display(), above. * $req is filled in with the usually info from the form submission, but * we don't need to use it for anything here. */ function onFillGaps() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } if (isset($req['modelID'])) { $_SESSION['lastUsedModelID'] = $req['modelID']; // this is now the current model unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("makekin:Filling fragments in: '{$req['modelID']}'"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/fillfragments.php", "generic_done.php", 3); } else { $context = getContext(); if (isset($req['modelID'])) { $context['modelID'] = $req['modelID']; } //if(isset($req['scriptName'])) $context['scriptName'] = $req['scriptName']; setContext($context); } }
/** * Documentation for this function. */ function onChooseResidues() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['modelID']) && isset($req['map'])) { $ctx['modelID'] = $req['modelID']; $ctx['map'] = $req['map']; pageGoto("sswing_setup2.php", $ctx); } else { $ctx = getContext(); if (isset($req['modelID'])) { $ctx['modelID'] = $req['modelID']; } if (isset($req['map'])) { $ctx['map'] = $req['map']; } setContext($ctx); } }
/** * Launches Prekin when the user submits the form. */ function onRunPrekin() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['modelID']) && isset($req['scriptName'])) { $_SESSION['lastUsedModelID'] = $req['modelID']; // this is now the current model unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("makekin:Creating simple kinemages from built-in Prekin script '{$req['scriptName']}'"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/makekin.php", "generic_done.php", 3); } else { $context = getContext(); if (isset($req['modelID'])) { $context['modelID'] = $req['modelID']; } if (isset($req['scriptName'])) { $context['scriptName'] = $req['scriptName']; } setContext($context); } }
/** * Documentation for this function. */ function onAddH() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['modelID']) && isset($req['method']) && isset($req['blength'])) { unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob']['modelID'] = $req['modelID']; $_SESSION['bgjob']['makeFlipkin'] = $req['makeFlipkin']; $_SESSION['bgjob']['nqh_regularize'] = $req['nqh_regularize']; $_SESSION['bgjob']['reduce_blength'] = $req['blength']; $_SESSION['reduce_blength'] = $_SESSION['bgjob']['reduce_blength']; if ($req['method'] == 'build') { if ($_SESSION['bgjob']['reduce_blength'] == 'ecloud') { mpLog("reduce-build:User ran default Reduce -build job; flipkins=" . $_REQUEST['makeFlipkin']); } else { mpLog("reduce-build:User ran default Reduce -build -nuclear job; flipkins=" . $_REQUEST['makeFlipkin']); } // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/reduce-build.php", "reduce_choose.php", 5); } elseif ($req['method'] == 'nobuild') { if ($_SESSION['bgjob']['reduce_blength'] == 'ecloud') { mpLog("reduce-nobuild:User ran Reduce with -nobuild9999 flag"); } else { mpLog("reduce-nobuild:User ran Reduce with -nobuild9999 -nuclear flag"); } // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/reduce-nobuild.php", "generic_done.php", 5); } } else { $context = getContext(); if (isset($req['modelID'])) { $context['modelID'] = $req['modelID']; } if (isset($req['method'])) { $context['method'] = $req['method']; } if (isset($req['blength'])) { $context['blength'] = $req['blength']; } setContext($context); } }
/** * Documentation for this function. */ function onRunAnalysis() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['modelID'])) { $_SESSION['lastUsedModelID'] = $req['modelID']; // this is now the current model unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob'] = $req; mpLog("aacgeom:Running all-atom contact and geometric analyses"); if ($req['kinClashes'] || $req['kinHbonds'] || $req['kinContacts'] || $req['chartClashlist']) { mpLog("aacgeom-aac:Generataing all-atom contact data of some type"); } if ($req['kinRama'] || $req['chartRama']) { mpLog("aacgeom-rama:Doing Ramachandran analysis"); } if ($req['kinRota'] || $req['chartRota']) { mpLog("aacgeom-rota:Doing rotamer analysis"); } if ($req['kinGeom'] || $req['chartGeom']) { mpLog("aacgeom-geom:Doing geometry analysis"); } if ($req['kinCBdev'] || $req['chartCBdev']) { mpLog("aacgeom-cbdev:Doing C-beta deviation analysis"); } if ($req['kinBaseP'] || $req['chartBaseP']) { mpLog("aacgeom-basep:Validating base-phosphate distances vs sugar puckers"); } if ($req['kinSuite'] || $req['chartSuite']) { mpLog("aacgeom-suite:Validating RNA backbone conformations"); } if ($req['doKinemage']) { mpLog("aacgeom-mkin:Multi-criterion validation kinemage"); } if ($req['doCharts']) { mpLog("aacgeom-mchart:Multi-criterion validation chart"); } $modelID = $_SESSION['bgjob']['modelID']; // $model = $_SESSION['models'][$modelID]; if ($req['chartHoriz'] and !isset($_SESSION['models'][$modelID]['mtz_file'])) { // check to see if there is one mtz. If so, then link it to the // model being analyzed automatically $xrayDir = $_SESSION['dataDir'] . '/' . MP_DIR_XRAYDATA; if (file_exists($xrayDir)) { $mtzs = array(); $handle = opendir($xrayDir); while (false !== ($entry = readdir($handle))) { if (substr($entry, -4) != ".mtz") { continue; } $mtzs[] = $entry; } if (count($mtzs) == 1) { $_SESSION['models'][$modelID]['mtz_file'] = $xrayDir . '/' . $mtzs[0]; // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/aacgeom.php", "generic_done.php", 5); } else { pageCall("link_model_2_mtz.php", array('modelID' => $modelID)); } } else { pageCall("link_model_2_mtz.php", array('modelID' => $modelID)); } } else { // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/aacgeom.php", "generic_done.php", 5); } } }
function onEditPDB() { $req = $_REQUEST; //if($req['cmd'] == 'Cancel') if ($req['cmd'] == 'Go back') { pageGoto("editpdb_setup1.php"); return; } // Otherwise, moving forward: $oldID = $req['modelID']; $oldModel = $_SESSION['models'][$oldID]; $inpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $oldModel['pdb']; $newModel = createModel($oldID . "_edit"); $newID = $newModel['id']; $outpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb']; $s = ""; if (is_array($req['removechain']) && count($req['removechain']) > 0) { removeChains($inpath, $outpath, $req['removechain']); $s .= "<p>You created {$newModel['pdb']} by removing chain(s) " . implode(', ', $req['removechain']) . " from {$oldModel['pdb']}.\n"; mpLog("editpdb:Removed chains from a PDB file"); } else { copy($inpath, $outpath); } $resolu = $req['resolution'] + 0; $oldRes = $oldModel['stats']['resolution'] + 0; if ($resolu && ($oldRes == 0 || $oldRes != $resolu)) { $remark2 = sprintf("REMARK 2 \nREMARK 2 RESOLUTION. %.2f ANGSTROMS. \n", $resolu); replacePdbRemark($outpath, $remark2, 2); $s .= "<p>You manually set the resolution for {$newModel['pdb']}.\n"; mpLog("editpdb:Changed/set resolution for a PDB file"); } if ($req['removeHs']) { $newModel = createModel($oldID . "_trimmed"); $newID = $newModel['id']; $outpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb']; reduceTrim($inpath, $outpath); $s .= "<p>You created {$newModel['pdb']} by removing hydrogens from {$oldModel['pdb']}.\n"; mpLog("editpdb:Removed hydrogens from a PDB file"); } $newModel['stats'] = pdbstat($outpath); $newModel['history'] = "Edited {$oldModel['pdb']}"; $newModel['isUserSupplied'] = $oldModel['isUserSupplied']; $_SESSION['models'][$newID] = $newModel; $_SESSION['lastUsedModelID'] = $newID; // this is now the current model $details = describePdbStats($newModel['stats'], true); $s .= "<ul>\n"; foreach ($details as $detail) { $s .= "<li>{$detail}</li>\n"; } $s .= "</ul>\n"; $entrynum = addLabbookEntry("Created PDB file {$newModel['pdb']}", $s, "{$oldID}|{$newID}", "auto", "scissors.png"); pageGoto("generic_done.php", array('labbookEntry' => $entrynum)); }
/** * Documentation for this function. */ function onAddH() { $req = $_REQUEST; if ($req['cmd'] == 'Cancel') { pageReturn(); return; } // Otherwise, moving forward: if (isset($req['ensID']) && isset($req['method']) && isset($req['blength'])) { unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob']['ensID'] = $req['ensID']; $_SESSION['bgjob']['method'] = $req['method']; $_SESSION['bgjob']['reduce_blength'] = $req['blength']; mpLog("reduce-ensemble:User ran default Reduce -{$req['method']} job on an ensemble"); // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/ens_reduce.php", "generic_done.php", 5); } else { $context = getContext(); if (isset($req['ensID'])) { $context['ensID'] = $req['ensID']; } if (isset($req['method'])) { $context['method'] = $req['method']; } if (isset($req['blength'])) { $context['blength'] = $req['blength']; } setContext($context); } }