How do I get a table of frequencies of each feature per sample?


I am trying to get a relative abundance table similar to in QIIME1 where each sample (and the metadata for each sample is included) has the relative abundance of each taxa. The answers I have seen on the forum get me part way, but not all the way there or maybe I am missing something?

Any help is much appreciated,

Hi @kmkalanetra,

I think you’re looking for qiime taxa collapse. But I’m not sure what you mean by this:

Specifically the metadata part. Could you elaborate a little bit on your goals? What are you looking to do with your data (or what you’d use for)? I suspect you could use qiime feature-table group to get your sample metadata involved in the situation, but I don’t know enough about what you are trying to do to say for sure.


1 Like

Hi Evan,

Thank you for your response. I have used qiime taxa collapse, but it does not compile the information exactly the same way as - so if I want a spreadsheet that I can use with something like LEfSe how would I make that in QIIME2? What I'm talking about is a spreadsheet with the relative abundance of each taxa per sample. I could add on the metadata myself so I'm not that concerned about that part. Something like this:

Thank you!

Hey @kmkalanetra,

I think this post should accomplish what you need! Although you’ll probably need to transpose it in your favourite spreadsheet program to match your screenshot. Also if it’s important that the data be relative abundance, then you can use qiime feature-table relative-frequency to convert from plain frequency before following the above post.

Let me know if that works for you!


That worked, but the result doesn't include taxonomic IDs, but OTU IDs. For me, part of the strength of the results of the was the way the taxonomy was broken down. Is there a way to get this information in combination with the feature-table?

03 PM

Thank you!

Hi @kmkalanetra --- I might be misunderstanding your question, but have you had a chance to look at taxa barplot --- specifically the CSV export?

The CSV looks like this:

L2S155,16.0,0.0,4096.0,ACGATGCGACCA,GTGCCAGCMGCCGCGGTAA,left palm,2009,1,20,subject-1,No,84,subject-1.left-palm.2009-1-20

This looks pretty similar to your first screenshot, except that the counts aren't relative abundances, but you could calculate that in your spreadsheet software (just looking at way to get you moving right away on your problem).

It is worth noting, the CSV is different at each taxonomic level (the barplot viz runs collapse behind the scenes).

Apologies if I missed the mark here. Thanks! :t_rex:

No, that’s exactly what I was looking for. Thank you!

I do have to say that I still like the taxa format of the better than this way. Just saying… :slight_smile:

Thanks for everyone’s help,


An off-topic reply has been split into a new topic: Normalization necessary when converting to relative frequencies?

Please keep replies on-topic in the future.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.