Filter OTU table to generate a smaller phylogenetic tree file

Hi all,

I am a new user and trying to follow the tutorial to do some useful analysis. I followed the moving picture tutorial and generated a newick tree file. When I tried the visualization of this tree, everything was shown hence it was impossible to read.

I searched online and found these links;
filter_otus_from_otu_table.py and Filtering Taxa from OTU-Table. It seems like that it is possible to filter the OTU based on the observation and get a smaller file with way less OTUs. But those scripts seemed to be for QIIME instead of QIIME 2. I am wondering if I can do the same thing with QIIME 2. Or if I am totally on the wrong track, please let me know as well!

Thank you so much for any help! Much appreciated!

Good morning,

Yes, this functionality it also in Qiime 2, but now these ‘scripts’ are called ‘plugins’. Check out these two plugins.

Filter down to a smaller group of taxonomy to show in the tree. https://docs.qiime2.org/2018.4/plugins/available/taxa/filter-table/

Filter out the less abundant features to show only the most abundant features:
https://docs.qiime2.org/2018.4/plugins/available/feature-table/filter-features/

Let me know if these scripts work well for you!
Colin

3 Likes

Thank you so much for your reply! I will try them out and get back to you. Thank you!

Hi, Colin, thank you so much for your input! I checked these docs out. Really helpful!

If I choose to remove the samples of a total abundance less than 10, I did:
qiime feature-table filter-features
–i-table table.qza
–p-min-frequency 10
–o-filtered-table feature-frequency-filtered-table.qza
Then I got a new feature table after this.

I am wondering if there is a way to get the corresponding sequences (a new rep-seqs.qza file) of this new feature table to make the unrooted and rooted tree.

Thank you so much (and anyone who sees this)!

Regards,
Anranzhilv

1 Like

Hi there @anranzhilv!

Yep! Check out feature-table filter-seqs! In particular, you can provide a feature table as input, and it will filter the sequences down to just those features present in the feature table. Hope that helps! :t_rex: :qiime2:

3 Likes

Great!! Thank you so much! I think this is what I need. I will keep working on it! You guys are awesome!

1 Like

Hi thermolarst! Thanks for your help earlier!

I managed to filter based on the abundance (less than 5000) with this:

qiime feature-table filter-features \
  --i-table table.qza \
  --p-min-frequency 5000 \
  --o-filtered-table feature-frequency-filtered-table.qza

Then use this to get the corresponding sequences:

qiime feature-table filter-seqs \
  --i-data rep-seqs.qza \
  --i-table sample-frequency-filtered-table.qza \
  --o-filtered-data filtered-rep-seqs.qza

Get the tree with the new files (I rename the filtered one as rep-seqs.qza):

qiime alignment mafft \
  --i-sequences rep-seqs.qza \
  --o-alignment aligned-rep-seqs.qza
qiime alignment mask \
  --i-alignment aligned-rep-seqs.qza \
  --o-masked-alignment masked-aligned-rep-seqs.qza
qiime phylogeny fasttree \
  --i-alignment masked-aligned-rep-seqs.qza \
  --o-tree unrooted-tree.qza

Then export the newick file:

qiime tools export \
  unrooted-tree.qza \
  --output-dir exported-tree

I upload this new tree file and get this from iTOL:

I feel like I am actually close to what I want! So right now, I need to figure out the label part.

I also tried to export the biom file from the filtered table.qza. However, the exported file is not readable. I am not sure where to find the label. Does it have something to do with the taxonomy file or anything missing here?

Thank you so much!!

Regards,
Anranzhilv

1 Like

Exactly - I suspect when you say “label”, are you referring to some kind of taxonomy assignment label? You will need to perform some form of feature classification (check out the Moving Pictures tutorial for one example). One you have taxonomy assignments, you can follow this guide for viewing on iTOL!

Good luck! Keep us posted! :qiime2: :t_rex:

YES!! It worked! Thank you so much!

1 Like

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