$_SESSION['edmaps'][$mapName] = $mapName; mpLog("edmap-eds:User requested 2Fo-Fc map for {$code} from the EDS"); $s .= "<p>The 2Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n"; } else { $s .= "<p><div class='alert'>The 2Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n"; } } else { $s .= "<p><div class='alert'>The 2Fo-Fc map for {$code} could not be retrieved, because a file of the same name already exists.</div></p>\n"; } } if ($_SESSION['bgjob']['eds_fofc']) { setProgress($prog, 'fofc'); $mapName = "{$code}-diff.omap.gz"; $mapPath = "{$mapDir}/{$mapName}"; if (!file_exists($mapPame)) { $tmpMap = getEdsMap($code, 'omap', 'fofc'); if ($tmpMap && copy($tmpMap, $mapPath)) { unlink($tmpMap); $_SESSION['edmaps'][$mapName] = $mapName; mpLog("edmap-eds:User requested Fo-Fc map for {$code} from the EDS"); $s .= "<p>The Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n"; } else { $s .= "<p><div class='alert'>The Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n"; } } else { $s .= "<p><div class='alert'>The Fo-Fc map for {$code} could not be retrieved, because a file of the same name already exists.</div></p>\n"; } } } else { $title = "Failed to retrieve electron density from the EDS"; $s .= "Unable to retrieve maps from the EDS because '{$code}' is not a valid PDB ID.";
function getMaps($code) { global $map_notebook_msg; $map_notebook_msg = ""; $prog = getProgressTasks(); if ($_SESSION['bgjob']['eds_2fofc']) { $prog['2fofc'] = "Download 2Fo-Fc map from the EDS"; } if ($_SESSION['bgjob']['eds_fofc']) { $prog['fofc'] = "Download Fo-Fc (difference) map from the EDS"; } $mapDir = "{$_SESSION['dataDir']}/" . MP_DIR_EDMAPS; if (!file_exists($mapDir)) { mkdir($mapDir, 0777); } if ($_SESSION['bgjob']['eds_2fofc']) { setProgress($prog, '2fofc'); $mapName = "{$code}.omap.gz"; $mapPath = "{$mapDir}/{$mapName}"; if (!file_exists($mapPame)) { $tmpMap = getEdsMap($code, 'omap', '2fofc'); if ($tmpMap && copy($tmpMap, $mapPath)) { unlink($tmpMap); $_SESSION['edmaps'][$mapName] = $mapName; mpLog("edmap-eds:User requested 2Fo-Fc map for {$code} from the EDS"); $map_notebook_msg .= "<p>The 2Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n"; } else { $map_notebook_msg .= "<p><div class='alert'>The 2Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n"; } } else { echo "Map file already exists"; } } if ($_SESSION['bgjob']['eds_fofc']) { setProgress($prog, 'fofc'); $mapName = "{$code}-diff.omap.gz"; $mapPath = "{$mapDir}/{$mapName}"; if (!file_exists($mapPame)) { $tmpMap = getEdsMap($code, 'omap', 'fofc'); if ($tmpMap && copy($tmpMap, $mapPath)) { unlink($tmpMap); $_SESSION['edmaps'][$mapName] = $mapName; mpLog("edmap-eds:User requested Fo-Fc map for {$code} from the EDS"); $map_notebook_msg .= "<p>The Fo-Fc map for {$code} was successfully retrieved from the EDS.</p>\n"; } else { $map_notebook_msg .= "<p><div class='alert'>The Fo-Fc map for {$code} could not be retrieved from the EDS.</div></p>\n"; } } } setProgress($prog, null); }