snayfach / MIDAS

An integrated pipeline for estimating strain-level genomic variation from metagenomic data
http://dx.doi.org/10.1101/gr.201863.115
GNU General Public License v3.0
118 stars 52 forks source link

MIDAS is looking in the wrong place for 3rd party executables #99

Open jolespin opened 5 years ago

jolespin commented 5 years ago

I have MIDAS installed and all of the 3rd party tools as well. Has anyone else had this issue?

(midas_env) -bash-4.1$ which run_midas.py
/usr/local/devel/ANNOTATION/jespinoz/anaconda/envs/midas_env/bin/run_midas.py
(midas_env) -bash-4.1$ which hs-blastn
/usr/local/devel/ANNOTATION/jespinoz/anaconda/envs/midas_env/bin/hs-blastn
(midas_env) -bash-4.1$ run_midas.py species -1 WATER-17B_P01-CTRL_BC-80_BR-2_S80_001.paired_trimmed.fna -t 4 tmp_output

Error: File not found: hs-blastn

From this https://github.com/snayfach/MIDAS/blame/master/midas/utility.py

def add_executables(args):
    """ Identify relative file and directory paths """
    src_dir = os.path.dirname(os.path.abspath(__file__))
    main_dir = os.path.dirname(src_dir)
    args['stream_seqs'] = '/'.join([src_dir, 'run', 'stream_seqs.py'])
    args['hs-blastn'] = '/'.join([main_dir, 'bin', platform.system(), 'hs-blastn'])
    args['bowtie2-build'] = '/'.join([main_dir, 'bin', platform.system(), 'bowtie2-build'])
    args['bowtie2'] = '/'.join([main_dir, 'bin', platform.system(), 'bowtie2'])
    args['samtools'] = '/'.join([main_dir, 'bin', platform.system(), 'samtools'])

What about using this instead as default? https://codereview.stackexchange.com/questions/123597/find-a-specific-file-or-find-all-executable-files-within-the-system-path

jolespin commented 5 years ago

I ended up doing this for the python2 installation b/c the python3 version had an io error with the TextIOWrapper in the snps module:

conda create --name midas2_env -c bioconda python=2.7 --yes

Then I changed this file:

nano /usr/local/devel/ANNOTATION/jespinoz/anaconda/envs/midas2_env/lib/python2.7/site-packages/midas/utility.py

to the following:

def add_executables(args):
        """ Identify relative file and directory paths """
        src_dir = os.path.dirname(os.path.abspath(__file__))
        main_dir = os.path.dirname(src_dir)
        bin_dir = "/" + os.path.join(*sys.executable.split("/")[:-1])
        args['stream_seqs'] = '/'.join([src_dir, 'run', 'stream_seqs.py'])
        args['hs-blastn'] = '/'.join([bin_dir,  'hs-blastn'])
        args['bowtie2-build'] = '/'.join([bin_dir,  'bowtie2-build'])
        args['bowtie2'] = '/'.join([bin_dir,  'bowtie2'])
        args['samtools'] = '/'.join([bin_dir,  'samtools'])
jolespin commented 5 years ago

If anyone needs this:

pip install git+https://github.com/jolespin/MIDAS