update
Browse files
app.py
CHANGED
|
@@ -136,11 +136,11 @@ def handle_pdb_id_input(pdb_id):
|
|
| 136 |
try:
|
| 137 |
pdb_id = pdb_id.strip().upper()
|
| 138 |
pdbl = PDBList()
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 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>"
|
|
|
|
| 136 |
try:
|
| 137 |
pdb_id = pdb_id.strip().upper()
|
| 138 |
pdbl = PDBList()
|
| 139 |
+
# 使用 TemporaryDirectory 创建临时文件夹
|
| 140 |
+
with TemporaryDirectory() as temp_dir:
|
| 141 |
+
pdbl.retrieve_pdb_file(pdb_id, pdir=temp_dir, file_format='pdb')
|
| 142 |
+
pdb_file_path = os.path.join(temp_dir, f"pdb{pdb_id}.ent")
|
| 143 |
+
html_out, dd, structure_dict = load_structure(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>"
|