aksell commited on
Commit
6a8b1e7
1 Parent(s): 6ee82e3

Handle zero sequences

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -55,15 +55,18 @@ for seq in sequences:
55
 
56
 
57
  num_pdb_structures = len(pdb_strings)
58
- grid_columns = int(num_pdb_structures ** 0.5)
59
- if grid_columns ** 2 < num_pdb_structures:
60
- grid_columns += 1
61
- grid_columns = min(grid_columns, 12)
62
- grid_rows = (num_pdb_structures + grid_columns - 1) // grid_columns
63
- import streamlit as st
 
 
 
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)