Metaphlan 4 error: nreads, avg_read_length = list(map(float, read_fastx_stderr[0].decode().split()))

Hello,

I was trying to use metaphlan4 to parse some metagenomics fastq files. Those files were ran successfully with metaphlan3. However, when using metaphlan4, I faced the following error:

Traceback (most recent call last):
File “/N/u/dongq/Carbonate/.local/bin/metaphlan”, line 8, in
sys.exit(main())
File “/N/u/dongq/Carbonate/.local/lib/python3.9/site-packages/metaphlan/metaphlan.py”, line 1077, in main
run_bowtie2(pars[‘inp’], pars[‘bowtie2out’], pars[‘bowtie2db’],
File “/N/u/dongq/Carbonate/.local/lib/python3.9/site-packages/metaphlan/metaphlan.py”, line 445, in run_bowtie2
nreads, avg_read_length = list(map(float, read_fastx_stderr[0].decode().split()))
IndexError: list index out of range

I checked the bowtie2.bz2 output, and the output didn’t have the last line starting with “#nreads”. The fastq files are ok and they could run through metaphlan3. The metaphlan3 outputs of these fastq files had the last like with “#nreads”.

The command I used was:

metaphlan FQ1.fastq,FQ2.fastq --input_type fastq --nproc 8 --unclassified_estimation -t rel_ab_w_read_stats --bowtie2out test.bowtie2.bz2 -o test_profile.txt

I really appreciate it if you could help with this!

Hi @dongq
By the problem you describe it seems the Bowtie2 execution did not finish correctly and so the bowtie2out file is incomplete. MetaPhlAn 4 mapping does require around 15-16GB of RAM available to be run, could it be a problem of lack of memory?

Thank you so much! @aitor.blancomiguez This did seemed like a memory issue. I tried to split the steps (make sam/bowtie2 output first, then run metaphlan), and it worked.