DessimozLab / read2tree

a tool for inferring species tree from sequencing reads
MIT License
138 stars 18 forks source link

Error with ngm binary #23

Open 3miumi opened 1 year ago

3miumi commented 1 year ago

Hi,

I successfully installed the read2tree on my ubuntu server. And run the command

ead2tree --tree --standalone_path /marker_genes/ --reads W_001.fastq.gz W_001.fastq.gz  --output_path output

It gave me error with

Traceback (most recent call last):
  File "/home/ming/miniconda3/envs/myenv/bin/read2tree", line 4, in <module>
    __import__('pkg_resources').run_script('read2tree==0.1.5', 'read2tree')
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 665, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1470, in run_script
    exec(script_code, namespace, namespace)
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/EGG-INFO/scripts/read2tree", line 16, in <module>
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/main.py", line 357, in main
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/Mapper.py", line 80, in __init__
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/Mapper.py", line 290, in _map_reads_to_references
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/Mapper.py", line 101, in _call_wrapper
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/wrappers/read_mappers/ngm.py", line 37, in __init__
  File "/home/ming/miniconda3/envs/myenv/lib/python3.6/site-packages/read2tree-0.1.5-py3.6.egg/read2tree/wrappers/read_mappers/base_mapper.py", line 77, in __init__
read2tree.wrappers.WrapperError: Error searching for binary: ngm

Can you please help me with this issue?

Thanks, Ming

alpae commented 1 year ago

you're missing the ngm tool. We recommend installing read2tree via conda (see https://github.com/DessimozLab/read2tree#1-installation-using-conda) as it installs the dependent tools as well. More information on ngm and how to install without conda can be found here: https://github.com/Cibiv/NextGenMap

sinamajidian commented 1 year ago

In addition to Adrian's respond, I would like to mention that you can check whether ngm is installed correctly by running it in terminal

$ ngm
[MAIN] NextGenMap 0.5.5
Usage:  ngm [-c <path>] {-q <reads> [-p] | -1 <mates 1> -2 <mates 2>} -r <reference> -o <output> [parameter]

Besides, I can see that you are using python 3.6, however we suggest using python 3.10.

3miumi commented 1 year ago

Thank you for your reply! I tried your instruction and succesfully installed it. But when I run a ecoli sample against ecoli gene_marker, it gives me this error. Can you please help me with it?

$ read2tree --tree --standalone_path marker_genes/ --reads Q1.fastq Q2.fastq --output_put output/                                                                                            
[E::hts_open_format] Failed to open file "/tmp/ngm_xsqy3ygg/ECOLI_OGs_post_sorted.bam" : No such file or directory
Mapping reads to species:   0%|                                                                                                                                 | 0/2 [02:50<?, ? species/s]
Traceback (most recent call last):
  File "/home/ming/miniconda3/envs/r2t/bin/read2tree", line 4, in <module>
    __import__('pkg_resources').run_script('read2tree==0.1.5', 'read2tree')
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/pkg_resources/__init__.py", line 720, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1570, in run_script
    exec(script_code, namespace, namespace)
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/EGG-INFO/scripts/read2tree", line 16, in <module>
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/main.py", line 293, in main
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/Mapper.py", line 80, in __init__
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/Mapper.py", line 289, in _map_reads_to_references
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/Mapper.py", line 138, in _call_wrapper
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/Mapper.py", line 570, in _post_process_read_mapping
  File "/home/ming/miniconda3/envs/r2t/lib/python3.10/site-packages/read2tree-0.1.5-py3.10.egg/read2tree/Mapper.py", line 498, in _build_consensus_seq_v2
  File "pysam/libcalignmentfile.pyx", line 747, in pysam.libcalignmentfile.AlignmentFile.__cinit__
  File "pysam/libcalignmentfile.pyx", line 946, in pysam.libcalignmentfile.AlignmentFile._open
FileNotFoundError: [Errno 2] could not open alignment file `/tmp/ngm_xsqy3ygg/ECOLI_OGs_post_sorted.bam`: No such file or directory
sinamajidian commented 1 year ago

I'm glad you installed read2tree. I'm wondering whether you ran test dataset to make sure package is installed successfully. This situation can happen when there are not enough mapped reads to the reference gene markers. Could you please tell us what are reference species and the outgroup you used and how many OGs are in the 01_ref_ogs_aa & number of genes in one them? We would be also happy to debug your case if you could share with us your sequencing reads Q1/Q2 and gene_markers. (You can email us as well sina.majidian@unil.ch)

Best regards, Sina