# Merge\_metaphlan\_tables.py error

**URL:** https://forum.biobakery.org/t/merge-metaphlan-tables-py-error/6092
**Category:** MetaPhlAn
**Created:** [October 18, 2023, 6:12pm UTC](https://forum.biobakery.org/t/merge-metaphlan-tables-py-error/6092 "2023-10-18T18:12:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nelly](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/nelly/32/1718_2.png) [@Nelly](https://forum.biobakery.org/u/Nelly)
#### Post date: [October 18, 2023, 6:12pm UTC](https://forum.biobakery.org/t/merge-metaphlan-tables-py-error/6092/1 "2023-10-18T18:12:54Z")

</div>

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.

```auto
 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?

---

<div class="post-metadata">

### Author: ![aitor.blancomiguez](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/aitor.blancomiguez/32/86_2.png) [@aitor.blancomiguez](https://forum.biobakery.org/u/aitor.blancomiguez)
#### Post date: [March 5, 2024, 9:25am UTC](https://forum.biobakery.org/t/merge-metaphlan-tables-py-error/6092/2 "2024-03-05T09:25:26Z")

</div>

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