Commit
·
105a853
1
Parent(s):
0107ce5
Upload main.py
Browse files
main.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import py3Dmol
|
| 3 |
from Bio.PDB import *
|
|
@@ -13,7 +14,6 @@ from transformMD import GNNTransformMD
|
|
| 13 |
import sys
|
| 14 |
import pytraj as pt
|
| 15 |
import pickle
|
| 16 |
-
import nglview as nv
|
| 17 |
|
| 18 |
# JavaScript functions
|
| 19 |
resid_hover = """function(atom,viewer) {{
|
|
@@ -143,17 +143,6 @@ def get_pdbid_from_filename(filename: str):
|
|
| 143 |
# Assuming the filename would be of the standard form 11GS.pdb
|
| 144 |
return filename.split(".")[0]
|
| 145 |
|
| 146 |
-
|
| 147 |
-
for i in range(10):
|
| 148 |
-
data.append([i, atom_mapping[atoms_protein.iloc[i, atoms_protein.columns.get_loc("element")] - 1], atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("x")],
|
| 149 |
-
atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("y")],
|
| 150 |
-
atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("z")],
|
| 151 |
-
adaptability[topN_ind[i]]
|
| 152 |
-
])
|
| 153 |
-
|
| 154 |
-
pdb = open(pdb_file.name, "r").read()
|
| 155 |
-
|
| 156 |
-
|
| 157 |
def predict(pdb_code, pdb_file):
|
| 158 |
#path_to_pdb = get_pdb(pdb_code=pdb_code, filepath=pdb_file)
|
| 159 |
|
|
@@ -190,18 +179,12 @@ def predict(pdb_code, pdb_file):
|
|
| 190 |
|
| 191 |
data = []
|
| 192 |
|
| 193 |
-
|
| 194 |
-
data.append([i, atom_mapping[atoms_protein.iloc[i, atoms_protein.columns.get_loc("element")] - 1], atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("x")],
|
| 195 |
-
atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("y")],
|
| 196 |
-
atoms_protein.iloc[topN_ind[i], atoms_protein.columns.get_loc("z")],
|
| 197 |
-
adaptability[topN_ind[i]]
|
| 198 |
-
])
|
| 199 |
-
|
| 200 |
for i in range(adaptability.shape[0]):
|
| 201 |
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]])
|
| 202 |
|
| 203 |
-
|
| 204 |
-
|
| 205 |
|
| 206 |
pdb = open(pdb_file.name, "r").read()
|
| 207 |
|
|
@@ -227,7 +210,6 @@ def predict(pdb_code, pdb_file):
|
|
| 227 |
|
| 228 |
callback = gr.CSVLogger()
|
| 229 |
|
| 230 |
-
|
| 231 |
def run():
|
| 232 |
with gr.Blocks() as demo:
|
| 233 |
gr.Markdown("# Protein Adaptability Prediction")
|
|
@@ -254,4 +236,4 @@ def run():
|
|
| 254 |
|
| 255 |
|
| 256 |
if __name__ == "__main__":
|
| 257 |
-
run()
|
|
|
|
| 1 |
+
|
| 2 |
import gradio as gr
|
| 3 |
import py3Dmol
|
| 4 |
from Bio.PDB import *
|
|
|
|
| 14 |
import sys
|
| 15 |
import pytraj as pt
|
| 16 |
import pickle
|
|
|
|
| 17 |
|
| 18 |
# JavaScript functions
|
| 19 |
resid_hover = """function(atom,viewer) {{
|
|
|
|
| 143 |
# Assuming the filename would be of the standard form 11GS.pdb
|
| 144 |
return filename.split(".")[0]
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
def predict(pdb_code, pdb_file):
|
| 147 |
#path_to_pdb = get_pdb(pdb_code=pdb_code, filepath=pdb_file)
|
| 148 |
|
|
|
|
| 179 |
|
| 180 |
data = []
|
| 181 |
|
| 182 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
for i in range(adaptability.shape[0]):
|
| 184 |
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]])
|
| 185 |
|
| 186 |
+
topN = 100
|
| 187 |
+
topN_ind = np.argsort(adaptability)[::-1][:topN]
|
| 188 |
|
| 189 |
pdb = open(pdb_file.name, "r").read()
|
| 190 |
|
|
|
|
| 210 |
|
| 211 |
callback = gr.CSVLogger()
|
| 212 |
|
|
|
|
| 213 |
def run():
|
| 214 |
with gr.Blocks() as demo:
|
| 215 |
gr.Markdown("# Protein Adaptability Prediction")
|
|
|
|
| 236 |
|
| 237 |
|
| 238 |
if __name__ == "__main__":
|
| 239 |
+
run()
|