Metaphlan3 running problem UnboundLocalError

I had an error when running metaphlan3 in the first step.
My command is “metaphlan SRR7563636_1.fastq,SRR7563636_2.fastq --input_type fastq -s sams/SRR7563636.sam.bz2 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636_profile.tsv”.

But it reported,
Downloading https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1

Warning: Unable to download https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1
Traceback (most recent call last):
File “/gpfs/share/apps/python/cpu/3.6.5/bin/metaphlan”, line 8, in
sys.exit(main())
File “/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/metaphlan/metaphlan.py”, line 916, in main
pars[‘index’] = check_and_install_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2_build’], pars[‘nproc’], pars[‘force_download’])
File “/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/metaphlan/init.py”, line 271, in check_and_install_database
index = resolve_latest_database(bowtie2_db, ls_f[‘mpa_latest’], force_redownload_latest)
UnboundLocalError: local variable ‘ls_f’ referenced before assignment

I can’t download the database by dropbox on our public server.
Is there any way to solve or bypass this problem? For example, could I download the file and deposit it under some directory? Thank you so much!

Yes, you can download the database from Zenodo
https://zenodo.org/record/3957592#.XzYjcB7RZ-E

and run MetaPhlan with the -x mpa_v30_CHOCOPhlAn_201901 parameter.
You probably should update your installation, the latest version (3.0.2) automatically retrieves the database from Zenodo if Dropbox fails.

1 Like

Thank you so much!!! I will try it.

Hi,
Sorry to bother you.
I download the database and deposited it under the path “/gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901”.
I have tried to specify the database by using

  1. “metaphlan SRR7563636_1.fastq,SRR7563636_2.fastq --input_type fastq -s sams/SRR7563636.sam.bz2 –bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901 -x mpa_v30_CHOCOPhlAn_201901 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636_profile.tsv”
  2. “metaphlan SRR7563636_1.fastq,SRR7563636_2.fastq --input_type fastq -s sams/SRR7563636.sam.bz2 -x mpa_v30_CHOCOPhlAn_201901 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636_profile.tsv”
  3. “metaphlan SRR7563636_1.fastq,SRR7563636_2.fastq --input_type fastq -s sams/SRR7563636.sam.bz2 –bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636_profile.tsv”

However, none of these commands worked. The tutorial just said, “Just download the .tar, .md5, and the mpa_latest files and place them in the metaphlan_databases folder.”
So, where should I deposit the database? How can I let the metaphlan know where to find the database?
Thank you so much!

Have you built the database with bowtie2-build?

Yes, I have built the database under “/gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901” and obtained “mpa_v30_CHOCOPhlAn_201901.1.bt2”. But when I ran “metaphlan SRR7563636_1.fastq,SRR7563636_2.fastq --input_type fastq -s sams/SRR7563636.sam.bz2 –bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901 --index mpa_v30_CHOCOPhlAn_201901 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636_profile.tsv”, it still reported the following error.

Downloading

Warning: Unable to download
No MetaPhlAn BowTie2 database found (–index option)!
Expecting location /gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901/mpa_v30_CHOCOPhlAn_201901
Exiting…

Due to some internet safety issues, the metaphlan can’t automatically download the database. So where should I deposit the built database? How should I name the folder that contains the database?
Thank you so much for your kindly help!

Is it the only file you got? You should have six .bt2 files in the “/gpfs/data/lilab/home/zhoub03/software/metaphlan3_database/mpa_v30_CHOCOPhlAn_201901” folder

Thank you so much! The bowtie reference was not completely generated. Now, this problem has been solved.