isambard-uob / isambard

Intelligent System for Analysis, Model Building And Rational Design of biomolecules.
https://isambard-uob.github.io/isambard/
MIT License
20 stars 7 forks source link

Make variable for Scwrl executable path. #10

Open ChrisWellsWood opened 6 years ago

ChrisWellsWood commented 6 years ago

It'd be useful to have an executable_path argument for run_scwrl, scwrl_available and pack_side_chains_scwrl with a default value of Scwrl4 (i.e. on the path), so that people can use Scwrl even if it's not on their path.

universvm commented 2 years ago

Hi, I have a problem with this currently, although I have SCWRL installed:

❯ which Scwrl4
Scwrl4: aliased to /Users/leo/scwrl4/Scwrl4 -p /Users/leo/scwrl4/Scwrl4.ini

I get the following error:

  File "/usr/local/Caskroom/miniforge/base/envs/timed_predict/lib/python3.8/site-packages/isambard/modelling/scwrl.py", line 158, in pack_side_chains_scwrl
    raise ValueError('Scwrl4 is unavailable on your system path.')
ValueError: Scwrl4 is unavailable on your system path.

While checking the code I found that this is where I get the error:

>>> subprocess.check_output(['Scwrl4'], stderr=subprocess.DEVNULL)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Caskroom/miniforge/base/envs/timed_predict/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/Caskroom/miniforge/base/envs/timed_predict/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/Caskroom/miniforge/base/envs/timed_predict/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/Caskroom/miniforge/base/envs/timed_predict/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'Scwrl4'

Which I can get around by modifying the above code to:

subprocess.check_output(['/Users/leo/scwrl4/Scwrl4'], stderr=subprocess.DEVNULL)

So I think that there should be a variable which specifies the executable, or at least an option to specify the path. Let me know your thoughts,