mpLog("new-session:New session started by calling MolProbity directly with " . $pdbCode); mpLog("browser-detect:" . $_SERVER['HTTP_USER_AGENT']); mpLog("refered-by:" . $_SERVER['HTTP_REFERER']); if (strlen($pdbCode) > 10) { mpLog("bad-pdb:Invalid PDB code detected."); $pdbCode = ""; } $_SESSION['bgjob']['pdbCode'] = $pdbCode; $_SESSION['bgjob']['isCnsFormat'] = false; $_SESSION['bgjob']['ignoreSegID'] = false; $_SESSION['bgjob']['biolunit'] = false; $_SESSION['bgjob']['eds_2fofc'] = false; $_SESSION['bgjob']['eds_fofc'] = false; // launch background job pageCall("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/addmodel.php", "upload_pdb_done.php", 3); } else { mpLog("new-session:New interactive user session started on the web"); mpLog("browser-detect:" . $_SERVER['HTTP_USER_AGENT']); mpLog("refered-by:" . $_SERVER['HTTP_REFERER']); } } elseif (isset($_REQUEST['eventID'])) { $eid = $_REQUEST['eventID'] + 0; if (isset($page['handlers'][$eid])) { $funcName = $page['handlers'][$eid]['funcName']; $funcArgs = $page['handlers'][$eid]['funcArgs']; // We use a variable function name here to call the handler. //$delegate->$funcName($funcArg, $_REQUEST); // Now this is *real* voodoo: call_user_func_array(array(&$delegate, $funcName), $funcArgs); // In case we changed $_SESSION but display() calls mpSessReadOnly()
/** * 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 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); }
/** * 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); } }
/** * 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); } }
/** * 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); }
/** * 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); } } }
/** * 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']); } }
/** * Documentation for this function. */ function onFetchEdsMap() { $req = $_REQUEST; if ($req['cmd'] == "Cancel") { pageReturn(); return; } unset($_SESSION['bgjob']); // Clean up any old data $_SESSION['bgjob']['pdbCode'] = $req['pdbCode']; $_SESSION['bgjob']['eds_2fofc'] = $req['eds_2fofc']; $_SESSION['bgjob']['eds_fofc'] = $req['eds_fofc']; // logging is done is background job // launch background job pageGoto("job_progress.php"); launchBackground(MP_BASE_DIR . "/jobs/fetch-edsmap.php", "generic_done.php", 3); }
/** * 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 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); } }