MetaPhlAn v3 FileNotFoundError: [Errno 2] No such file or directory: ''

I am getting an error trying to use the latest version of MetaPhlAn. I am using a HPC so I downloaded the DB into a local directory (…/metaphlan_databases). I am also using paired end reads.

This is the command I run:

metaphlan $SAMPLE_r1, $SAMPLE_r2 --bowtie2out $sample'_metagenome.bowtie2.bz2' --bowtie2db ../metaphlan_databases --nproc $nThreads --input_type fastq -o $sample'_profiled_metagenome.txt'

The output:

Warning: gzbuffer added in zlib v1.2.3.5. Unable to change buffer size from default of 8192.
Traceback (most recent call last):
  File "/apps/software/gcc-6.2.0/python/3.5.3/bin/read_fastx.py", line 11, in <module>
    load_entry_point('MetaPhlAn==3.0', 'console_scripts', 'read_fastx.py')()
  File "/apps/software/gcc-6.2.0/python/3.5.3/lib/python3.5/site-packages/MetaPhlAn-3.0-py3.5.egg/metaphlan/utils/read_fastx.py", line 155, in main
    nreads += read_and_write_raw(f, opened=False, min_len=min_len)
  File "/apps/software/gcc-6.2.0/python/3.5.3/lib/python3.5/site-packages/MetaPhlAn-3.0-py3.5.egg/metaphlan/utils/read_fastx.py", line 118, in read_and_write_raw
    with fopen(fd) as inf:
  File "/apps/software/gcc-6.2.0/python/3.5.3/lib/python3.5/site-packages/MetaPhlAn-3.0-py3.5.egg/metaphlan/utils/read_fastx.py", line 53, in fopen
    return open(fn)
FileNotFoundError: [Errno 2] No such file or directory: ''

Database info:>

[jfessler@cri16cn215 results]$ du -h  ../metaphlan_databases/*
0       ../metaphlan_databases/file_list.txt
0       ../metaphlan_databases/mpa_latest
601M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.1.bt2
286M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.2.bt2
10M     ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.3.bt2
286M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.4.bt2
342M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.fna.bz2
0       ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.md5
25M     ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.pkl
601M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.rev.1.bt2
286M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.rev.2.bt2
367M    ../metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.tar

Session info:

Currently Loaded Modules:
  1) gcc/6.2.0   2) zlib/1.2.8   3) tbb/2017   4) perl/5.24.0   5) bowtie2/2.3.4.3   6) bzip2/1.0.6   7) python/3.5.3   8) metaphlan/3.0

[jfessler@cri16cn215 results]$ metaphlan --version
MetaPhlAn version 3.0 (20 Mar 2020)

In the command line, you have a space between the comma and $SAMPLE_r2. You shouldn’t have space since the input files should be given by a comma-separated list.

Ah, well that was a silly mistake on my part. Thanks for the quick response! One other question–

metaphlan $SAMPLE_r1,$SAMPLE_r2 --bowtie2out $sample'_metagenome.bowtie2.bz2' --bowtie2db ../metaphlan_databases --nproc $nThreads --input_type fastq --unknown_estimation -o $sample'_profiled_metagenome.txt'

Gives me:

 Warning: gzbuffer added in zlib v1.2.3.5. Unable to change buffer size from default of 8192.
 
 Error, input data has to be in fastq or fasta format

But this runs successfully:
metaphlan $SAMPLE_r1 --bowtie2out $sample'_metagenome.bowtie2.bz2' --bowtie2db ../metaphlan_databases --nproc $nThreads --input_type fastq --unknown_estimation -o $sample'_profiled_metagenome.txt'

Is there something else I am missing?

I’ve already encountered an error like this on our HPC, if I remember correctly, this should be correlated with the zlib version.
If you pipe in the metagenome using zcat, you shouldn’t have the warning.

I thought that might be the answer for the work around, but wanted to check if I was making another dumb syntax mistake :upside_down_face: Thank you again!