Merge_metaphlan_tables.py error

Hello,

I processed my dataset by MetaPhlAn 4.0.6, and tried to merge the profiled output files by using merge_metaphlan_table.py.

This is commands I entered.

find host -name "*unmapped.1.fastq" | cut -d "." -f1 | parallel -j 1 'metaphlan {}\.unmapped.1.fastq {}\.unmapped.2.fastq --input_type fastq -t rel_ab_w_read_stats --bowtie2db metaphlan_database --ignore_eukaryotes --ignore_archaea > {}\.output.txt'

find host -name "*.unmapped.1.fastq.bowtie2out.txt" | cut -d "." -f1 | parallel -j 1 '/usr/local/bin/merge_metaphlan_tables.py {}\.unmapped.1.fastq.bowtie2out.txt > merged_abundance_table.txt'

The metaphlan_database was downloaded using this command:

metaphlan --install

Then, I got the error message returned.

 File "/usr/local/bin/merge_metaphlan_tables.py", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/metaphlan/utils/merge_metaphlan_tables.py", line 73, in main
    merge(args.aistms, open(args.o, 'w') if args.o else sys.stdout, args.gtdb_profiles)
  File "/usr/local/lib/python3.9/dist-packages/metaphlan/utils/merge_metaphlan_tables.py", line 27, in merge
    listmpaVersion.add(headers[0])
IndexError: list index out of range

This is head of MetaPhlAn output files.

SRR7986794.808/1__1.42 UniRef90_A0A0F4LSP4|1__20|SGB7028 SRR7986794.889/1__1.49 UniRef90_A0A0F4L0W9|1__15|SGB7138 SRR7986794.361/1__1.17 UniRef90_A0A0F4LCS6|1__9|SGB7032 SRR7986794.505/1__1.23 UniRef90_X2H935|1__9|SGB9492 SRR7986794.707/1__1.35 UniRef90_A0A347SRD0|2__11|SGB7138 SRR7986794.1457/1__1.80 UniRef90_A0A0F4LFR3|1__13|SGB7032 SRR7986794.1665/1__1.95 UniRef90_A0A0F4KND6|1__12|SGB7138 SRR7986794.2262/1__1.129 UniRef90_A0A0F4KRC0|1__11|SGB7138 SRR7986794.2569/1__1.143 UniRef90_A0A080KLR3|1__14|SGB9620 SRR7986794.3822/1__1.214 UniRef90_A0A0F4LL78|5__14|SGB7032

I compared the MetaPhlAn output of my files with others, and the key difference is that mine lacks header. Can this cause the error?

Hi @Nelly
Metaphlan_merge_tables.py will not work with the bowtie2out files. It is made to merge the final profile tables