Spaces:
Paused
Paused
igashov commited on
Commit ·
a05c989
1
Parent(s): 05e91b8
vis
Browse files84 unmodified lines8586878889909156 unmodified lines14814915015115215315415584 unmodified linesexcept Exception as e:return f'Could not read the molecule: {e}'html = output.HTML_TEMPLATE.format(molecule=molecule, fmt=extension)return output.IFRAME_TEMPLATE.format(html=html)56 unmodified linesprint('Converted to SDF')breakgenerated_molecule = read_molecule_content(out_sdf)html = output.HTML_TEMPLATE.format(molecule=generated_molecule, fmt='sdf')return [output.IFRAME_TEMPLATE.format(html=html),[inp_sdf, inp_xyz, out_sdf, out_xyz],84 unmodified lines8586878889909156 unmodified lines14814915015115215315415515615715815916016184 unmodified linesexcept Exception as e:return f'Could not read the molecule: {e}'html = output.INITIAL_RENDERING_TEMPLATE.format(molecule=molecule, fmt=extension)return output.IFRAME_TEMPLATE.format(html=html)56 unmodified linesprint('Converted to SDF')breakinput_fragments_content = read_molecule_content(inp_sdf)generated_molecule_content = read_molecule_content(out_sdf)html = output.SAMPLES_RENDERING_TEMPLATE.format(fragments=input_fragments_content,fragments_fmt='sdf',molecule=generated_molecule_content,molecule_fmt='sdf',)return [output.IFRAME_TEMPLATE.format(html=html),[inp_sdf, inp_xyz, out_sdf, out_xyz],
123428 unmodified lines33343536373819 unmodified lines58596061626364HTML_TEMPLATE = """<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />28 unmodified lines"""INVALID_FORMAT_MSG = """<!DOCTYPE html><html>19 unmodified lines</html>"""HTML_TEMPLATE = """<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />123428 unmodified lines3334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868719 unmodified lines107108109110111112113INITIAL_RENDERING_TEMPLATE = """<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />28 unmodified lines"""SAMPLES_RENDERING_TEMPLATE = """<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><style>.mol-container {{width: 600px;height: 600px;position: relative;}}.mol-container select{{background-image:None;}}</style><script src="https://3Dmol.csb.pitt.edu/build/3Dmol-min.js"></script></head><body><button id="fragments">Input Fragments</button><button id="molecule">Output Molecule</button><div id="container" class="mol-container"></div><script>$(document).ready(function() {{let element = $("#container");let config = {{ backgroundColor: "white" }};let viewer = $3Dmol.createViewer( element, config );viewer.addModel(`{fragments}`, "{fragments_fmt}")viewer.getModel().setStyle({{ stick: {{ colorscheme:"greenCarbon" }} }})viewer.addModel(`{molecule}`, "{molecule_fmt}")viewer.getModel().setStyle({{ stick: {{ colorscheme:"greenCarbon" }} }})viewer.zoomTo();viewer.render();}});$("#fragments").click(function() {{viewer.getModel(0).show();viewer.getModel(1).hide();viewer.render();}});$("#molecule").click(function() {{viewer.getModel(1).show();viewer.getModel(0).hide();viewer.render();}});</script></body></html>"""INVALID_FORMAT_MSG = """<!DOCTYPE html><html>19 unmodified lines</html>"""INITIAL_RENDERING_TEMPLATE = """<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />
app.py+9-3
output.py+51-2