The bioBakery help forum

Merge_metaphlan_tables.py

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 (29.9 KB)
metaphlan_taxonomic_profiles_postFMT.tsv (29.0 KB)
metaphlan_taxonomic_profiles_preFMT.tsv (19.4 KB)

Any help will be much appreciated! Thanks!

Regards,
Kelly