Skip to content

Commit

Permalink
Added todos to include LibraryHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshoffmann committed Nov 2, 2023
1 parent 56d3497 commit 21739dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion streamlit_app/pages/1_File_Import.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
from matchms.importing import load_from_mgf
from tempfile import NamedTemporaryFile
from library_spectra_validation.library_handler import LibraryHandler


st.set_page_config(
Expand Down Expand Up @@ -44,6 +45,13 @@
with open(file=mgf_file, mode="wb") as f:
f.write(uploaded_file.getbuffer())

# load spectra from mgf, TODO: replace with SpectralLibrary implementation and import
# we will receive a list of spectra metadata (each being a dataframe)
# TODO: we can retrieve each spectrum from the SpectralLibrary object
# TODO: display forward and backward buttons to page through spectra

lib_handler = LibraryHandler(f.name)

spectra_temp = load_from_mgf(f.name)
spectra = list(spectra_temp)
df_spectra = pd.DataFrame({"spectrum": spectra})
Expand All @@ -60,7 +68,7 @@ def extract_metadata(df, keys):

st.metric('Detected how many spectra', len(df_spectra))

st.write(df_spectra)
st.data_editor(df_spectra)# , on_change=user_metadata_change())


st.session_state['spectra'] = spectra
Expand Down

0 comments on commit 21739dc

Please sign in to comment.