RajarshiMondal commited on
Commit
2afc9e1
1 Parent(s): 83361d4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -21
main.py CHANGED
@@ -15,7 +15,6 @@ from transformMD import GNNTransformMD
15
  import sys
16
  import pytraj as pt
17
  import pickle
18
- import nglview as nv
19
 
20
  # JavaScript functions
21
  resid_hover = """function(atom,viewer) {{
@@ -189,16 +188,11 @@ def predict(pdb_code, pdb_file, topN):
189
 
190
  pdb = open(pdb_file.name, "r").read()
191
 
192
- view = nv.NGLWidget()
193
- view._remote_call("setSize", target="Widget", args=["800px", "600px"])
194
- view.add_pdbstr(pdb, defaultRepresentation=True)
195
- view.add_representation("hyperball", selection="all", color_scheme="residueindex")
196
-
197
 
198
- # view = py3Dmol.view(width=600, height=400)
199
- # view.setBackgroundColor('white')
200
- # view.addModel(pdb, "pdb")
201
- # view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
202
 
203
  # Commenting since the visualizer is not rendered
204
  # view.addLight([0, 0, 10], [1, 1, 1], 1) # Add directional light from the z-axis
@@ -219,21 +213,18 @@ def predict(pdb_code, pdb_file, topN):
219
  'alpha': 0.75
220
  })
221
 
222
- output = view.render_notebook()
223
-
224
- #view.zoomTo()
225
 
226
- #output = view._make_html().replace("'", '"')
227
 
228
  x = f"""<!DOCTYPE html><html> {output} </html>""" # do not use ' in this input
229
-
230
- return output, pd.DataFrame(data, columns=['index','element','x','y','z','Adaptability'])
231
 
232
- #return f"""<iframe style="width: 100%; height:420px" name="result" allow="midi; geolocation; microphone; camera;
233
- #display-capture; encrypted-media;" sandbox="allow-modals allow-forms
234
- #allow-scripts allow-same-origin allow-popups
235
- #allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
236
- #allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>""", pd.DataFrame(data, columns=['index','element','x','y','z','Adaptability'])
237
 
238
 
239
  callback = gr.CSVLogger()
 
15
  import sys
16
  import pytraj as pt
17
  import pickle
 
18
 
19
  # JavaScript functions
20
  resid_hover = """function(atom,viewer) {{
 
188
 
189
  pdb = open(pdb_file.name, "r").read()
190
 
 
 
 
 
 
191
 
192
+ view = py3Dmol.view(width=600, height=400)
193
+ view.setBackgroundColor('white')
194
+ view.addModel(pdb, "pdb")
195
+ view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
196
 
197
  # Commenting since the visualizer is not rendered
198
  # view.addLight([0, 0, 10], [1, 1, 1], 1) # Add directional light from the z-axis
 
213
  'alpha': 0.75
214
  })
215
 
216
+
217
+ view.zoomTo()
 
218
 
219
+ output = view._make_html().replace("'", '"')
220
 
221
  x = f"""<!DOCTYPE html><html> {output} </html>""" # do not use ' in this input
 
 
222
 
223
+ return f"""<iframe style="width: 100%; height:420px" name="result" allow="midi; geolocation; microphone; camera;
224
+ display-capture; encrypted-media;" sandbox="allow-modals allow-forms
225
+ allow-scripts allow-same-origin allow-popups
226
+ allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
227
+ allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>""", pd.DataFrame(data, columns=['index','element','x','y','z','Adaptability'])
228
 
229
 
230
  callback = gr.CSVLogger()