how to convert feature ID to OTU?

hello,
I am working on qiime2-2024-5 for analysing my 16sRNA data. for that purpose, i used the following command:

qiime feature-classifier extract-reads \
  --i-sequences 99_otus.qza \
  --p-f-primer AACMGGATTAGATACCCKG \
  --p-r-primer ACGTCATCCCCACCTTCC \
  --o-reads ref-seqs.qza

then i got the following taxonomy file:

as well rep-seqs:


how is it possible to convert the feature ID into OTU?
thank you so much.

Hello @adamos1945,

I'm unsure what you mean by converting the feature IDs into OTUs--could you explain?

sorry for the for the trouble, as you can see the tables have feature ID as hash identifier: ```
8743b52063cd84097a65d1633f5c74f5, i would like to convert the ID to OTU such as OTU1, OTU2....
is it possible to do it through qiime2 for taxonomy table, OTU table and tree?
thank you for your help.

You can rename features using the feature-table plugin:
https://docs.qiime2.org/2024.5/plugins/available/feature-table/rename-ids/

But... this may be a bad idea!

thank you so mcuh for your help.
i could solve it through use of following commands:

awk '{gsub(/[^A-Za-z0-9_,:]/,""); split($0, arr, ","); for (i in arr) {split(arr[i], id, ":"); print id[1]}}' tree.nwk >feature_ids.txt
awk 'BEGIN {count=1} {print $1 "\tOTU" count++}' feature_ids.txt > otu_mapping.txt
awk 'NR==FNR {map[$1]=$2; next} {for (i in map) gsub(i, map[i])} 1' otu_mapping.txt tree.nwk > tree_with_otus.nwk

just curious, why is it a bad idea to convert the feature ID to OTU ID?

I suppose OTU1 and ASV2 are easier to write about in a publication. Brevity is clarity!

Why is renaming helpful to you?

Here's another thing to consider:

The linux command awk is great, but does not record any history.
Once you make the tree_with_otus.nwk file, it's provenance is gone!
We often answer questions by looking for clues in the Qiime2 artifact provenance history, if you use awk you are on your own.

1 Like