Metaphlan 4.2.4: TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

I am getting a TypeError when trying to run metaphlan and I suspect that its a bug.

Version:
metaphlan 4.2.4 installed through conda.
Python 3.11.15

Command:

metaphlan mysample.fastq --input_type fastq --db_dir metaphlan4_vJun23_202403 --index mpa_vJun23_CHOCOPhlAnSGB_202403  -t rel_ab_w_read_stats --force --offline --nproc 16 -s mysample.sam.bz2 -o mysample_taxprofile.tsv

Error:

File "…_/lib/python3.11/site-packages/metaphlan/metaphlan.py", line 2243, in check_params
   if args.force and os.path.exists(args.mapout):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "<frozen genericpath>", line 19, in exists
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Any insight into this error?

Hi @db61
Can you try adding —mapout bowtie.output to your command? It appears as if it’s trying to check the existence of this file even though it should check if the parameter was provided first.

Hi,

That fixed the problem.

Thanks!