Skip to content

Commit

Permalink
check topp tool location
Browse files Browse the repository at this point in the history
  • Loading branch information
axelwalter committed Jun 17, 2024
1 parent af3c060 commit 0534a44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/UmetaFlowTOPPWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ def execution(self) -> None:
]
)
mzML = sorted(mzML)
run_sirius = False
if st.session_state["sirius-path"]:
if (
self.params["run-sirius"]
Expand All @@ -547,7 +546,7 @@ def execution(self) -> None:
)
st.session_state["sirius-path"] = ""

if self.params["export-sirius"] or run_sirius:
if self.params["export-sirius"] or st.session_state["sirius-path"]:
self.logger.log("Exporting input files for SIRIUS.")
sirius_ms_files = self.file_manager.get_files(mzML, "ms", "sirius-export")
self.executor.run_topp(
Expand All @@ -558,7 +557,7 @@ def execution(self) -> None:
"out": sirius_ms_files,
},
)
if run_sirius:
if st.session_state["sirius-path"]:
self.logger.log("Logging in to SIRIUS...")
self.executor.run_command(
[
Expand Down
11 changes: 9 additions & 2 deletions src/workflow/CommandExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,20 @@ def run_topp(self, tool: str, input_output: dict, custom_params: dict = {}) -> N
else:
n_processes = max(io_lengths)

tool_full_path = tool # in case it is globally available (lowest priority)
possible_paths = [ # potential SIRIUS locations in increasing priority
str(Path(sys.prefix, "bin", tool)), # in current conda environment
str(Path(".", "bin", f"{tool}.exe")), # in case of Windows executables
]
for path in possible_paths:
if shutil.which(path) is not None:
tool_full_path = path
commands = []

# Load parameters for non-defaults
params = self.parameter_manager.get_parameters_from_json()
# Construct commands for each process
for i in range(n_processes):
command = [tool]
command = [tool_full_path]
# Add input/output files
for k in input_output.keys():
# add key as parameter name
Expand Down

0 comments on commit 0534a44

Please sign in to comment.