RajarshiMondal
commited on
Commit
•
32941b1
1
Parent(s):
7bafb03
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
|
|
|
2 |
import gradio as gr
|
3 |
import py3Dmol
|
4 |
from Bio.PDB import *
|
@@ -180,18 +181,11 @@ def predict(pdb_code, pdb_file):
|
|
180 |
data = []
|
181 |
|
182 |
|
183 |
-
for i in range(
|
184 |
-
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
view.setStyle({'sphere': {}})
|
189 |
-
view.addLight([0, 0, 10], [1, 1, 1], 1) # Add directional light from the z-axis
|
190 |
-
view.setSpecular(0.5) # Adjust the specular lighting effect
|
191 |
-
view.setAmbient(0.5) # Adjust the ambient lighting effect
|
192 |
-
|
193 |
-
#topN = 100
|
194 |
-
#topN_ind = np.argsort(adaptability)[::-1][:topN]
|
195 |
|
196 |
pdb = open(pdb_file.name, "r").read()
|
197 |
|
@@ -200,9 +194,26 @@ def predict(pdb_code, pdb_file):
|
|
200 |
view.addModel(pdb, "pdb")
|
201 |
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
|
202 |
|
203 |
-
for i in range(
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
view.zoomTo()
|
207 |
|
208 |
output = view._make_html().replace("'", '"')
|
|
|
1 |
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import py3Dmol
|
5 |
from Bio.PDB import *
|
|
|
181 |
data = []
|
182 |
|
183 |
|
184 |
+
for i in range(adaptability.shape[0]):
|
185 |
+
data.append([i, atom_mapping[atoms_protein.iloc[i, atoms_protein.columns.get_loc("element")] - 1], atoms_protein.iloc[i, atoms_protein.columns.get_loc("x")],atoms_protein.iloc[i, atoms_protein.columns.get_loc("y")],atoms_protein.iloc[i, atoms_protein.columns.get_loc("z")],adaptability[i]])
|
186 |
|
187 |
+
topN = 100
|
188 |
+
topN_ind = np.argsort(adaptability)[::-1][:topN]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
pdb = open(pdb_file.name, "r").read()
|
191 |
|
|
|
194 |
view.addModel(pdb, "pdb")
|
195 |
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
|
196 |
|
197 |
+
for i in range(10):
|
198 |
+
adaptability_value = adaptability[topN_ind[i]]
|
199 |
+
color = adaptability_color_map(adaptability_value) # Define your own color mapping function
|
200 |
+
view.addSphere({
|
201 |
+
'center': {
|
202 |
+
'x': atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("x")],
|
203 |
+
'y': atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("y")],
|
204 |
+
'z': atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("z")]
|
205 |
+
},
|
206 |
+
'radius': adaptability_value / 1.5,
|
207 |
+
'color': color,
|
208 |
+
'alpha': 0.75
|
209 |
+
})
|
210 |
+
# Add lighting and shading options to the view object:
|
211 |
+
view.setStyle({'stick': {'colorscheme': {'prop': 'resi', 'C': 'turquoise'}}})
|
212 |
+
view.setStyle({'sphere': {}})
|
213 |
+
view.addLight([0, 0, 10], [1, 1, 1], 1) # Add directional light from the z-axis
|
214 |
+
view.setSpecular(0.5) # Adjust the specular lighting effect
|
215 |
+
view.setAmbient(0.5) # Adjust the ambient lighting effect
|
216 |
+
|
217 |
view.zoomTo()
|
218 |
|
219 |
output = view._make_html().replace("'", '"')
|