Andrew Stirn commited on
Commit
6db3004
·
1 Parent(s): 6e3a126

streamlit titration support

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -35,6 +35,7 @@ def initiate_run():
35
  st.session_state.transcripts = None
36
  st.session_state.input_error = None
37
  st.session_state.on_target = None
 
38
  st.session_state.off_target = None
39
 
40
  # initialize transcript DataFrame
@@ -90,6 +91,8 @@ if __name__ == '__main__':
90
  st.session_state.input_error = None
91
  if 'on_target' not in st.session_state:
92
  st.session_state.on_target = None
 
 
93
  if 'off_target' not in st.session_state:
94
  st.session_state.off_target = None
95
 
@@ -159,6 +162,20 @@ if __name__ == '__main__':
159
  else:
160
  on_target_results.empty()
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  # off-target results
163
  off_target_results = st.empty()
164
  if st.session_state.off_target is not None:
@@ -178,7 +195,7 @@ if __name__ == '__main__':
178
 
179
  # keep trying to run model until we clear inputs (streamlit UI changes can induce race-condition reruns)
180
  if st.session_state.transcripts is not None:
181
- st.session_state.on_target, st.session_state.off_target = tiger.tiger_exhibit(
182
  transcripts=st.session_state.transcripts,
183
  mode={v: k for k, v in tiger.RUN_MODES.items()}[st.session_state.mode],
184
  check_off_targets=st.session_state.check_off_targets,
 
35
  st.session_state.transcripts = None
36
  st.session_state.input_error = None
37
  st.session_state.on_target = None
38
+ st.session_state.titration = None
39
  st.session_state.off_target = None
40
 
41
  # initialize transcript DataFrame
 
91
  st.session_state.input_error = None
92
  if 'on_target' not in st.session_state:
93
  st.session_state.on_target = None
94
+ if 'titration' not in st.session_state:
95
+ st.session_state.titration = None
96
  if 'off_target' not in st.session_state:
97
  st.session_state.off_target = None
98
 
 
162
  else:
163
  on_target_results.empty()
164
 
165
+ # titration results
166
+ titration_results = st.empty()
167
+ if st.session_state.titration is not None:
168
+ with titration_results.container():
169
+ st.write('Titration predictions:', st.session_state.titration)
170
+ st.download_button(
171
+ label='Download titration predictions',
172
+ data=convert_df(st.session_state.titration),
173
+ file_name='titration.csv',
174
+ mime='text/csv'
175
+ )
176
+ else:
177
+ titration_results.empty()
178
+
179
  # off-target results
180
  off_target_results = st.empty()
181
  if st.session_state.off_target is not None:
 
195
 
196
  # keep trying to run model until we clear inputs (streamlit UI changes can induce race-condition reruns)
197
  if st.session_state.transcripts is not None:
198
+ st.session_state.on_target, st.session_state.titration, st.session_state.off_target = tiger.tiger_exhibit(
199
  transcripts=st.session_state.transcripts,
200
  mode={v: k for k, v in tiger.RUN_MODES.items()}[st.session_state.mode],
201
  check_off_targets=st.session_state.check_off_targets,