# How to filter or reassign taxonomic names in QIIME 2?

**URL:** <https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634>\
**Category:** User Support\
**Tags:** filtering\
**Created:** [September 2, 2025, 6:00am UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634 "2025-09-02T06:00:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivyrose\_Mnialoh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ivyrose_mnialoh/32/21226_2.png) [@Ivyrose\_Mnialoh](https://forum.qiime2.org/u/Ivyrose_Mnialoh)\
**Post date:** [September 2, 2025, 6:00am UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/1 "2025-09-02T06:00:37Z")

</div>

So, I am a bit new to galaxy, i have been trying to navigate there. I am using the v3-v4 region, of the microbiome of certain samples. Now on generating the taxa bar plot, the results clearly indicate a contamination with E.coli. I have tried so many ways to filter the chloroplasts, mitochondria and e. coli, and i have two outcomes. one they are not filtered at all. Secondly for one, they are filtered but i loose the names and only have ids. I trained my classifier, I have tried re-training it filtering the sequences but its not possible. Is it possible to reassign my qiime taxa bar plots taxa ids to names on the server? What other ways can i filter the sequences so that it doesn’t affect the alpha and beta diversity calculations?

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [September 2, 2025, 5:24pm UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/2 "2025-09-02T17:24:53Z")

</div>

Hi @Ivyrose_Mnialoh,

Can you please provide all the commands you have been running that result in the outcomes you are observing? You can attach the QZV files of your barplots too, this way we can look through your provenance.

---

<div class="post-metadata">

**Author:** ![Ivyrose\_Mnialoh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ivyrose_mnialoh/32/21226_2.png) [@Ivyrose\_Mnialoh](https://forum.qiime2.org/u/Ivyrose_Mnialoh)\
**Post date:** [September 11, 2025, 5:36am UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/3 "2025-09-11T05:36:17Z")

</div>

[Galaxy326-[qiime2 taxa barplot on data 309\_ visualization.qzv] (4).qzv](https://forum.qiime2.org/uploads/short-url/ixKeyngPwnrV58luzgA5Mb4biI8.qzv) (1.3 MB)Attached is the qzv file after filtering and loosing my taxonomic names. Is there a simple way to reassign the names back? Also i am using this on the galaxy platform.[https://usegalaxy.eu/api/datasets/4838ba20a6d86765d65eb89cb7ebdd20/display?to\_ext=qza](https://usegalaxy.eu/api/datasets/4838ba20a6d86765d65eb89cb7ebdd20/display?to_ext=qza) this is the lonk to my command line though i cannot have all of it, or maybe i dont know how to show it here.

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [September 11, 2025, 4:19pm UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/4 "2025-09-11T16:19:18Z")

</div>

Hi @Ivyrose_Mnialoh,

Based on the provenance information, I think the issue has to do with an incorrect `qiime taxa filter-table` command. That is you have the general form:

```auto
qiime taxa filter-table \
  --i-table table.qza \
  --i-taxonomy taxonomy.qza \
  --p-mode contains \
  --p-exclude 'd __Bacteria;p__ Cyanobacteria;c __Cyanobacteriia;o__ Chloroplast;f __Chloroplast;g__ Chloroplast; __d__ Bacteria;p __Proteobacteria;c__ Gammaproteobacteria;o __Enterobacterales;f__ Enterobacteriaceae;g __Escherichia-Shigella d__ Bacteria;p __Proteobacteria;c__ Alphaproteobacteria;o __Rickettsiales;f__ Mitochondria;g__Mitochondria' \
  --o-filtered-table filtered-table.qza

```

You need to have a `,` to delimit the taxonomic strings you'd like to search for and filter. Also, I noticed that the search string contains a ` __` prior to `d__ ` in : `...Chloroplast; __d__ Bacteria...`

I added the `,` delimiters before each `d __` and fixed the above mentioned `__ d`. So your new command should be:

```auto
qiime taxa filter-table \
  --i-table table.qza \
  --i-taxonomy taxonomy.qza \
  --p-mode contains \
  --p-exclude 'd __Bacteria;p__ Cyanobacteria;c __Cyanobacteriia;o__ Chloroplast;f __Chloroplast;g__ Chloroplast,d __Bacteria;p__ Proteobacteria;c __Gammaproteobacteria;o__ Enterobacterales;f __Enterobacteriaceae;g__ Escherichia-Shigella,d __Bacteria;p__ Proteobacteria;c __Alphaproteobacteria;o__ Rickettsiales;f __Mitochondria;g__ Mitochondria' \
  --o-filtered-table filtered-table.qza

```

Note the `,` between the taxa strings. A good minimal example is provided [here](https://docs.qiime2.org/jupyterbooks/cancer-microbiome-intervention-tutorial/030-tutorial-downstream/020-taxonomy.html#filtering-filters-based-on-their-taxonomy).

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [September 11, 2025, 4:23pm UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/5 "2025-09-11T16:23:42Z")

</div>

@Ivyrose_Mnialoh

I should also note, that you do not need to use the entire taxonomy string when using `--p-mode contans`. You can condense as follows:

```auto
qiime taxa filter-table \
  --i-table table.qza \
  --i-taxonomy taxonomy.qza \
  --p-mode contains \
  --p-exclude 'Chloroplast,Escherichia-Shigella,Mitochondria' \
  --o-filtered-table filtered-table.qza

```

Thus, any string that contains the items your list will be removed.

Or whatever substring of the overall taxonomy that you'd like to remove. For example, you could also do:

```auto
...
--p-exclude 'o __Chloroplast,g__ Escherichia-Shigella,f__Mitochondria'
...

```

---

<div class="post-metadata">

**Author:** ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)\
**Post date:** [October 12, 2025, 10:24pm UTC](https://forum.qiime2.org/t/how-to-filter-or-reassign-taxonomic-names-in-qiime-2/33634/6 "2025-10-12T22:24:08Z")

</div>

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