Spaces:
Sleeping
Sleeping
Handle zero sequences
Browse files
app.py
CHANGED
@@ -55,15 +55,18 @@ for seq in sequences:
|
|
55 |
|
56 |
|
57 |
num_pdb_structures = len(pdb_strings)
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
# Get the width of the viewer from the sidebar
|
66 |
-
viewer_width = st.sidebar.number_input("Viewer Width", 100, 2000, 900)
|
67 |
|
68 |
# Calculate the width and height of each grid cell
|
69 |
grid_cell_width = int(viewer_width / grid_columns)
|
|
|
55 |
|
56 |
|
57 |
num_pdb_structures = len(pdb_strings)
|
58 |
+
if num_pdb_structures == 0:
|
59 |
+
grid_columns = 1
|
60 |
+
grid_rows = 1
|
61 |
+
else:
|
62 |
+
grid_columns = int(num_pdb_structures ** 0.5)
|
63 |
+
if grid_columns ** 2 < num_pdb_structures:
|
64 |
+
grid_columns += 1
|
65 |
+
grid_columns = min(grid_columns, 12)
|
66 |
+
grid_rows = (num_pdb_structures + grid_columns - 1) // grid_columns
|
67 |
|
68 |
# Get the width of the viewer from the sidebar
|
69 |
+
viewer_width = int(st.sidebar.number_input("Viewer Width", 100, 2000, 900))
|
70 |
|
71 |
# Calculate the width and height of each grid cell
|
72 |
grid_cell_width = int(viewer_width / grid_columns)
|