bobeobibo / phigaro

Phigaro is a scalable command-line tool for predicting phages and prophages
MIT License
46 stars 15 forks source link

use command instead of locate #13

Open EricDeveaud opened 4 years ago

EricDeveaud commented 4 years ago

Hello,

you may want to use 'command' instead of locate in order to find the path of auxiliary binaries command is posix and available on all unices.

locate is not always available, eg on our cluster it is not, and won't be.

444thLiao commented 4 years ago

maybe replace sh.locate with sh.find in phigaro/helper.py would fix your problem..

EricDeveaud commented 4 years ago

nop find is not acceptable

to check for binaries, just check on the PATH

snayfach commented 3 years ago
$ phigaro-setup --no-updatedb
Traceback (most recent call last):
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/bin/phigaro-setup", line 8, in <module>
    sys.exit(main())
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/cli/helper.py", line 121, in main
    force=args.force,
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/cli/helper.py", line 29, in create_config
    config = helper.setup()
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/helper.py", line 160, in setup
    prodigal_params = self._setup_prodigal()
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/helper.py", line 143, in _setup_prodigal
    raise_if_not_found=ProdigalNotFound.message,
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/helper.py", line 123, in _find_binary
    '-b', '-r', '^{}$'.format(name)
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/phigaro/helper.py", line 117, in _locate
    return [s.rstrip() for s in sh.locate(*args, **kwargs)]
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/sh.py", line 3581, in __getattr__
    return self.__env[name]
  File "/global/home/users/snayfach/.conda/envs/phigaro_env/lib/python3.7/site-packages/sh.py", line 3378, in __getitem__
    raise CommandNotFound(k)
sh.CommandNotFound: locate
444thLiao commented 3 years ago

the command sh.locate rely on the binary file locate in your PATH. Maybe it doesn't install at your OS. @snayfach Just install it or replace sh.locate with sh.find