From 17d9aa69e69f714714c5551cb2075d855098f092 Mon Sep 17 00:00:00 2001 From: RobbinBouwmeester Date: Fri, 1 Dec 2023 13:19:56 +0100 Subject: [PATCH] Add plot before submitting data Add plot before submitting data --- proteobench/modules/dda_quant/module.py | 10 ++++++++++ webinterface/pages/DDA_Quant.py | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/proteobench/modules/dda_quant/module.py b/proteobench/modules/dda_quant/module.py index 46d7c186..42e79a39 100644 --- a/proteobench/modules/dda_quant/module.py +++ b/proteobench/modules/dda_quant/module.py @@ -228,6 +228,16 @@ def add_current_data_point(self, all_datapoints, current_datapoint): all_datapoints = all_datapoints.T.reset_index(drop=True) return all_datapoints + def obtain_all_data_point(self, all_datapoints): + """Add current data point to all data points and load them from file if empty. TODO: Not clear why is the df transposed here.""" + if not isinstance(all_datapoints, pd.DataFrame): + # all_datapoints = pd.read_json(DDA_QUANT_RESULTS_PATH) + all_datapoints = read_results_json_repo(DDA_QUANT_RESULTS_REPO) + + all_datapoints["old_new"] = "old" + + return all_datapoints + def benchmarking( self, input_file: str, input_format: str, user_input: dict, all_datapoints ) -> pd.DataFrame: diff --git a/webinterface/pages/DDA_Quant.py b/webinterface/pages/DDA_Quant.py index fab47b47..ddeb6a20 100644 --- a/webinterface/pages/DDA_Quant.py +++ b/webinterface/pages/DDA_Quant.py @@ -140,7 +140,7 @@ def _main_page(self): with st.form(key="main_form"): st.subheader("Input files") st.markdown( - """ + """ Remember: contaminant sequences are already present in the fasta file associated to this module. **Do not add other contaminants** to your search. This is important when using MaxQuant and MSFragger, among other tools. """ ) @@ -174,6 +174,13 @@ def _main_page(self): if FIG1 in st.session_state: self._populate_results() + if ALL_DATAPOINTS not in st.session_state: + st.session_state[ALL_DATAPOINTS] = None + all_datapoints = st.session_state[ALL_DATAPOINTS] + all_datapoints = Module().obtain_all_data_point(all_datapoints) + fig2 = PlotDataPoint().plot_metric(all_datapoints) + st.plotly_chart(fig2, use_container_width=True) + if submit_button: if self.user_input["input_csv"]: self._run_proteobench()