Spaces:
Sleeping
Sleeping
Erva Ulusoy
commited on
Commit
·
7d697ba
1
Parent(s):
0ab12f7
added filtering with go ids
Browse files- ProtHGT_app.py +13 -6
ProtHGT_app.py
CHANGED
|
@@ -256,7 +256,7 @@ if st.session_state.submitted:
|
|
| 256 |
|
| 257 |
# Create filters
|
| 258 |
st.markdown("### Filter Predictions")
|
| 259 |
-
col1, col2, col3 = st.columns(
|
| 260 |
|
| 261 |
with col1:
|
| 262 |
# Protein filter
|
|
@@ -271,8 +271,16 @@ if st.session_state.submitted:
|
|
| 271 |
"Filter by GO Category",
|
| 272 |
options=['All'] + sorted(st.session_state.predictions_df['GO_category'].unique().tolist())
|
| 273 |
)
|
| 274 |
-
|
| 275 |
with col3:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
# Probability threshold
|
| 277 |
min_probability_threshold = st.slider(
|
| 278 |
"Minimum Probability",
|
|
@@ -298,14 +306,13 @@ if st.session_state.submitted:
|
|
| 298 |
|
| 299 |
if selected_category != 'All':
|
| 300 |
filtered_df = filtered_df[filtered_df['GO_category'] == selected_category]
|
|
|
|
|
|
|
|
|
|
| 301 |
|
| 302 |
filtered_df = filtered_df[(filtered_df['Probability'] >= min_probability_threshold) &
|
| 303 |
(filtered_df['Probability'] <= max_probability_threshold)]
|
| 304 |
|
| 305 |
-
# Sort by probability
|
| 306 |
-
filtered_df = filtered_df.sort_values('Probability', ascending=False)
|
| 307 |
-
|
| 308 |
-
|
| 309 |
# Custom CSS to increase table width and improve layout
|
| 310 |
st.markdown("""
|
| 311 |
<style>
|
|
|
|
| 256 |
|
| 257 |
# Create filters
|
| 258 |
st.markdown("### Filter Predictions")
|
| 259 |
+
col1, col2, col3, col4 = st.columns(4) # Changed to 4 columns
|
| 260 |
|
| 261 |
with col1:
|
| 262 |
# Protein filter
|
|
|
|
| 271 |
"Filter by GO Category",
|
| 272 |
options=['All'] + sorted(st.session_state.predictions_df['GO_category'].unique().tolist())
|
| 273 |
)
|
| 274 |
+
|
| 275 |
with col3:
|
| 276 |
+
# GO term filter
|
| 277 |
+
go_term_filter = st.text_input(
|
| 278 |
+
"Filter by GO Term ID",
|
| 279 |
+
placeholder="e.g., GO:0003674",
|
| 280 |
+
help="Enter a GO term ID to filter results"
|
| 281 |
+
).strip()
|
| 282 |
+
|
| 283 |
+
with col4:
|
| 284 |
# Probability threshold
|
| 285 |
min_probability_threshold = st.slider(
|
| 286 |
"Minimum Probability",
|
|
|
|
| 306 |
|
| 307 |
if selected_category != 'All':
|
| 308 |
filtered_df = filtered_df[filtered_df['GO_category'] == selected_category]
|
| 309 |
+
|
| 310 |
+
if go_term_filter:
|
| 311 |
+
filtered_df = filtered_df[filtered_df['GO_term'].str.contains(go_term_filter, case=False, na=False)]
|
| 312 |
|
| 313 |
filtered_df = filtered_df[(filtered_df['Probability'] >= min_probability_threshold) &
|
| 314 |
(filtered_df['Probability'] <= max_probability_threshold)]
|
| 315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
# Custom CSS to increase table width and improve layout
|
| 317 |
st.markdown("""
|
| 318 |
<style>
|