jiehou commited on
Commit
f7a5ef1
·
verified ·
1 Parent(s): 7a082af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +121 -38
app.py CHANGED
@@ -34,68 +34,128 @@ st.set_page_config(
34
 
35
 
36
 
37
- # Custom CSS
38
  st.markdown("""
39
  <style>
40
- /* Global base font size increase */
41
- html {
42
- font-size: 16px !important;
 
 
 
 
 
 
 
 
 
43
  }
44
- body {
45
- font-size: 1.05rem !important;
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
 
48
  .main-header {
49
- font-size: 2.5rem;
50
  font-weight: bold;
51
  color: #1f77b4;
52
  margin-bottom: 1rem;
53
  }
54
  .sub-header {
55
- font-size: 1.2rem;
56
  color: #666;
57
  margin-bottom: 2rem;
58
  }
59
- .metric-box {
60
- background-color: #f0f2f6;
61
- padding: 1rem;
62
- border-radius: 0.5rem;
63
- margin: 0.5rem 0;
64
  }
65
 
66
- /* GLOBAL font size increase for main content */
67
- .main * {
 
 
68
  font-size: 1.05rem !important;
69
  }
 
 
 
 
 
70
 
71
- /* Restore proper header sizes */
72
- .main h1 {
73
- font-size: 2.5rem !important;
74
  }
75
- .main h2 {
76
- font-size: 1.75rem !important;
77
  }
78
- .main h3 {
79
- font-size: 1.5rem !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
- /* Button text should stay normal */
83
- .main button {
84
- font-size: 1rem !important;
85
  }
86
 
87
- /* Ultra-compact sidebar - MAXIMUM density */
 
 
 
 
 
 
 
 
 
 
88
  section[data-testid="stSidebar"] {
89
  padding-top: 0.2rem !important;
90
  }
91
  section[data-testid="stSidebar"] > div {
92
  padding-top: 0.2rem !important;
93
  }
94
- /* Zero margin on markdown */
 
95
  section[data-testid="stSidebar"] [data-testid="stMarkdownContainer"] {
96
  margin: 0rem !important;
97
  }
98
- /* Minimal subheader spacing - THE KEY FIX */
 
99
  section[data-testid="stSidebar"] h1,
100
  section[data-testid="stSidebar"] h2,
101
  section[data-testid="stSidebar"] h3 {
@@ -103,7 +163,9 @@ st.markdown("""
103
  margin-bottom: 0.2rem !important;
104
  padding: 0rem !important;
105
  line-height: 1.2 !important;
 
106
  }
 
107
  /* Tight widget spacing */
108
  section[data-testid="stSidebar"] .stSelectbox,
109
  section[data-testid="stSidebar"] .stNumberInput,
@@ -112,36 +174,46 @@ st.markdown("""
112
  margin-top: 0.1rem !important;
113
  margin-bottom: 0.2rem !important;
114
  }
 
115
  section[data-testid="stSidebar"] .stButton {
116
  margin: 0.2rem 0 !important;
117
  }
118
- /* Minimal element container spacing */
119
  section[data-testid="stSidebar"] .element-container {
120
  margin: 0.1rem 0 !important;
121
  }
122
- /* Compact alert boxes */
123
  section[data-testid="stSidebar"] .stAlert {
124
  padding: 0.3rem 0.5rem !important;
125
  margin: 0.1rem 0 !important;
126
  }
127
- /* Remove extra label spacing */
128
  section[data-testid="stSidebar"] label {
129
  margin-bottom: 0.1rem !important;
 
130
  }
131
- /* Compact captions */
132
  section[data-testid="stSidebar"] .stCaptionContainer {
133
  margin: 0.1rem 0 !important;
134
  }
135
- /* Remove hr spacing completely */
136
  section[data-testid="stSidebar"] hr {
137
  margin: 0.2rem 0 !important;
138
  }
139
- /* Keep sidebar font size normal */
 
140
  section[data-testid="stSidebar"] * {
141
- font-size: 0.875rem !important;
142
  }
143
- section[data-testid="stSidebar"] h3 {
144
- font-size: 1rem !important;
 
 
 
 
 
 
 
145
  }
146
  </style>
147
  """, unsafe_allow_html=True)
@@ -563,9 +635,20 @@ def main():
563
 
564
  # Full results
565
  with st.expander("📋 All Comparison Results"):
566
- display_df = filtered_df[['Reference', 'Ref_Sequence', 'Query', 'Query_Sequence', 'RMSD']].copy()
 
 
 
 
 
 
 
567
  display_df['RMSD'] = display_df['RMSD'].round(3)
568
  display_df = display_df.sort_values('RMSD').reset_index(drop=True)
 
 
 
 
569
  st.dataframe(display_df, use_container_width=True, height=300)
570
 
571
  # Visualization
 
34
 
35
 
36
 
37
+ # Custom CSS - IMPROVED VERSION with larger fonts
38
  st.markdown("""
39
  <style>
40
+ /* ========================================
41
+ MAIN CONTENT - LARGER FONTS
42
+ ======================================== */
43
+
44
+ /* Increase base font size for all main content */
45
+ .main .element-container,
46
+ .main [data-testid="stMarkdownContainer"],
47
+ .main [data-testid="stText"],
48
+ .main p,
49
+ .main span,
50
+ .main div {
51
+ font-size: 1.15rem !important;
52
  }
53
+
54
+ /* Headers in main content */
55
+ .main h1 {
56
+ font-size: 2.8rem !important;
57
+ font-weight: 700 !important;
58
+ }
59
+ .main h2 {
60
+ font-size: 2.0rem !important;
61
+ font-weight: 600 !important;
62
+ }
63
+ .main h3 {
64
+ font-size: 1.6rem !important;
65
+ font-weight: 600 !important;
66
  }
67
 
68
+ /* Custom header classes */
69
  .main-header {
70
+ font-size: 2.8rem !important;
71
  font-weight: bold;
72
  color: #1f77b4;
73
  margin-bottom: 1rem;
74
  }
75
  .sub-header {
76
+ font-size: 1.4rem !important;
77
  color: #666;
78
  margin-bottom: 2rem;
79
  }
80
+
81
+ /* Info/warning/success boxes */
82
+ .main [data-testid="stAlert"] p,
83
+ .main [data-testid="stAlert"] {
84
+ font-size: 1.1rem !important;
85
  }
86
 
87
+ /* Dataframes and tables */
88
+ .main [data-testid="stDataFrame"],
89
+ .main .dataframe,
90
+ .main table {
91
  font-size: 1.05rem !important;
92
  }
93
+ .main .dataframe th,
94
+ .main .dataframe td {
95
+ font-size: 1.05rem !important;
96
+ padding: 8px !important;
97
+ }
98
 
99
+ /* Metrics */
100
+ .main [data-testid="stMetric"] {
101
+ font-size: 1.15rem !important;
102
  }
103
+ .main [data-testid="stMetricLabel"] {
104
+ font-size: 1.1rem !important;
105
  }
106
+ .main [data-testid="stMetricValue"] {
107
+ font-size: 1.8rem !important;
108
+ }
109
+
110
+ /* Buttons in main content */
111
+ .main button p,
112
+ .main button span {
113
+ font-size: 1.05rem !important;
114
+ }
115
+
116
+ /* Selectbox, radio, and other inputs in main */
117
+ .main .stSelectbox label,
118
+ .main .stRadio label,
119
+ .main .stNumberInput label,
120
+ .main .stMultiSelect label {
121
+ font-size: 1.1rem !important;
122
+ }
123
+
124
+ .main .stSelectbox [data-baseweb="select"] div,
125
+ .main .stRadio [role="radiogroup"] label,
126
+ .main .stNumberInput input {
127
+ font-size: 1.05rem !important;
128
  }
129
 
130
+ /* Expander headers */
131
+ .main [data-testid="stExpander"] summary {
132
+ font-size: 1.15rem !important;
133
  }
134
 
135
+ /* Code blocks */
136
+ .main code,
137
+ .main pre {
138
+ font-size: 1.0rem !important;
139
+ }
140
+
141
+ /* ========================================
142
+ SIDEBAR - COMPACT & NORMAL FONT
143
+ ======================================== */
144
+
145
+ /* Ultra-compact sidebar spacing */
146
  section[data-testid="stSidebar"] {
147
  padding-top: 0.2rem !important;
148
  }
149
  section[data-testid="stSidebar"] > div {
150
  padding-top: 0.2rem !important;
151
  }
152
+
153
+ /* Minimal margins */
154
  section[data-testid="stSidebar"] [data-testid="stMarkdownContainer"] {
155
  margin: 0rem !important;
156
  }
157
+
158
+ /* Minimal header spacing */
159
  section[data-testid="stSidebar"] h1,
160
  section[data-testid="stSidebar"] h2,
161
  section[data-testid="stSidebar"] h3 {
 
163
  margin-bottom: 0.2rem !important;
164
  padding: 0rem !important;
165
  line-height: 1.2 !important;
166
+ font-size: 1.0rem !important;
167
  }
168
+
169
  /* Tight widget spacing */
170
  section[data-testid="stSidebar"] .stSelectbox,
171
  section[data-testid="stSidebar"] .stNumberInput,
 
174
  margin-top: 0.1rem !important;
175
  margin-bottom: 0.2rem !important;
176
  }
177
+
178
  section[data-testid="stSidebar"] .stButton {
179
  margin: 0.2rem 0 !important;
180
  }
181
+
182
  section[data-testid="stSidebar"] .element-container {
183
  margin: 0.1rem 0 !important;
184
  }
185
+
186
  section[data-testid="stSidebar"] .stAlert {
187
  padding: 0.3rem 0.5rem !important;
188
  margin: 0.1rem 0 !important;
189
  }
190
+
191
  section[data-testid="stSidebar"] label {
192
  margin-bottom: 0.1rem !important;
193
+ font-size: 0.9rem !important;
194
  }
195
+
196
  section[data-testid="stSidebar"] .stCaptionContainer {
197
  margin: 0.1rem 0 !important;
198
  }
199
+
200
  section[data-testid="stSidebar"] hr {
201
  margin: 0.2rem 0 !important;
202
  }
203
+
204
+ /* Sidebar font sizes - keep normal/small */
205
  section[data-testid="stSidebar"] * {
206
+ font-size: 0.9rem !important;
207
  }
208
+
209
+ section[data-testid="stSidebar"] p,
210
+ section[data-testid="stSidebar"] span,
211
+ section[data-testid="stSidebar"] div {
212
+ font-size: 0.9rem !important;
213
+ }
214
+
215
+ section[data-testid="stSidebar"] button {
216
+ font-size: 0.9rem !important;
217
  }
218
  </style>
219
  """, unsafe_allow_html=True)
 
635
 
636
  # Full results
637
  with st.expander("📋 All Comparison Results"):
638
+ display_df = filtered_df[['Reference', 'Ref_Window', 'Ref_Sequence', 'Query', 'Query_Window', 'Query_Sequence', 'RMSD']].copy()
639
+
640
+ # Format the window indices to be 1-based (more intuitive for users)
641
+ display_df['Ref_Residues'] = display_df['Ref_Window'].apply(lambda x: ','.join([str(i+1) for i in x]))
642
+ display_df['Query_Residues'] = display_df['Query_Window'].apply(lambda x: ','.join([str(i+1) for i in x]))
643
+
644
+ # Reorder columns and drop the window lists
645
+ display_df = display_df[['Reference', 'Ref_Residues', 'Ref_Sequence', 'Query', 'Query_Residues', 'Query_Sequence', 'RMSD']]
646
  display_df['RMSD'] = display_df['RMSD'].round(3)
647
  display_df = display_df.sort_values('RMSD').reset_index(drop=True)
648
+
649
+ # Rename columns for better display
650
+ display_df.columns = ['Reference', 'Ref_Indices', 'Ref_Sequence', 'Query', 'Query_Indices', 'Query_Sequence', 'RMSD']
651
+
652
  st.dataframe(display_df, use_container_width=True, height=300)
653
 
654
  # Visualization