MetaPhlAn v4 No such file or directory

Hi!

I am getting some unexpected behavior. I am trying to profile a paired-end sample and I am getting the following error:

Traceback (most recent call last):
File “/home/stelios/miniconda3/envs/metaphlan/bin/read_fastx.py”, line 10, in
sys.exit(main())
File “/home/stelios/miniconda3/envs/metaphlan/lib/python3.10/site-packages/metaphlan/utils/read_fastx.py”, line 168, in main
f_nreads, f_avg_read_length = read_and_write_raw(f, opened=False, min_len=min_len, prefix_id=prefix_id)
File “/home/stelios/miniconda3/envs/metaphlan/lib/python3.10/site-packages/metaphlan/utils/read_fastx.py”, line 129, in read_and_write_raw
with fopen(fd) as inf:
File “/home/stelios/miniconda3/envs/metaphlan/lib/python3.10/site-packages/metaphlan/utils/read_fastx.py”, line 54, in fopen
return gzip.open(fn, “rt”)
File “/home/stelios/miniconda3/envs/metaphlan/lib/python3.10/gzip.py”, line 58, in open
binary_file = GzipFile(filename, gz_mode, compresslevel)
File “/home/stelios/miniconda3/envs/metaphlan/lib/python3.10/gzip.py”, line 174, in init
fileobj = self.myfileobj = builtins.open(filename, mode or ‘rb’)
FileNotFoundError: [Errno 2] No such file or directory: ‘~/forewarn/merged/15_S16_L001_R2_001.fastq.gz’

I tried running the analysis on the reverse read only to verify there is nothing wrong with the fastq file it self and it completed with no problem. I have also analyzed an earlier paired-end sample with no problem. Any idea what might be causing this behavior?

Thanks,
Stelios

It seems to have been caused by using the home folder ~ symbol (?) in the file paths. So for the first dataset I used a relative path and run OK. It also seems to run fine for the first file in the command (the forward read) no matter how the path is typed, and only crashes when trying to access the reverse read file. I got the exact same behavior on MetaPhlAn3. I have not tried using the full path starting from root.

Edit: Messed up the terminology.