Skip to content

Commit

Permalink
SIRIUS in Windows executable
Browse files Browse the repository at this point in the history
  • Loading branch information
axelwalter committed Jun 17, 2024
1 parent abb36eb commit 12cadba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ jobs:
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
- name: Install pip
run: |
curl -O https://bootstrap.pypa.io/get-pip.py
Expand All @@ -202,6 +203,11 @@ jobs:
run: |
echo '@echo off' > UmetaFlow.bat
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run Home.py local' >> UmetaFlow.bat
- name: Download and extract SIRIUS
run: |
curl -L -O https://github.com/sirius-ms/sirius/releases/download/v5.8.6/sirius-5.8.6-win64.zip
unzip sirius-5.8.6-win64.zip
- name: Create All-in-one executable folder
run: |
Expand All @@ -215,6 +221,7 @@ jobs:
cp -r .streamlit streamlit_exe
cp -r openms-bin streamlit_exe/bin
cp -r share streamlit_exe/share
cp -r sirius streamlit_exe/sirius
cp Home.py streamlit_exe
- name: Delete OpenMS bin artifact
Expand Down
27 changes: 18 additions & 9 deletions src/UmetaFlowTOPPWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,18 @@ def configure(self) -> None:
)
self.ui.input_TOPP("SiriusExport")

if "sirius-exists" not in st.session_state:
st.session_state["sirius-exists"] = shutil.which(str(Path(sys.prefix, "bin", "sirius"))) is not None
if "sirius-path" not in st.session_state:
possible_paths = [ # potential SIRIUS locations in increasing priority
str(Path("sirius")), # anywhere
str(Path(sys.prefix, "bin", "sirius")), # in current conda environment
str(Path(".", "sirius", "sirius.exe")), # in case of Windows executables
]
st.session_state["sirius-path"] = ""
for path in possible_paths:
if shutil.which(path) is not None:
st.session_state["sirius-path"] = path

if st.session_state["sirius-exists"]:
if st.session_state["sirius-path"]:
st.markdown("**SIRIUS user login**")
cols = st.columns([0.25, 0.25, 0.5])
with cols[0]:
Expand Down Expand Up @@ -524,7 +532,7 @@ def execution(self) -> None:
)
mzML = sorted(mzML)
run_sirius = False
if st.session_state["sirius-exists"]:
if st.session_state["sirius-path"]:
if (
self.params["run-sirius"]
or self.params["run-fingerid"]
Expand All @@ -537,8 +545,8 @@ def execution(self) -> None:
self.logger.log(
"WARNING: SIRIUS account info incomplete. SIRIUS will not be executed and features not annotated."
)
else:
run_sirius = True
st.session_state["sirius-path"] = ""

if self.params["export-sirius"] or run_sirius:
self.logger.log("Exporting input files for SIRIUS.")
sirius_ms_files = self.file_manager.get_files(mzML, "ms", "sirius-export")
Expand All @@ -554,7 +562,7 @@ def execution(self) -> None:
self.logger.log("Logging in to SIRIUS...")
self.executor.run_command(
[
str(Path(sys.prefix, "bin", "sirius")),
st.session_state["sirius-path"],
"login",
f"--email={self.params['sirius-user-email']}",
f"--password={self.params['sirius-user-password']}",
Expand All @@ -571,7 +579,7 @@ def execution(self) -> None:
if Path(ms).stat().st_size > 0:
project.mkdir(parents=True)
command = [
str(Path(sys.prefix, "bin", "sirius")),
st.session_state["sirius-path"],
"--input",
ms,
"--project",
Expand Down Expand Up @@ -809,7 +817,8 @@ def quality_colors(value):
"adduct",
"MS1 annotation",
"MS2 annotation",
]+sirius_cols,
]
+ sirius_cols,
hide_index=False,
column_config={
"intensity": st.column_config.BarChartColumn(
Expand Down

0 comments on commit 12cadba

Please sign in to comment.