yzhouchen001 commited on
Commit
28267e0
·
1 Parent(s): 109830d

added instruction

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -94,7 +94,9 @@ adduct_input = st.text_input("Enter adduct:", value=st.session_state.adduct)
94
  st.subheader("Precursor mz")
95
  precursor_input = st.text_input("Enter precursor mz:", value=st.session_state.precursor_mz)
96
 
97
- # --- Run button toggles flag ---
 
 
98
  if st.button("Run"):
99
 
100
  for f in FIELDS:
@@ -132,18 +134,20 @@ if st.button("Run"):
132
  mass_diff_thresh=20,
133
  precursor_intensity=1.1
134
  )
135
- st.write(st.session_state.sim_norm.shape)
136
  st.session_state.selected_spectrum_idx = None
137
  st.session_state.selected_node_idx = None
138
  st.session_state.run_clicked = True
139
 
140
- # --- Main results ---
 
 
141
  if st.session_state.run_clicked:
142
  st.subheader("Peak-to-Node Similarity")
 
143
  st.text("Double click on a peak or node to visualize similarity scores")
144
 
145
- fig = st.session_state.fig # get the figure
146
- # Apply any coloring before rendering
147
  if st.session_state.selected_spectrum_idx is not None:
148
  idx = st.session_state.selected_spectrum_idx
149
  scores = st.session_state.sim_norm[idx, :]
@@ -159,8 +163,7 @@ if st.session_state.run_clicked:
159
  "red" if i == idx else "lightgray" for i in range(st.session_state.sim_norm.shape[1])
160
  ]
161
 
162
- # Render figure once with plotly_events
163
-
164
  selected = plotly_events(
165
  st.session_state.fig,
166
  click_event=True,
 
94
  st.subheader("Precursor mz")
95
  precursor_input = st.text_input("Enter precursor mz:", value=st.session_state.precursor_mz)
96
 
97
+ # ------------------------
98
+ # Run model
99
+ # ------------------------
100
  if st.button("Run"):
101
 
102
  for f in FIELDS:
 
134
  mass_diff_thresh=20,
135
  precursor_intensity=1.1
136
  )
137
+
138
  st.session_state.selected_spectrum_idx = None
139
  st.session_state.selected_node_idx = None
140
  st.session_state.run_clicked = True
141
 
142
+ # ------------------------
143
+ # Display visualization
144
+ # ------------------------
145
  if st.session_state.run_clicked:
146
  st.subheader("Peak-to-Node Similarity")
147
+ st.text("Only annotated peaks are shown. Peaks assigned the same subformula are combined by summing all the intensities and the smallest m/z value is shown.")
148
  st.text("Double click on a peak or node to visualize similarity scores")
149
 
150
+ fig = st.session_state.fig
 
151
  if st.session_state.selected_spectrum_idx is not None:
152
  idx = st.session_state.selected_spectrum_idx
153
  scores = st.session_state.sim_norm[idx, :]
 
163
  "red" if i == idx else "lightgray" for i in range(st.session_state.sim_norm.shape[1])
164
  ]
165
 
166
+ # Render figure
 
167
  selected = plotly_events(
168
  st.session_state.fig,
169
  click_event=True,