# Remove.lineage() to filter unclassified OTUs at specific taxonomic levels

**URL:** <https://forum.mothur.org/t/remove-lineage-to-filter-unclassified-otus-at-specific-taxonomic-levels/20416>\
**Category:** Commands in mothur\
**Created:** [March 31, 2020, 9:30pm UTC](https://forum.mothur.org/t/remove-lineage-to-filter-unclassified-otus-at-specific-taxonomic-levels/20416 "2020-03-31T21:30:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhines1](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jhines1](https://forum.mothur.org/u/jhines1)\
**Post date:** [March 31, 2020, 9:30pm UTC](https://forum.mothur.org/t/remove-lineage-to-filter-unclassified-otus-at-specific-taxonomic-levels/20416/1 "2020-03-31T21:30:41Z")

</div>

I’m sure I’m missing something obvious here, but I have not found an answer that works for my specific situation. I am wanting to remove OTUs that are unclassified at anything above a family level.

I have used this code, but I am not sure how to get the filter down to a finer resolution without knowing specifically which phyla, orders, or families to put into the code:

`remove.lineage(fasta=seqs.good.unique.pick.txt, count=seqs.good.pick.count_table, taxonomy=seqs.good.unique.pick.2019_taxonomy.wang.taxonomy, taxon=Fungi_unclassified-unclassified_Fungi)`

Again, I’m probably just being dense about this, but I would love to figure this out.

Thanks!

---

<div class="post-metadata">

**Author:** ![pschloss](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/pschloss/32/4_2.png) [@pschloss](https://forum.mothur.org/u/pschloss)\
**Post date:** [April 2, 2020, 11:51am UTC](https://forum.mothur.org/t/remove-lineage-to-filter-unclassified-otus-at-specific-taxonomic-levels/20416/2 "2020-04-02T11:51:40Z")

</div>

Hi there,

Unfortunately, there isn’t an easy way to do what you’re asking purely in mothur. Here’s what I would do…

If you’re using Mac/Linux, you can run this command to get the listing of sequences that have a taxonomy that includes “unclassified”…

```auto
$ grep "unclassified" stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.taxonomy | cut -f 1 > unclassified.accnos

```

This creates a file called `unclassified.accnos` that has the listing of sequences that are unclassified. You can then use this within the `remove.seqs` command from within mothur along with your current fasta, count\_table, and taxonomy files (i.e. the ones parallel to `stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.taxonomy` used in the example above)

```auto
mothur > remove.seqs(fasta=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.fasta, count=stability.trim.contigs.good.unique.good.filter.unique.precluster.count_table, taxonomy=stability.trim.contigs.good.unique.good.filter.unique.precluster.pick.pds.wang.taxonomy, accnos=unclassified.accnos)

```

Pat

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/system/32/2_2.png) [@system](https://forum.mothur.org/u/system)\
**Post date:** [April 12, 2020, 11:51am UTC](https://forum.mothur.org/t/remove-lineage-to-filter-unclassified-otus-at-specific-taxonomic-levels/20416/3 "2020-04-12T11:51:42Z")

</div>

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