<table border='0' width='100%'><tr> <td align='left'><small> When finished, you should <input type="button" value="close this window" language="JavaScript" onclick="self.close();">. </small></td><td align='right'><small><i> Hint: Use File | Save As... to save a copy of this page. </i></small></td> </tr></table> </form> <hr> <?php $in = fopen($file, 'rb'); clearstatcache(); $data = fread($in, filesize($file)); $table = mpUnserialize($data); fclose($in); // Sort table rows according to user request if (isset($_REQUEST['sort_dir'])) { $direction = $_REQUEST['sort_dir'] + 0; } else { $direction = 1; } // ascending if (isset($_REQUEST['sort_col'])) { $col = $_REQUEST['sort_col'] + 0; } else { $col = -1; } // don't sort (native order) echo formatSortableTable($table, "viewtable.php?{$_SESSION['sessTag']}&file={$file}", $col, $direction);
/** * $resout is the residue table file created by writeMulticritChart * $rscc_file is the formatted rscc file * $multi_table is the multi crit chart (to get the prequel) * $outfile is the name out file that this function will write to * $raw_rscc_out is the raw rscc file */ function writeHorizontalChart($resout, $rscc_file, $multi_table, $outfile, $rscc_prequel_out) { $startTime = time(); // get prequel $in = fopen($multi_table, 'rb'); clearstatcache(); $data = fread($in, filesize($multi_table)); fclose($in); $multi = mpUnserialize($data); $prequel = $multi['prequel']; $in = fopen($resout, 'rb'); clearstatcache(); $data = fread($in, filesize($resout)); fclose($in); $res_table = mpUnserialize($data); $rscc_table = csv_to_array($rscc_file, ','); // {{{ integrate rscc into $res_table annd set $horiz_table foreach ($rscc_table as $info) { if (!array_key_exists($info['res_id'], $res_table)) { continue; } $res_table[$info['res_id']]['worst_b_bb'] = $info['worst_b_bb']; $res_table[$info['res_id']]['worst_cc_bb'] = $info['worst_cc_bb']; $res_table[$info['res_id']]['worst_2fo-fc_bb'] = $info['worst_2fo-fc_bb']; $res_table[$info['res_id']]['worst_b_sc'] = $info['worst_b_sc']; $res_table[$info['res_id']]['worst_cc_sc'] = $info['worst_cc_sc']; $res_table[$info['res_id']]['worst_2fo-fc_sc'] = $info['worst_2fo-fc_sc']; } // params = bb Density, sc Density, Clash, Ramachandran, Rotamer, // cB deviation, Bond length, Bond angle'); $mp_params = array('bb Density', 'sc Density', 'Clash', 'Ramachandran', 'Rotamer', 'cB deviation', 'Bond length', 'Bond angle'); $horiz_table = array(); // create array for horizontal table foreach ($mp_params as $param) { $horiz_table[$param] = array(); foreach ($res_table as $resid => $info) { if (substr($resid, -3) != "HOH") { $horiz_table[$param][$resid] = array(); } } } // }}} // {{{ set parameters // {{{ set bb Density foreach ($horiz_table['bb Density'] as $resid => $info) { $horiz_table['bb Density'][$resid]['value'] = array(); $horiz_table['bb Density'][$resid]['value']['2fo-fc'] = $res_table[$resid]['worst_2fo-fc_bb']; $horiz_table['bb Density'][$resid]['value']['cc'] = $res_table[$resid]['worst_cc_bb']; $s = "<center>Backbone Density<br />cc : "; $s .= $horiz_table['bb Density'][$resid]['value']['cc'] . "<br />2Fo-Fc : "; $s .= $horiz_table['bb Density'][$resid]['value']['2fo-fc'] . "</center>"; $horiz_table['bb Density'][$resid]['html'] = $s; $img = "no_out.png"; if ($horiz_table['bb Density'][$resid]['value']['2fo-fc'] < 1.1 || $horiz_table['bb Density'][$resid]['value']['cc'] < 0.75) { $img = "density_outA.png"; } if ($horiz_table['bb Density'][$resid]['value']['2fo-fc'] < 0.8 || $horiz_table['bb Density'][$resid]['value']['cc'] < 0.6) { $img = "density_outB.png"; } $horiz_table['bb Density'][$resid]['image'] = $img; } // }}} // {{{ set sc Density foreach ($horiz_table['sc Density'] as $resid => $info) { $horiz_table['sc Density'][$resid]['value'] = array(); $horiz_table['sc Density'][$resid]['value']['2fo-fc'] = $res_table[$resid]['worst_2fo-fc_sc']; $horiz_table['sc Density'][$resid]['value']['cc'] = $res_table[$resid]['worst_cc_sc']; $s = "<center>Backbone Density<br />cc : "; $s .= $horiz_table['sc Density'][$resid]['value']['cc'] . "<br />2Fo-Fc : "; $s .= $horiz_table['sc Density'][$resid]['value']['2fo-fc'] . "</center>"; $horiz_table['sc Density'][$resid]['html'] = $s; $img = "no_out.png"; if ($horiz_table['sc Density'][$resid]['value']['2fo-fc'] < 1.1 || $horiz_table['sc Density'][$resid]['value']['cc'] < 0.75) { $img = "density_outA.png"; } if ($horiz_table['sc Density'][$resid]['value']['2fo-fc'] < 0.8 || $horiz_table['sc Density'][$resid]['value']['cc'] < 0.6) { $img = "density_outB.png"; } if (endsWith($resid, "GLY") || endsWith($resid, "gly")) { $horiz_table['sc Density'][$resid]['value']['2fo-fc'] = '-'; $horiz_table['sc Density'][$resid]['value']['cc'] = '-'; $img = "null.png"; } $horiz_table['sc Density'][$resid]['image'] = $img; } // }}} // {{{ set Clash foreach ($horiz_table['Clash'] as $resid => $info) { if ($res_table[$resid]['clash_isbad']) { $horiz_table['Clash'][$resid]['value'] = $res_table[$resid]['clash_val']; // $info['value'] = $res_table[$resid]['clash_val']; $horiz_table['Clash'][$resid]['html'] = $res_table[$resid]['clash']; if ($horiz_table['Clash'][$resid]['value'] < 0.7) { $img = "clash_outA.png"; } elseif ($horiz_table['Clash'][$resid]['value'] < 1.0) { $img = "clash_outC.png"; } else { $img = "clash_outD.png"; } $horiz_table['Clash'][$resid]['image'] = $img; } else { $horiz_table['Clash'][$resid]['value'] = 0; $horiz_table['Clash'][$resid]['html'] = "<center>-</center>"; $horiz_table['Clash'][$resid]['image'] = "no_out.png"; } } // }}} // {{{ set Ramachandran foreach ($horiz_table['Ramachandran'] as $resid => $info) { $horiz_table['Ramachandran'][$resid]['value'] = $res_table[$resid]['rama_val']; $horiz_table['Ramachandran'][$resid]['html'] = $res_table[$resid]['rama']; if ($res_table[$resid]['rama_isbad']) { $img = "rama_out.png"; } else { $img = "no_out.png"; } $horiz_table['Ramachandran'][$resid]['image'] = $img; } // }}} // {{{ set Rotamer foreach ($horiz_table['Rotamer'] as $resid => $info) { $horiz_table['Rotamer'][$resid]['value'] = $res_table[$resid]['rota_val']; $horiz_table['Rotamer'][$resid]['html'] = $res_table[$resid]['rota']; if ($res_table[$resid]['rota_isbad']) { $img = "rotamer_out.png"; } else { $img = "no_out.png"; } if (endsWith($resid, "GLY") || endsWith($resid, "gly")) { $img = "null.png"; } $horiz_table['Rotamer'][$resid]['image'] = $img; } // }}} // {{{ set cB deviation foreach ($horiz_table['cB deviation'] as $resid => $info) { if ($res_table[$resid]['cbdev_isbad']) { $horiz_table['cB deviation'][$resid]['value'] = $res_table[$resid]['cbdev_val']; $horiz_table['cB deviation'][$resid]['html'] = $res_table[$resid]['cbdev']; $horiz_table['cB deviation'][$resid]['image'] = "cBd_out.png"; } else { $horiz_table['cB deviation'][$resid]['value'] = 0; $horiz_table['cB deviation'][$resid]['html'] = "<center>-</center>"; $horiz_table['cB deviation'][$resid]['image'] = "no_out.png"; } } // }}} // {{{ set Bond length foreach ($horiz_table['Bond length'] as $resid => $info) { if ($res_table[$resid]['bbonds_isbad']) { $horiz_table['Bond length'][$resid]['value'] = $res_table[$resid]['bbonds_isbad']; $horiz_table['Bond length'][$resid]['html'] = $res_table[$resid]['bbonds']; $horiz_table['Bond length'][$resid]['image'] = "bl_out.png"; } else { $horiz_table['Bond length'][$resid]['value'] = 0; $horiz_table['Bond length'][$resid]['html'] = "<center>-</center>"; $horiz_table['Bond length'][$resid]['image'] = "no_out.png"; } } // }}} // {{{ set Bond angle foreach ($horiz_table['Bond angle'] as $resid => $info) { if ($res_table[$resid]['bangles_isbad']) { $horiz_table['Bond angle'][$resid]['value'] = $res_table[$resid]['bangles_isbad']; $horiz_table['Bond angle'][$resid]['html'] = $res_table[$resid]['bangles']; $horiz_table['Bond angle'][$resid]['image'] = "ba_out.png"; } else { $horiz_table['Bond angle'][$resid]['value'] = 0; $horiz_table['Bond angle'][$resid]['html'] = "<center>-</center>"; $horiz_table['Bond angle'][$resid]['image'] = "no_out.png"; } } // }}} // }}} $table1 = array(); $table1['prequel'] = $prequel; $table1['rscc_prequel'] = getRsccPrequel($horiz_table, $rscc_prequel_out); $table1['horiz_table'] = $horiz_table; $out = fopen($outfile, 'wb'); fwrite($out, mpSerialize($table1)); fclose($out); echo "Formatting horizontal chart table took " . (time() - $startTime) . " seconds\n"; }