Skip to content

Commit 547aab0

Browse files
Merge pull request #101 from hgb-bin-proteomics/upgrade-dependencies
Upgrade dependencies and Dockerfile
2 parents 6de2974 + 4c52bff commit 547aab0

8 files changed

Lines changed: 1464 additions & 1029 deletions

File tree

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dockerfile for Internal Ion Explorer
22
# author: Micha Birklbauer
3-
# version: 1.2.2
3+
# version: 1.3.0
44

55
FROM python:3.12
66

@@ -10,10 +10,11 @@ RUN mkdir internal_ions
1010
COPY ./ internal_ions/
1111
WORKDIR internal_ions
1212

13-
RUN python3 -m venv venv && \
14-
. venv/bin/activate && \
15-
pip install --upgrade pip && \
16-
pip install --upgrade setuptools && \
17-
pip install --no-cache-dir -r env.txt
13+
RUN pip install --upgrade pip
14+
RUN pip install --upgrade setuptools
15+
RUN pip install --no-cache-dir uv
1816

19-
CMD ["sh", "-c", ". venv/bin/activate && streamlit run streamlit_app.py"]
17+
RUN uv sync
18+
RUN uv cache clean
19+
20+
CMD ["sh", "-c", "uv run -- streamlit run streamlit_app.py"]

internal_ions/tab1.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import numpy as np
23

34
import streamlit as st
45
import logging
@@ -96,13 +97,13 @@ def main(argv=None) -> None:
9697
if st.session_state["sidebar_disabled"]:
9798
enable_sidebar = st.button("Re-enable upload and parameter selection!",
9899
type="secondary",
99-
use_container_width=True)
100+
width="stretch")
100101
if enable_sidebar:
101102
st.session_state["sidebar_disabled"] = False
102103
st.rerun()
103104
run_analysis = st.button("Load files and run Fragannot!",
104105
type="primary",
105-
use_container_width=True)
106+
width="stretch")
106107

107108
if run_analysis:
108109
st.session_state["sidebar_disabled"] = True
@@ -136,7 +137,7 @@ def main(argv=None) -> None:
136137

137138
converter = JSONConverter()
138139
st.session_state["result"] = result
139-
st.session_state["dataframes"] = converter.to_dataframes(data=result)
140+
st.session_state["dataframes"] = [df.replace(r'^\s*$', np.nan, regex=True) for df in converter.to_dataframes(data=result)]
140141
st.session_state["dataframes_source"] = {"spectrum_file": spectrum_file.name,
141142
"identifications_file": st.session_state.identifications_file.name,
142143
"fragment_centric_csv": None,
@@ -160,9 +161,9 @@ def main(argv=None) -> None:
160161
if "dataframes" in st.session_state:
161162
st.subheader("Results Preview", divider=DIV_COLOR)
162163
st.markdown("Fragment-centric")
163-
st.dataframe(st.session_state["dataframes"][0].head(10), use_container_width=True)
164+
st.dataframe(st.session_state["dataframes"][0].head(10), width="stretch")
164165
st.markdown("Spectrum-centric")
165-
st.dataframe(st.session_state["dataframes"][1].head(10), use_container_width=True)
166+
st.dataframe(st.session_state["dataframes"][1].head(10), width="stretch")
166167

167168
st.subheader("Download Results", divider=DIV_COLOR)
168169

@@ -175,15 +176,15 @@ def main(argv=None) -> None:
175176
mime="text/csv",
176177
help="Download fragment-centric Fragannot results in .csv format.",
177178
type="primary",
178-
use_container_width=True)
179+
width="stretch")
179180
with dl_center:
180181
st.download_button(label="Download Spectrum-centric data!",
181182
data=dataframe_to_csv_stream(st.session_state["dataframes"][1]),
182183
file_name="spectrum_centric.csv",
183184
mime="text/csv",
184185
help="Download spectrum-centric Fragannot results in .csv format.",
185186
type="primary",
186-
use_container_width=True)
187+
width="stretch")
187188

188189
if "result" in st.session_state:
189190
with dl_r1:
@@ -193,4 +194,4 @@ def main(argv=None) -> None:
193194
mime="text/json",
194195
help="Download raw Fragannot results in .json file format.",
195196
type="primary",
196-
use_container_width=True)
197+
width="stretch")

internal_ions/tab2.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def main(argv=None) -> None:
8888
st.session_state["spec_center_filtered"], st.session_state["frag_center_filtered"] = filter_dataframe(tmp_spec, tmp_frag, 'spectrum')
8989

9090
st.markdown("Data of the fragment-centric dataframe:")
91-
st.dataframe(st.session_state["frag_center_filtered"], height=400, use_container_width=True)
91+
st.dataframe(st.session_state["frag_center_filtered"], height=400, width="stretch")
9292
st.markdown("Data of the spectrum-centric dataframe:")
93-
st.dataframe(st.session_state["spec_center_filtered"], height=400, use_container_width=True)
93+
st.dataframe(st.session_state["spec_center_filtered"], height=400, width="stretch")
9494

9595
############################################################################
9696

@@ -101,47 +101,47 @@ def main(argv=None) -> None:
101101

102102
with frag_center_plot_col1_1:
103103
st.markdown("**Distribution of Ion Types**")
104-
st.plotly_chart(common_type_hist(st.session_state["frag_center_filtered"]), use_container_width=True)
104+
st.plotly_chart(common_type_hist(st.session_state["frag_center_filtered"]), width="stretch")
105105
st.markdown("**Figure 1:** Histogram illustrating the frequency distribution of ion types present in the dataset.")
106106

107107
with frag_center_plot_col1_2:
108108
st.markdown("**Ion Type Proportions**")
109-
st.plotly_chart(common_type_pie(st.session_state["frag_center_filtered"]), use_container_width=True)
109+
st.plotly_chart(common_type_pie(st.session_state["frag_center_filtered"]), width="stretch")
110110
st.markdown("**Figure 2:** Pie chart displaying the proportional composition of ion types within the dataset.")
111111

112112
st.markdown("**Distribution of m/z Values Across Ion Types**")
113-
st.plotly_chart(mz_dist_ion_type(st.session_state["frag_center_filtered"]), use_container_width=True)
113+
st.plotly_chart(mz_dist_ion_type(st.session_state["frag_center_filtered"]), width="stretch")
114114
st.markdown("**Figure 3:** Histogram depicting the distribution of mass-to-charge ratio (m/z) values across different ion types.")
115115

116116
frag_center_plot_col3_1, frag_center_plot_col3_2 = st.columns(2)
117117

118118
with frag_center_plot_col3_1:
119119
st.markdown("**Distribution of the Log Intensity**")
120-
st.plotly_chart(rel_ion_intens_perc(st.session_state["frag_center_filtered"]), use_container_width=True)
120+
st.plotly_chart(rel_ion_intens_perc(st.session_state["frag_center_filtered"]), width="stretch")
121121
st.markdown("**Figure 4:** Distribution of log-transformed intensity values.")
122122

123123
with frag_center_plot_col3_2:
124124
st.markdown("**Relative Log Intensities**")
125-
st.plotly_chart(rel_ion_intens_ridge(st.session_state["frag_center_filtered"]), use_container_width=True)
125+
st.plotly_chart(rel_ion_intens_ridge(st.session_state["frag_center_filtered"]), width="stretch")
126126
st.markdown("**Figure 5:** Distribution of log-transformed intensities relative to their respective scales.")
127127

128128
frag_center_plot_col4_1, frag_center_plot_col4_2 = st.columns(2)
129129

130130
with frag_center_plot_col4_1:
131131
st.markdown("**Proportional Distribution of m/z Values**")
132-
st.plotly_chart(proportional_distribution_of_mz_values(st.session_state["frag_center_filtered"]), use_container_width=True)
132+
st.plotly_chart(proportional_distribution_of_mz_values(st.session_state["frag_center_filtered"]), width="stretch")
133133
st.markdown("**Figure 6:** Proportional Distribution of m/z Values (Bin Size = 100).")
134134

135135
with frag_center_plot_col4_2:
136136
st.markdown("**First residue of internal and terminal ions**")
137-
st.plotly_chart(first_residue_of_internal_and_terminal_ions(st.session_state["frag_center_filtered"]), use_container_width=True)
137+
st.plotly_chart(first_residue_of_internal_and_terminal_ions(st.session_state["frag_center_filtered"]), width="stretch")
138138
st.markdown("**Figure 7:** First residue of internal and terminal ions.")
139139

140140
frag_center_plot_col5_1, frag_center_plot_col5_2 = st.columns(2)
141141

142142
with frag_center_plot_col5_1:
143143
st.markdown("**Last residue of internal and terminal ions**")
144-
st.plotly_chart(last_residue_of_internal_and_terminal_ions(st.session_state["frag_center_filtered"]), use_container_width=True)
144+
st.plotly_chart(last_residue_of_internal_and_terminal_ions(st.session_state["frag_center_filtered"]), width="stretch")
145145
st.markdown("**Figure 8:** Last residue of internal and terminal ions.")
146146

147147
############################################################################
@@ -152,36 +152,36 @@ def main(argv=None) -> None:
152152

153153
with spec_center_plot_col1_1:
154154
st.markdown("**Ion Type Distribution Per Spectra**")
155-
st.plotly_chart(per_spec_ion_type(st.session_state["spec_center_filtered"]), use_container_width=True)
155+
st.plotly_chart(per_spec_ion_type(st.session_state["spec_center_filtered"]), width="stretch")
156156
st.markdown("**Figure 9:** Distribution of ion types within each spectrum, providing insights into the diversity and abundance of ions detected across the dataset.")
157157

158158
with spec_center_plot_col1_2:
159159
st.markdown("**Log Intensities:**")
160-
st.plotly_chart(per_spec_ion_intens(st.session_state["spec_center_filtered"]), use_container_width=True)
160+
st.plotly_chart(per_spec_ion_intens(st.session_state["spec_center_filtered"]), width="stretch")
161161
st.markdown("**Figure 10:** Distribution of log-transformed intensities.")
162162

163163
spec_center_plot_col2_1, spec_center_plot_col2_2 = st.columns(2)
164164

165165
with spec_center_plot_col2_1:
166166
st.markdown("**Plot of the length of the top 1 internal ion**")
167-
st.plotly_chart(density_plot_of_the_length_of_the_top_1_internal_ion(st.session_state["spec_center_filtered"]), use_container_width=True)
167+
st.plotly_chart(density_plot_of_the_length_of_the_top_1_internal_ion(st.session_state["spec_center_filtered"]), width="stretch")
168168
st.markdown("**Figure 11:** Plot of the length of the top 1 internal ion.")
169169

170170
with spec_center_plot_col2_2:
171171
st.markdown("**Plot of the length of the top 2 internal ion:**")
172-
st.plotly_chart(density_plot_of_the_length_of_the_top_2_internal_ion(st.session_state["spec_center_filtered"]), use_container_width=True)
172+
st.plotly_chart(density_plot_of_the_length_of_the_top_2_internal_ion(st.session_state["spec_center_filtered"]), width="stretch")
173173
st.markdown("**Figure 12:** Plot of the length of the top 2 internal ion.")
174174

175175
spec_center_plot_col3_1, spec_center_plot_col3_2 = st.columns(2)
176176

177177
with spec_center_plot_col3_1:
178178
st.markdown("**Plot of the length of the top 3 internal ion**")
179-
st.plotly_chart(density_plot_of_the_length_of_the_top_3_internal_ion(st.session_state["spec_center_filtered"]), use_container_width=True)
179+
st.plotly_chart(density_plot_of_the_length_of_the_top_3_internal_ion(st.session_state["spec_center_filtered"]), width="stretch")
180180
st.markdown("**Figure 13:** Plot of the length of the top 3 internal ion.")
181181

182182
with spec_center_plot_col3_2:
183183
st.markdown("**Plot of the length of the top internal ions:**")
184-
st.plotly_chart(density_plot_of_the_length_of_the_top_internal_ions(st.session_state["spec_center_filtered"]), use_container_width=True)
184+
st.plotly_chart(density_plot_of_the_length_of_the_top_internal_ions(st.session_state["spec_center_filtered"]), width="stretch")
185185
st.markdown("**Figure 14:** Plot of the length of the top internal ions.")
186186

187187
st.markdown("**Logo view of internal fragments:**")

internal_ions/tab3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def main(argv=None) -> None:
7676

7777
# plot chromatogram
7878
spectra_chromatogram = st.plotly_chart(plot_spectra_chromatogram(spectra["spectra"]),
79-
use_container_width=True,
79+
width="stretch",
8080
theme="streamlit",
8181
key="chromatogram",
8282
on_select="rerun",
@@ -201,7 +201,7 @@ def main(argv=None) -> None:
201201
with center_button:
202202
run_filter = st.button("Filter spectra and create consensus spectrum",
203203
type="primary",
204-
use_container_width=True)
204+
width="stretch")
205205

206206
if run_filter:
207207
selected_scans_list = [i for i in range(int(first_scan), int(last_scan) + 1)]
@@ -267,7 +267,7 @@ def main(argv=None) -> None:
267267
st.session_state["consensus_spectrum"]["mz_mean"],
268268
st.session_state["consensus_spectrum"]["cov_spectra"]
269269
)
270-
st.plotly_chart(spectrum_plot, use_container_width=True)
270+
st.plotly_chart(spectrum_plot, width="stretch")
271271
st.markdown("**Figure 1:** Displaying consensus spetrum.")
272272

273273
if "consensus_spectrum" in st.session_state:
@@ -337,7 +337,7 @@ def main(argv=None) -> None:
337337
if "generated_fraggraph" not in st.session_state:
338338
fg_run_l, fg_run_center, fg_run_r = st.columns(3)
339339
with fg_run_center:
340-
run_fraggraph = st.button("Run Fraggraph!", type="primary", use_container_width=True)
340+
run_fraggraph = st.button("Run Fraggraph!", type="primary", width="stretch")
341341

342342
if "generated_fraggraph" in st.session_state or run_fraggraph:
343343
st.session_state["generated_fraggraph"] = True

internal_ions/tab4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def main(argv=None) -> None:
2121
ext_docs = st.link_button("Read full documentation!",
2222
url = "https://internal-ions.vercel.app/",
2323
type = "primary",
24-
use_container_width = True)
24+
width = "stretch")

0 commit comments

Comments
 (0)