# Merge\_metaphlan\_tables.py

**URL:** <https://forum.biobakery.org/t/merge-metaphlan-tables-py/2811>\
**Category:** MetaPhlAn\
**Created:** [November 18, 2021, 8:09am UTC](https://forum.biobakery.org/t/merge-metaphlan-tables-py/2811 "2021-11-18T08:09:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelly](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@kelly](https://forum.biobakery.org/u/kelly)\
**Post date:** [November 18, 2021, 8:09am UTC](https://forum.biobakery.org/t/merge-metaphlan-tables-py/2811/1 "2021-11-18T08:09:58Z")

</div>

Hi there,

I tried to merge metaphlan outputs into a table, however I’ve gotten this error. I’m not sure what went wrong.  
The script that I input here was: merge\_metaphlan\_tables.py \*.tsv \> merged\_abundance\_table.tsv

The metaphlan version that I was using is: MetaPhlAn version 3.0.13 (27 Jul 2021)  
**The error was as follows:**

merge\_metaphlan\_tables.py \*.tsv \> merged\_abundance\_table.tsvTraceback (most recent call last):  
File “/home/suetli/miniconda3/envs/mpa/bin/merge\_metaphlan\_tables.py”, line 10, in   
sys.exit(main())  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/merge\_metaphlan\_tables.py”, line 78, in main  
merge(args.aistms, sys.stdout)  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/merge\_metaphlan\_tables.py”, line 47, in merge  
usecols=range(3),  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/util/\_decorators.py”, line 311, in wrapper  
return func(\*args, \*\*kwargs)  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/readers.py”, line 586, in read\_csv  
return \_read(filepath\_or\_buffer, kwds)  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/readers.py”, line 482, in \_read  
parser = TextFileReader(filepath\_or\_buffer, \*\*kwds)  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/readers.py”, line 811, in **init**  
self.\_engine = self.\_make\_engine(self.engine)  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/readers.py”, line 1040, in \_make\_engine  
return mapping[engine](self.f, \*\*self.options) # type: ignore[call-arg]  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/c\_parser\_wrapper.py”, line 152, in **init**  
self.names, # type: ignore[has-type]  
File “/home/suetli/miniconda3/envs/mpa/lib/python3.7/site-packages/pandas/io/parsers/base\_parser.py”, line 867, in \_validate\_usecols\_names  
f"Usecols do not match columns, columns expected but not found: "  
ValueError: Usecols do not match columns, columns expected but not found: [0, 1, 2]

And here’s the input metaphlan table files that I am trying to merge:  
[metaphlan\_taxonomic\_profiles\_donor.tsv](https://forum.biobakery.org/uploads/short-url/hB5UPO1a8g0tnMl4CyNgKfYmemM.tsv) (29.9 KB)  
[metaphlan\_taxonomic\_profiles\_postFMT.tsv](https://forum.biobakery.org/uploads/short-url/AmdkZU8KfTBRG0MdQBnz1PNQyKR.tsv) (29.0 KB)  
[metaphlan\_taxonomic\_profiles\_preFMT.tsv](https://forum.biobakery.org/uploads/short-url/7Tu2ROLDNHm2Fv3pl6jnOt1KOA6.tsv) (19.4 KB)

Any help will be much appreciated! Thanks!

Regards,  
Kelly
