Erva Ulusoy commited on
Commit
2f8d670
·
1 Parent(s): 94db867

discard the manual reset button

Browse files
Files changed (2) hide show
  1. ProtHGT_app.py +20 -16
  2. pages/User_Guide.py +1 -1
ProtHGT_app.py CHANGED
@@ -36,6 +36,8 @@ if 'predictions_df' not in st.session_state:
36
  st.session_state.predictions_df = None
37
  if 'submitted' not in st.session_state:
38
  st.session_state.submitted = False
 
 
39
 
40
  with st.expander("🚀 Upcoming Features"):
41
  st.info("""
@@ -106,7 +108,7 @@ with st.sidebar:
106
  "Select proteins from search results",
107
  options=filtered_proteins,
108
  placeholder="Start typing to search...",
109
- max_selections=1000
110
  )
111
 
112
  if selected_proteins:
@@ -114,7 +116,7 @@ with st.sidebar:
114
 
115
  else:
116
  uploaded_file = st.file_uploader(
117
- "Upload a text file with UniProt IDs (one per line, max 1000)*",
118
  type=['txt']
119
  )
120
 
@@ -130,8 +132,8 @@ with st.sidebar:
130
  # Filter to keep only available proteins
131
  protein_list = [p for p in protein_list if p in available_proteins]
132
 
133
- if len(protein_list) > 1000:
134
- st.error("Please upload a file with maximum 1000 protein IDs.")
135
  selected_proteins = []
136
  else:
137
  selected_proteins = protein_list
@@ -208,11 +210,21 @@ with st.sidebar:
208
  help="Choose which GO category to generate predictions for. Selecting 'All Categories' will generate predictions for all three categories."
209
  )
210
 
211
- st.warning("⚠️ Due to memory and computational constraints, the maximum number of proteins that can be processed at once is limited to 1000 proteins. For larger datasets, please consider running the model locally using our GitHub repository.")
212
 
213
  if selected_proteins and selected_go_category:
214
- # Add a button to trigger predictions
215
- if st.button("Generate Predictions"):
 
 
 
 
 
 
 
 
 
 
216
  st.session_state.submitted = True
217
 
218
  if st.session_state.submitted:
@@ -427,12 +439,4 @@ if st.session_state.submitted:
427
  file_name="filtered_predictions.csv",
428
  mime="text/csv",
429
  key="download_filtered_predictions"
430
- )
431
-
432
- # Add a reset button in the sidebar
433
- with st.sidebar:
434
- if st.session_state.submitted:
435
- if st.button("Reset"):
436
- st.session_state.predictions_df = None
437
- st.session_state.submitted = False
438
- st.rerun()
 
36
  st.session_state.predictions_df = None
37
  if 'submitted' not in st.session_state:
38
  st.session_state.submitted = False
39
+ if 'previous_inputs' not in st.session_state:
40
+ st.session_state.previous_inputs = None
41
 
42
  with st.expander("🚀 Upcoming Features"):
43
  st.info("""
 
108
  "Select proteins from search results",
109
  options=filtered_proteins,
110
  placeholder="Start typing to search...",
111
+ max_selections=100
112
  )
113
 
114
  if selected_proteins:
 
116
 
117
  else:
118
  uploaded_file = st.file_uploader(
119
+ "Upload a text file with UniProt IDs (one per line, max 100)*",
120
  type=['txt']
121
  )
122
 
 
132
  # Filter to keep only available proteins
133
  protein_list = [p for p in protein_list if p in available_proteins]
134
 
135
+ if len(protein_list) > 100:
136
+ st.error("Please upload a file with maximum 100 protein IDs.")
137
  selected_proteins = []
138
  else:
139
  selected_proteins = protein_list
 
210
  help="Choose which GO category to generate predictions for. Selecting 'All Categories' will generate predictions for all three categories."
211
  )
212
 
213
+ st.warning("⚠️ Due to memory and computational constraints, the maximum number of proteins that can be processed at once is limited to 100 proteins. For larger datasets, please consider running the model locally using our GitHub repository.")
214
 
215
  if selected_proteins and selected_go_category:
216
+ # Create a tuple of current inputs to track changes
217
+ current_inputs = (tuple(selected_proteins), selected_go_category)
218
+
219
+ # Check if inputs have changed
220
+ if st.session_state.previous_inputs != current_inputs:
221
+ st.session_state.predictions_df = None
222
+ st.session_state.submitted = False
223
+ st.session_state.previous_inputs = current_inputs
224
+
225
+ # Add a button to trigger predictions - disabled if already submitted with current inputs
226
+ button_disabled = st.session_state.submitted and st.session_state.previous_inputs == current_inputs
227
+ if st.button("Generate Predictions", disabled=button_disabled):
228
  st.session_state.submitted = True
229
 
230
  if st.session_state.submitted:
 
439
  file_name="filtered_predictions.csv",
440
  mime="text/csv",
441
  key="download_filtered_predictions"
442
+ )
 
 
 
 
 
 
 
 
pages/User_Guide.py CHANGED
@@ -21,7 +21,7 @@ In the **sidebar**, choose how to input your proteins:
21
  - **Search Proteins**: Select or search UniProt IDs from the available dataset.
22
  - **Upload a File**: Upload a text file (.txt) containing UniProt IDs (one per line, max 100).
23
  """)
24
- st.warning("⚠️ Only proteins included in our input knowledge graph can be processed. If your protein is missing, real-time retrieval from external sources is not yet supported.")
25
  st.info("📥 Selected proteins can be downloaded as a txt file.")
26
 
27
 
 
21
  - **Search Proteins**: Select or search UniProt IDs from the available dataset.
22
  - **Upload a File**: Upload a text file (.txt) containing UniProt IDs (one per line, max 100).
23
  """)
24
+ st.warning("⚠️ Currently, our system can only generate predictions for proteins that are already included in our knowledge graph. Real-time retrieval of relationship data from external source databases is not yet supported. We are actively working on integrating this capability in future updates. Stay tuned!")
25
  st.info("📥 Selected proteins can be downloaded as a txt file.")
26
 
27