How do I remove certain sequences in fasta based on header?
I have a fasta file like this:
>XM_0000001.1
actact
>XR_0000001.1
atcatc
How do I remove all the sequences with a XR header?
I only want to keep:
>XM_0000001.1
actact
• 5,915 views
•
link
3 answers
If you do it on linux,it will be easy.
- Step 1: grep “>” file.fa | sed 's/>//g' > file.fa.id
- Step 2: grep -v 'XR_' file.fa.id > file.fa.id.final
- step 3: seqtk subseq file.fa file.fa.id.final > final.fa
PS: Seqtk is a software that you need to install.
edit:formatting.
• 0 views
•
link
You can try SEDA (https://www.sing-group.org/seda/). The Pattern filtering operation (https://www.sing-group.org/seda/manual/operations.html#pattern-filtering) would allow you to do this if you configure a Not contains pattern with the "^XR_" text.
• 0 views
•
link
Log in to answer this question.