# Keep ASV IDs when converting to relative abundance

**URL:** https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995
**Category:** General Discussion
**Tags:** biom, relative-frequency, feature-table
**Created:** [March 31, 2023, 6:58pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995 "2023-03-31T18:58:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![emmlemore](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/e/e9c0ed/32.png) [@emmlemore](https://forum.qiime2.org/u/emmlemore)
#### Post date: [March 31, 2023, 6:58pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/1 "2023-03-31T18:58:24Z")

</div>

Hi there,

I am trying to convert the feature table that has taxonomy over to relative abundance. I was able to do this successfully by following [this](https://forum.qiime2.org/t/relative-abundances-of-taxonomy-analysis/4939).

I converted the .biom table to a .tsv table that shows the taxonomy and the relative abundance. However, how do I get the ASV IDs? For instance for this bacterium: d\_\_Bacteria;p\_\_Bdellovibrionota;c\_\_Bdellovibrionia;o\_\_Bacteriovoracales;f\_\_Bacteriovoracaceae;g\_\_Peredibacter

I would like to know the ASV ID (e.g., ASV4, ASV30, ASV492).

Thank you.

---

<div class="post-metadata">

### Author: ![Mehrbod\_Estaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/mehrbod_estaki/32/4001_2.png) [@Mehrbod\_Estaki](https://forum.qiime2.org/u/Mehrbod_Estaki)
#### Post date: [March 31, 2023, 10:00pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/2 "2023-03-31T22:00:41Z")

</div>

Hi @emmlemore,  
If you are following the instructions in that link you provided, you can't get the ASV IDs anymore. Over there, we collapsed the ASVs into a higher level (Phyla, Genera etc.), once we do that you can't revert back to an ASV table, thus losing the feature-ids in their ASV resolution.

If you give us a bit more info on what you are specifically looking to achieve perhaps we can help come up with a different solution.

---

<div class="post-metadata">

### Author: ![emmlemore](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/e/e9c0ed/32.png) [@emmlemore](https://forum.qiime2.org/u/emmlemore)
#### Post date: [April 3, 2023, 1:21pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/3 "2023-04-03T13:21:06Z")

</div>

Hi @Mehrbod_Estaki

Okay so I am trying to follow along [here](https://forum.qiime2.org/t/exporting-and-modifying-biom-tables-e-g-adding-taxonomy-annotations/3630) but I am a bit lost as to what the files are in terms of conversion

So after assigning taxonomy, I performed the following to get the taxonomy at the genus level:  
qiime taxa collapse  
--i-table /home/Rocks/outputs/qza\_intermediates/rocks16S\_table.qza  
--i-taxonomy /home/Rocks/outputs/qza\_intermediates/rocks16S\_taxonomy.qza  
--p-level 6  
--o-collapsed-table genus16S\_table.qza

Then converted that file into the relative frequency table:  
qiime feature-table relative-frequency  
--i-table genus16S\_table.qza  
--o-relative-frequency-table genus16S\_relabund\_table.qza

Then converted that relative abundance file into a BIOM file:  
qiime tools export  
--input-path genus16S\_relabund\_table.qza  
--output-path genus16S\_relabund

Then converted the BIOM file into a TSV file:  
biom convert -i 16S\_relabund.biom -o 16S\_relabund.tsv --to-tsv

This is what the TSV file currently looks like:

 ![Screenshot from 2023-04-03 10-23-06](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/f/f31c220e12e4c831cc65a0fc57ef7426549e3616.png)

But this is what I want it to look like:

 ![Screenshot from 2023-04-03 10-01-48](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/c/cb4ad6e5a4c6db7db15dfb7a0d41ec67274ccd3b.png)

From the tutorial linked above, it seems the feature IDs are kept as random letters and numbers (e.g., 4b5eeb300368260019c1fbc7a3c718fc) instead of ASV1.

Please advise. Thank you for your time. 🙂

---

<div class="post-metadata">

### Author: ![emmlemore](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/e/e9c0ed/32.png) [@emmlemore](https://forum.qiime2.org/u/emmlemore)
#### Post date: [April 3, 2023, 2:30pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/5 "2023-04-03T14:30:02Z")

</div>

Hi @Mehrbod_Estaki

I started over with the original table.qza file and followed the tutorial linked above and was able to get the Feature table with taxonomy. However, the Feature ID is still gibberish instead of "ASV1, ASV2" etc. I saw [this](https://forum.qiime2.org/t/rename-the-feature-id-as-asv1-asv2/25575) where you said it's not a good idea to rename them. I guess I can create a separate column and name ASV1, ASV2 manually beside each Feature ID so that each Feature ID is still retained. However, I have lost the relative abundance count that was outputted with the `taxa collapse` command.

How do I convert to relative abundance with the new table-with-taxonomy.biom/table-with-taxonomy.tsv file? The taxa collapse command is only allowed the table.qza and taxonomy.qza inputted as artifacts...

Please advise, thank you. 🙂

---

<div class="post-metadata">

### Author: ![gregcaporaso](https://forum.qiime2.org/user_avatar/forum.qiime2.org/gregcaporaso/32/17769_2.png) [@gregcaporaso](https://forum.qiime2.org/u/gregcaporaso)
#### Post date: [April 3, 2023, 9:11pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/6 "2023-04-03T21:11:44Z")

</div>

Hi @emmlemore, You can convert your ASV feature table to relative frequency using the command:

```auto
qiime feature-table relative-frequency

```

That will give you the relative frequency with the sequence hash ids. (A note on those ids: while they look like gibberish, the same ASV sequence will always result in the same id. That makes it possible to relate feature ids across studies, as long as the same primers and trim/truncation parameters are used.)

Does this get you closer to what you're looking for?

---

<div class="post-metadata">

### Author: ![emmlemore](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/e/e9c0ed/32.png) [@emmlemore](https://forum.qiime2.org/u/emmlemore)
#### Post date: [April 4, 2023, 12:29pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/8 "2023-04-04T12:29:03Z")

</div>

Hi @gregcaporaso

I was able to get the outputted relative frequencies. However, I am a little confused about this calculation. When I downloaded the absolute values, I was able to get the relative abundance like so: (feature ID frequency / total frequencies for each sample) x 100. The sum of each column was 100.

However when I performed `qiime feature-table relative-frequency` it appears it only performs this: feature ID frequency / total frequencies for each sample. The sum of each column was 1. And according to the usage definition [here](https://docs.qiime2.org/2023.2/plugins/available/feature-table/relative-frequency/) it says "Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample."

So is relative frequency different from relative abundance? Why is it not multiplied by 100 to get a %?

Thank you.

---

<div class="post-metadata">

### Author: ![gregcaporaso](https://forum.qiime2.org/user_avatar/forum.qiime2.org/gregcaporaso/32/17769_2.png) [@gregcaporaso](https://forum.qiime2.org/u/gregcaporaso)
#### Post date: [April 5, 2023, 8:54pm UTC](https://forum.qiime2.org/t/keep-asv-ids-when-converting-to-relative-abundance/25995/11 "2023-04-05T20:54:35Z")

</div>

@emmlemore, having the values sum to 1.0 or 100 are just two ways of representing the exact same information (just as a fraction or a percentage, respectively).
