update
Browse files- .gitignore +1 -1
- app.py +12 -12
.gitignore
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
static/dna.html
|
| 2 |
static/dna.pdb
|
| 3 |
static/test.cif
|
| 4 |
-
static/tmp
|
| 5 |
test.py
|
| 6 |
*.ipynb
|
| 7 |
__pycache__
|
|
|
|
| 1 |
static/dna.html
|
| 2 |
static/dna.pdb
|
| 3 |
static/test.cif
|
| 4 |
+
static/tmp/*
|
| 5 |
test.py
|
| 6 |
*.ipynb
|
| 7 |
__pycache__
|
app.py
CHANGED
|
@@ -133,18 +133,18 @@ def handle_file_upload(file):
|
|
| 133 |
return gr.update(), gr.update(), gr.update()
|
| 134 |
|
| 135 |
def handle_pdb_id_input(pdb_id):
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
|
| 149 |
def render_cache(structure_cache):
|
| 150 |
summary = structure_cache["summary"]
|
|
|
|
| 133 |
return gr.update(), gr.update(), gr.update()
|
| 134 |
|
| 135 |
def handle_pdb_id_input(pdb_id):
|
| 136 |
+
try:
|
| 137 |
+
pdb_id = pdb_id.strip().upper()
|
| 138 |
+
pdbl = PDBList()
|
| 139 |
+
pdbl.retrieve_pdb_file(pdb_id, pdir=TEMP_DIR, file_format='pdb')
|
| 140 |
+
pdb_file_path = os.path.join(TEMP_DIR, f"pdb{pdb_id}.ent")
|
| 141 |
+
html_out, dd, structure_dict = load_structure(pdb_file_path)
|
| 142 |
+
# 删除文件
|
| 143 |
+
os.remove(pdb_file_path)
|
| 144 |
+
return html_out, dd, structure_dict
|
| 145 |
+
except Exception as e:
|
| 146 |
+
error_message = f"<b style='color:red'>获取PDB ID {pdb_id} 失败 {e}</b>"
|
| 147 |
+
return error_message, gr.update(), gr.update()
|
| 148 |
|
| 149 |
def render_cache(structure_cache):
|
| 150 |
summary = structure_cache["summary"]
|