protein_binding_search / protein_viz.py
roni
adding some spin to the visualization
c3ff85a
raw
history blame
927 Bytes
def render_html(pdb_id, chain):
if pdb_id is None or chain is None:
return ""
html = f"""
"<html>
<header>
<script src="https://3Dmol.org/build/3Dmol-min.js"></script>
<script src="https://3Dmol.org/build/3Dmol.ui-min.js"></script>
</header>
<body>
<div style="height: 400px; position: relative;" class="viewer_3Dmoljs"
data-pdb="{pdb_id}"
data-backgroundalpha="0.0"
data-style="cartoon:color=white"
data-select1="chain:{chain}"
data-zoomto="chain:{chain}"
data-style1="cartoon:color=spectrum"
data-spin="axis:y;speed:0.2"
/>
</body>
</html>
"""
iframe = f"""
<iframe style="width: 100%; height: 480px" name="protein-vis"
frameborder="0" srcdoc='{html}'></iframe>
"""
return iframe