.table format conversion to .csv

Hi everyone,

I'm trying to use a repository online for learning purposes and I found that the relative abundance OTU table is in a ".table" format I do not know how to open. Does anyone know how to? I'm used to the format used in QIIME2 (I'm also a beginner in coding).

If you have a code to change the format to .csv I would greatly appreciate it!

Thank you for your help!
Malena

Hi @malenaamer

The table.qza artifact (which is the file to which you’re referring) first needs to be unzipped. Inside, you’ll find a ‘feature-table.biom’ file.

You can then convert this file into a csv following these commands.

In the command line, first make sure you have biom-format installed:

pip install biom-format

Then use this command:

biom convert -i feature-table.biom -o feature-table.csv --to-tsv

Finally, convert that tsv to csv either by changing the extension (via renaming) OR using this command using Python:

import pandas as pd

Read the TSV file

tsv_file = 'feature-table.csv'
df = pd.read_csv(tsv_file, sep='\t')

Write to CSV file

csv_file = 'feature-table.csv'
df.to_csv(csv_file, index=False)

This will ensure that your file is in the correct format.

I hope this helps, good luck!

1 Like