How to retreive sequence from a specific taxonomic assignment ?

Hello. I performed a taxonomic assignment on my data. I need to investigate on certain sequence; I need to retreive sequence from a specific taxonomic assignment from a specific sample.

Is it possible ? and if yes how ?

Thanks in advance

Hi @nbargues,

Disclaimer: I’m not part of the official QIIME 2 team, so my approach may not reflect the most appropriate way. I’m just trying to share what I know :slight_smile:

Yes, it’s possible! To do this, you need a taxonomy file (which provides the mapping from feature ID to taxonomy classification) and a representative-sequence file (which provides the mapping from ASV sequence to feature ID). Therefore, if you have these two files, you can go from taxonomy classification to feature ID to ASV sequence.

If you need to do this only for few sequences, you can do this by hand with Visualization files. Using the famous “Moving Pictures” tutorial as example, you can first look up the taxonomy.qzv file to identify the feature ID of the taxon of interest. For instance, say you are interested in the taxon k__Bacteria; p__Bacteroidetes; c__Bacteroidia; o__Bacteroidales; f__Bacteroidaceae; g__Bacteroides; s__uniformis. This classification is for the feature ID: 0305a4993ecf2d8ef4149fdfc7592603 . Now you open the rep-seqs.qzv file and search for the feature ID, which gives the following sequence: TACGGAGGATCCGAGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGTAGGCGGACGCTTAAGTCAGTTGTGAAAGTTTGCGGCTCAACCGTAAAATTGCAGTTGATACTGGGTGTCTT.

Now, if you have to do this for many sequences, you might as well just create the mapping for all of the taxonomy classifications. You can easily do this with the tax2seq command I wrote in the Dokdo package. Instead of Visualization files, you will need Artifact files (i.e. taxonomy.qza and rep-seqs.qza instead of taxonomy.qzv and rep-seqs.qzv). Check it out if you’re interested. (I once had to do the same for a number of different projects.)

Hope this helps!

1 Like

The quickest way will be to use qiime metadata tabulate to visualize your taxonomy and sequences together in a searchable table. See the example here:
https://docs.qiime2.org/2020.8/tutorials/metadata/#exploring-feature-metadata

That will allow you to search by taxonomy (or other search terms, e.g., ID) to retrieve the associated sequence for each feature assigned that taxonomy.

1 Like

I didn’t know about this functionality! Good to know.

1 Like

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