Skip to content

Commit

Permalink
FIX: break where we call a nonexistent function
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Lebedev committed Feb 29, 2024
1 parent ca04539 commit 2e0b722
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
13 changes: 9 additions & 4 deletions alphastats/gui/pages/05_GPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,21 @@ def select_analysis():
volcano_plot._plot()
genes_of_interest_colored = volcano_plot.get_colored_labels()
genes_of_interest_colored_df = volcano_plot.get_colored_labels_df()
print(genes_of_interest_colored_df)

gene_names_colname = st.session_state["loader"].gene_names
prot_ids_colname = st.session_state["loader"].index_column

st.session_state["prot_id_to_gene"] = dict(
zip(
genes_of_interest_colored_df["Protein IDs"].tolist(),
genes_of_interest_colored_df["Gene names"].tolist(),
genes_of_interest_colored_df[prot_ids_colname].tolist(),
genes_of_interest_colored_df[gene_names_colname].tolist(),
)
)
st.session_state["gene_to_prot_id"] = dict(
zip(
genes_of_interest_colored_df["Gene names"].tolist(),
genes_of_interest_colored_df["Protein IDs"].tolist(),
genes_of_interest_colored_df[gene_names_colname].tolist(),
genes_of_interest_colored_df[prot_ids_colname].tolist(),
)
)

Expand Down
13 changes: 9 additions & 4 deletions alphastats/gui/utils/gpt_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,16 +745,21 @@ def send_message_save_thread(client: openai.OpenAI, message: str) -> Optional[li
thread_id=st.session_state["thread_id"],
assistant_id=st.session_state["assistant"].id,
)

plots = wait_for_run_completion(client, st.session_state["thread_id"], run.id)

try:
plots = wait_for_run_completion(client, st.session_state["thread_id"], run.id)
except KeyError as e:
print(e)
plots = None
messages = client.beta.threads.messages.list(
thread_id=st.session_state["thread_id"]
)
st.session_state.messages = []
for num, message in enumerate(messages.data[::-1]):
role = message.role
content = message.content[0].text.value
if message.content:
content = message.content[0].text.value
else:
content = "Sorry, I was unable to process this message. Try again or change your request."
st.session_state.messages.append({"role": role, "content": content})
if not plots:
return
Expand Down
2 changes: 1 addition & 1 deletion alphastats/loader/SpectronautLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
self.confidence_column = None
self.filter_columns = []
self.evidence_df = None
self.gene_names = None
self.gene_names = gene_names_column

self._read_spectronaut_file(file=file, sep=sep)

Expand Down

0 comments on commit 2e0b722

Please sign in to comment.