Skip to content

Commit

Permalink
Fix display of error message (invalid additional genes) when Reset Al…
Browse files Browse the repository at this point in the history
…l Analyses button is clicked
  • Loading branch information
memgonzales committed Jun 5, 2024
1 parent 696a3ba commit 7ab8301
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
22 changes: 0 additions & 22 deletions callbacks/coexpression/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,28 +233,6 @@ def display_coexpression_output(coexpression_is_submitted):
else:
return {"display": "none"}

@app.callback(
Output("coexpression-addl-genes-error", "style"),
Output("coexpression-addl-genes-error", "children"),
Input("homepage-is-resetted", "data"),
)
def clear_coexpression_error_messages(homepage_is_resetted):
"""
Clears coexpression input error
Parameters:
- homepage_is_resetted: Saved boolean value of resetted analysis
Returns:
- ('coexpression-addl-genes-error', 'style'): {'display': 'block'} for displaying the coexpression error container; otherwise {'display': 'none'}
- ('coexpression-addl-genes-error', 'children'): None for no error message
"""

if homepage_is_resetted:
return {"display": "none"}, None

raise PreventUpdate

@app.callback(
Output("coexpression-submit", "disabled"),
Input("coexpression-submit", "n_clicks"),
Expand Down
29 changes: 28 additions & 1 deletion callbacks/homepage/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def display_specific_analysis_page(
Output("session-container", "children", allow_duplicate=True),
Output("input-error", "children"),
Output("input-error", "style"),
Output("coexpression-addl-genes-error", "children", allow_duplicate=True),
Output("coexpression-addl-genes-error", "style", allow_duplicate=True),
Output("tfbs-addl-genes-error", "children", allow_duplicate=True),
Output("tfbs-addl-genes-error", "style", allow_duplicate=True),
Output("homepage-is-submitted", "data"),
Output("homepage-submitted-genomic-intervals", "data"),
Output("homepage-is-resetted", "data"),
Expand Down Expand Up @@ -132,7 +136,18 @@ def parse_input(nb_intervals_str, n_clicks, n_submit, dccStore_children, *_):
# clear data for items in dcc.Store found in session-container
dccStore_children = clear_specific_dccStore_data(dccStore_children, "")

return dccStore_children, None, {"display": "none"}, False, "", True
return (
dccStore_children,
None,
{"display": "none"},
None,
{"display": "none"},
None,
{"display": "none"},
False,
"",
True,
)

# Parses the genomic interval input
if n_submit >= 1 or ("homepage-submit" == ctx.triggered_id and n_clicks >= 1):
Expand All @@ -148,6 +163,10 @@ def parse_input(nb_intervals_str, n_clicks, n_submit, dccStore_children, *_):
get_error_message(intervals[0]),
],
{"display": "block"},
None,
{"display": "none"},
None,
{"display": "none"},
False,
nb_intervals_str,
True,
Expand All @@ -162,6 +181,10 @@ def parse_input(nb_intervals_str, n_clicks, n_submit, dccStore_children, *_):
dccStore_children,
None,
{"display": "none"},
None,
{"display": "none"},
None,
{"display": "none"},
True,
nb_intervals_str,
True,
Expand All @@ -171,6 +194,10 @@ def parse_input(nb_intervals_str, n_clicks, n_submit, dccStore_children, *_):
dccStore_children,
[f"Error: Input for genomic interval should not be empty."],
{"display": "block"},
None,
{"display": "none"},
None,
{"display": "none"},
False,
nb_intervals_str,
True,
Expand Down
4 changes: 2 additions & 2 deletions callbacks/tf_enrich/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def display_input(nb_intervals_str, homepage_is_submitted, *_):
Output("tfbs-combined-genes", "data", allow_duplicate=True),
Output("tfbs-submitted-set", "data", allow_duplicate=True),
Output("tfbs-submitted-prediction-technique", "data", allow_duplicate=True),
Output("tfbs-addl-genes-error", "style"),
Output("tfbs-addl-genes-error", "children"),
Output("tfbs-addl-genes-error", "style", allow_duplicate=True),
Output("tfbs-addl-genes-error", "children", allow_duplicate=True),
Input("tfbs-submit", "n_clicks"),
State("homepage-is-submitted", "data"),
State("homepage-submitted-genomic-intervals", "data"),
Expand Down

0 comments on commit 7ab8301

Please sign in to comment.