stochasticribosome
commited on
Commit
·
d89cdc6
1
Parent(s):
4562c4b
Add topN
Browse files
main.py
CHANGED
@@ -144,7 +144,7 @@ def get_pdbid_from_filename(filename: str):
|
|
144 |
# Assuming the filename would be of the standard form 11GS.pdb
|
145 |
return filename.split(".")[0]
|
146 |
|
147 |
-
def predict(pdb_code, pdb_file):
|
148 |
#path_to_pdb = get_pdb(pdb_code=pdb_code, filepath=pdb_file)
|
149 |
|
150 |
#pdb = open(path_to_pdb, "r").read()
|
@@ -184,7 +184,6 @@ def predict(pdb_code, pdb_file):
|
|
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()
|
@@ -198,7 +197,7 @@ def predict(pdb_code, pdb_file):
|
|
198 |
# view.setSpecular(0.5) # Adjust the specular lighting effect
|
199 |
# view.setAmbient(0.5) # Adjust the ambient lighting effect
|
200 |
|
201 |
-
for i in range(
|
202 |
adaptability_value = adaptability[topN_ind[i]]
|
203 |
color = 'orange'
|
204 |
view.addSphere({
|
@@ -248,7 +247,7 @@ def run():
|
|
248 |
with gr.Row():
|
249 |
dataframe = gr.Dataframe()
|
250 |
|
251 |
-
single_btn.click(fn=predict, inputs=[inp, pdb_file], outputs=[html, dataframe])
|
252 |
|
253 |
|
254 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
144 |
# Assuming the filename would be of the standard form 11GS.pdb
|
145 |
return filename.split(".")[0]
|
146 |
|
147 |
+
def predict(pdb_code, pdb_file, topN):
|
148 |
#path_to_pdb = get_pdb(pdb_code=pdb_code, filepath=pdb_file)
|
149 |
|
150 |
#pdb = open(path_to_pdb, "r").read()
|
|
|
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_ind = np.argsort(adaptability)[::-1][:topN]
|
188 |
|
189 |
pdb = open(pdb_file.name, "r").read()
|
|
|
197 |
# view.setSpecular(0.5) # Adjust the specular lighting effect
|
198 |
# view.setAmbient(0.5) # Adjust the ambient lighting effect
|
199 |
|
200 |
+
for i in range(topN):
|
201 |
adaptability_value = adaptability[topN_ind[i]]
|
202 |
color = 'orange'
|
203 |
view.addSphere({
|
|
|
247 |
with gr.Row():
|
248 |
dataframe = gr.Dataframe()
|
249 |
|
250 |
+
single_btn.click(fn=predict, inputs=[inp, pdb_file, topN], outputs=[html, dataframe])
|
251 |
|
252 |
|
253 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|