# How to remove sequences (OTUS) from fasta file based on shared file?

**URL:** <https://forum.mothur.org/t/how-to-remove-sequences-otus-from-fasta-file-based-on-shared-file/21146>\
**Category:** Commands in mothur\
**Created:** [September 29, 2021, 7:37pm UTC](https://forum.mothur.org/t/how-to-remove-sequences-otus-from-fasta-file-based-on-shared-file/21146 "2021-09-29T19:37:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bomzikenka1](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@bomzikenka1](https://forum.mothur.org/u/bomzikenka1)\
**Post date:** [September 29, 2021, 7:37pm UTC](https://forum.mothur.org/t/how-to-remove-sequences-otus-from-fasta-file-based-on-shared-file/21146/1 "2021-09-29T19:37:23Z")

</div>

I had a shared file that contained 35000 OTUS. I used remove.rare functions with nseqs parameter equal to 1000, and so I was left with 637 OTUS in that same shared file. How can get the same 637 OTUS but in fasta file? Is there a function that can look at what OTUS I have in shared file and remove all the rest from fasta file?

---

<div class="post-metadata">

**Author:** ![westcott](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/westcott/32/18_2.png) [@westcott](https://forum.mothur.org/u/westcott)\
**Post date:** [October 1, 2021, 5:24pm UTC](https://forum.mothur.org/t/how-to-remove-sequences-otus-from-fasta-file-based-on-shared-file/21146/2 "2021-10-01T17:24:57Z")

</div>

You can select otus and sequences using the get.otus and get.seqs commands.

mothur \> list.otus(shared=yourSharedFile) - list the otuLabels for the 637 OTUs you want  
mothur \> get.otus(list=yourListFile, accnos=current) - select those OTUs from the list file  
mothur \> list.seqs(list=current) - list names of sequences in the selected OTUs  
mothur \> get.seqs(accnos=current, fasta=yourFastaFile) - select the sequences in the selected OTUs from the fasta file

---

<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:** [October 11, 2021, 5:25pm UTC](https://forum.mothur.org/t/how-to-remove-sequences-otus-from-fasta-file-based-on-shared-file/21146/3 "2021-10-11T17:25:19Z")

</div>

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