How to filter Cyanobacteria/chloroplast

Dear All,

After demonising step using DADA2, i see a lot OTUs related to Cyanobacteria in my taxonomy table. We normally removed these OTUs from our OTU table before the following downstream analysis.

Can I filter remove these OTUs using QIIME2 and how?

Cheers

Hi, as far as I know, they’re planning for a plugin called sequence bases filtering, which can be used to filter the Cyanobacteria. For now, I export the feature table and taxonomy file, align them manually and delete the taxa assigned as Cyanobacteria. Then I import the filtered feature table back to Qiime 2 for the downstream analyses.

Hi @hongwei2017! We support this type of filtering in QIIME 2 by using the feature-table filter-features command! If you have your feature table, and have assigned taxonomy using feature-classifier, you can filter your feature table by using your taxonomy as metadata! A hypothetical filtering command could look something like this (you will need to adjust this to match your filenames, and you will need to modify the --p-where statement to meet your needs):

$ qiime feature-table filter-features \
  --i-table my-feature-table.qza \
  --m-metadata-file my-taxonomy.qza \
  --p-where "Taxon NOT LIKE '%Cyanobacteria%'" \
  --o-filtered-table feature-table-sans-cyanobacteria.qza

The --p-where "Taxon LIKE '%Cyanobacteria%'" statement instructs QIIME 2 to remove any features that have the string Cyanobacteria present anywhere within the label.

Give that a shot and let us know how it works for you, or if you need any additional help. Thanks!

PS - @yanxianl’s solution could also work, but one downside is you would lose your provenance, which is (in my opinion) a pretty cool feature of QIIME 2! We plan on supporting some more advanced sequence-based filtering in the future - stay tuned!.

2 Likes

Hi @thermokarst

Is my-feature-table.qza the file that contains both otu sequences accounts and taxonomy? or just otu sequence numbers. Should i filter before or after normalisation? I am thinking in which step to apply for this filtering.

Cheers

Hi @hongwei2017!

Your feature table will be a separate file from your assignment taxonomies (take a look at the Moving Pictures Tutorial for a high-level overview of a typical QIIME 2 analysis).

That decision is up to you — I suggest you try it both ways and compare results!
Thanks!

Hi @thermokarst!

I used the command lines you suggested but somehow, the result was a taxaplot only with taxa belonging to the phylum Cyanobacteria - opposite to what we intended to achieve.

Here are the command lines I used:

qiime feature-table filter-features
–i-table feature-table-filtered.qza
–m-metadata-file taxonomy.qza
–p-where “Taxon LIKE ‘%Cyanobacteria%’”
–o-filtered-table feature-table-filtered-without-Cyanobacteria.qza

qiime taxa barplot
–i-table feature-table-filtered-without-Cyanobacteria.qza
–i-taxonomy taxonomy.qza
–m-metadata-file citric-acid-sample-metadata.tsv
–o-visualization taxa-bar-plots.qzv

qiime tools view taxa-bar-plots.qzv

1 Like

Oops, sorry, I left off a key part of that statement!

$ qiime feature-table filter-features \
  --i-table feature-table-filtered.qza \
  --m-metadata-file taxonomy.qza \
  --p-where "Taxon NOT LIKE '%Cyanobacteria%'" \
  --o-filtered-table feature-table-filtered-without-Cyanobacteria.qza

Note the missing NOT in the where statement! Sorry about that, it was a copy-and-paste error.
This has been corrected above in the original snippet.

1 Like

Hi, it works now ! Thanks :slight_smile:

Actually, by checking the usage of the feature-filter function, I found an alternative solution by passing an extra arguement, “–p-exclude-ids”, to the command lines:

qiime feature-table filter-features
–i-table feature-table-filtered.qza
–m-metadata-file taxonomy.qza
–p-where “Taxon LIKE ‘%Cyanobacteria%’”
–p-exclude-ids
–o-filtered-table feature-table-filtered-without-Cyanobacteria.qza

1 Like

Yep! There are a few ways to do it, good work!

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

QIIME 2 2017.10 was just released! There are some new methods in q2-taxa which simplify filtering and a brand new section in the Filtering Tutorial explaining how to filter certain taxa from your data.

1 Like