supercat666 commited on
Commit
1acd869
1 Parent(s): ba43ebe

fixed bugs

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -99,7 +99,7 @@ if selected_model == 'Cas9':
99
 
100
  if target_selection == 'on-target':
101
  # Gene symbol entry
102
- gene_symbol = st.text_input('Enter a Gene Symbol:', key='gene_symbol')
103
 
104
  if 'current_gene_symbol' not in st.session_state:
105
  st.session_state['current_gene_symbol'] = ""
@@ -120,9 +120,13 @@ if selected_model == 'Cas9':
120
 
121
  # Process predictions
122
  if predict_button and gene_symbol:
123
- predictions, gene_sequence = cas9on.process_gene(gene_symbol, cas9on_path)
124
- sorted_predictions = sorted(predictions, key=lambda x: x[-1], reverse=True)[:10]
125
- st.session_state['on_target_results'] = sorted_predictions
 
 
 
 
126
 
127
  if 'on_target_results' in st.session_state and st.session_state['on_target_results']:
128
  # Include "Target" in the DataFrame's columns
@@ -290,7 +294,7 @@ if selected_model == 'Cas9':
290
 
291
  elif selected_model == 'Cas12':
292
  # Gene symbol entry
293
- gene_symbol = st.text_input('Enter a Gene Symbol:', key='gene_symbol')
294
 
295
  # Initialize the current_gene_symbol in the session state if it doesn't exist
296
  if 'current_gene_symbol' not in st.session_state:
@@ -318,9 +322,11 @@ elif selected_model == 'Cas12':
318
  st.session_state['current_gene_symbol'] = gene_symbol
319
 
320
  # Run the prediction process
321
- predictions, gene_sequence = cas12.process_gene(gene_symbol,cas12_path)
322
- sorted_predictions = sorted(predictions, key=lambda x: x[-1], reverse=True)[:10]
323
- st.session_state['on_target_results'] = sorted_predictions
 
 
324
 
325
  # Visualization and file generation
326
  if 'on_target_results' in st.session_state and st.session_state['on_target_results']:
 
99
 
100
  if target_selection == 'on-target':
101
  # Gene symbol entry
102
+ gene_symbol = st.text_input('Enter a Gene Symbol:', placeholder="e.g., FOXA1", key='gene_symbol')
103
 
104
  if 'current_gene_symbol' not in st.session_state:
105
  st.session_state['current_gene_symbol'] = ""
 
120
 
121
  # Process predictions
122
  if predict_button and gene_symbol:
123
+ with st.spinner('Predicting... Please wait'):
124
+ predictions, gene_sequence = cas9on.process_gene(gene_symbol, cas9on_path)
125
+ sorted_predictions = sorted(predictions, key=lambda x: x[-1], reverse=True)[:10]
126
+ st.session_state['on_target_results'] = sorted_predictions
127
+
128
+ # notify the user once the process is completed successfully.
129
+ st.success('Prediction completed!')
130
 
131
  if 'on_target_results' in st.session_state and st.session_state['on_target_results']:
132
  # Include "Target" in the DataFrame's columns
 
294
 
295
  elif selected_model == 'Cas12':
296
  # Gene symbol entry
297
+ gene_symbol = st.text_input('Enter a Gene Symbol:', placeholder="e.g., FOXA1", key='gene_symbol')
298
 
299
  # Initialize the current_gene_symbol in the session state if it doesn't exist
300
  if 'current_gene_symbol' not in st.session_state:
 
322
  st.session_state['current_gene_symbol'] = gene_symbol
323
 
324
  # Run the prediction process
325
+ with st.spinner('Predicting... Please wait'):
326
+ predictions, gene_sequence = cas12.process_gene(gene_symbol,cas12_path)
327
+ sorted_predictions = sorted(predictions, key=lambda x: x[-1], reverse=True)[:10]
328
+ st.session_state['on_target_results'] = sorted_predictions
329
+ st.success('Prediction completed!')
330
 
331
  # Visualization and file generation
332
  if 'on_target_results' in st.session_state and st.session_state['on_target_results']: