Spaces:
Running
Running
supercat666
commited on
Commit
•
dd69d15
1
Parent(s):
cb692e5
fixed
Browse files
app.py
CHANGED
@@ -92,43 +92,31 @@ if selected_model == 'Cas9':
|
|
92 |
|
93 |
# Actions based on the selected enzyme
|
94 |
if target_selection == 'on-target':
|
95 |
-
# app initialization for Cas9 on-target
|
96 |
-
if 'gene_symbol' not in st.session_state:
|
97 |
-
st.session_state.gene_symbol = None
|
98 |
-
if 'on_target_results' not in st.session_state:
|
99 |
-
st.session_state.on_target_results = None
|
100 |
-
|
101 |
# Gene symbol entry
|
102 |
-
st.text_input(
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
mime='text/csv'
|
127 |
-
)
|
128 |
-
else:
|
129 |
-
st.write('No significant on-target effects detected!')
|
130 |
-
else:
|
131 |
-
on_target_results.empty()
|
132 |
|
133 |
elif target_selection == 'off-target':
|
134 |
ENTRY_METHODS = dict(
|
|
|
92 |
|
93 |
# Actions based on the selected enzyme
|
94 |
if target_selection == 'on-target':
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
# Gene symbol entry
|
96 |
+
gene_symbol = st.text_input('Enter a Gene Symbol:', key='gene_symbol')
|
97 |
+
|
98 |
+
# Prediction button
|
99 |
+
predict_button = st.button('Predict on-target')
|
100 |
+
|
101 |
+
# Process predictions
|
102 |
+
if predict_button and gene_symbol:
|
103 |
+
predictions = cas9on.process_gene(gene_symbol, cas9on_path)
|
104 |
+
# Store only first 10 for display and save full predictions for download
|
105 |
+
st.session_state['on_target_results'] = predictions[:10]
|
106 |
+
st.session_state['full_on_target_results'] = predictions
|
107 |
+
|
108 |
+
# On-target results display
|
109 |
+
if 'on_target_results' in st.session_state and st.session_state['on_target_results']:
|
110 |
+
st.write('On-target predictions:', st.session_state['on_target_results'])
|
111 |
+
if 'full_on_target_results' in st.session_state:
|
112 |
+
# Provide a download button for the full results
|
113 |
+
full_predictions_csv = cas9on.convert_df(st.session_state['full_on_target_results'])
|
114 |
+
st.download_button(
|
115 |
+
label='Download on-target predictions',
|
116 |
+
data=full_predictions_csv,
|
117 |
+
file_name='on_target_results.csv',
|
118 |
+
mime='text/csv'
|
119 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
elif target_selection == 'off-target':
|
122 |
ENTRY_METHODS = dict(
|