Spaces:
Running
Running
fix: sort result files to select correct file
Browse files
app.py
CHANGED
|
@@ -77,15 +77,17 @@ def load_result() -> Optional[AlphaFoldData]:
|
|
| 77 |
f_idx = result_index.value
|
| 78 |
with ZipFile(file_info.value["file_obj"]) as zf:
|
| 79 |
files = zf.namelist()
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
| 82 |
|
| 83 |
with zf.open(json_data_file) as json_f:
|
| 84 |
json_load = json.load(json_f)
|
| 85 |
|
| 86 |
cif_str = zf.read(structure_file).decode("utf-8")
|
| 87 |
|
| 88 |
-
alphafold_name = structure_file.rstrip(
|
| 89 |
|
| 90 |
sio = StringIO(cif_str)
|
| 91 |
sio.seek(0)
|
|
|
|
| 77 |
f_idx = result_index.value
|
| 78 |
with ZipFile(file_info.value["file_obj"]) as zf:
|
| 79 |
files = zf.namelist()
|
| 80 |
+
names = sorted(f for f in files if f.endswith(".cif"))
|
| 81 |
+
|
| 82 |
+
structure_file = sorted(f for f in files if f.endswith(".cif"))[f_idx]
|
| 83 |
+
json_data_file = sorted(f for f in files if "full_data" in f)[f_idx]
|
| 84 |
|
| 85 |
with zf.open(json_data_file) as json_f:
|
| 86 |
json_load = json.load(json_f)
|
| 87 |
|
| 88 |
cif_str = zf.read(structure_file).decode("utf-8")
|
| 89 |
|
| 90 |
+
alphafold_name = structure_file.rstrip(".cif")
|
| 91 |
|
| 92 |
sio = StringIO(cif_str)
|
| 93 |
sio.seek(0)
|