It is constantly developed (http://code.google.com/p/cdhit/updates/list ) but indeed the last stable release was quite some time ago.
Is there any tool that can be used to remove redundant amino acid sequences from Fasta? I know fastx_collapser from fastx-toolkit (How to remove the same sequences in the FASTA files?), but it works on nucleotide sequences only. I am looking for a similar tool.
Are there any widely known algorithms for that purpose? Is using Levenshtein distance, pair distance or similar a good idea?
4 answers
Days ago, I wrote a Python script to remove redundant nucleotide sequences from FASTA. Here is the script:
import re
pattern_newline = re.compile(r'([A-Z-]{80})(?=[A-Z-])')
seqs = {}
with open('example.fasta') as fin:
data = fin.read()
for m in re.finditer(r'>(\w+)[^\n]*([^>]*)', data):
seq = ''.join(m.group(2).split())
id = m.group(1)
if seq not in seqs: seqs[seq] = []
seqs[seq].append(id)
with open('unique.fasta', 'w') as fout:
for seq, ids in seqs.iteritems():
fout.write('>%s\n%s\n' % (ids[0], pattern_newline.sub(r'\1\n', seq)))
It works on amino acid sequences, too. Wish it helps.
Here is my free program on Github Sequence database curator (https://github.com/Eslam-Samir-Ragab/Sequence-database-curator)
It is a very fast program and it can deal with:
- Nucleotide sequences
- Protein sequences
It can work under Operating systems:
- Windows
- Mac
- Linux
It also works for:
- Fasta format
- Fastq format
Best Regards
Log in to answer this question.
All the answers are great, thank you guys. However, I would like to know more about algorithms that can be used. Share your ideas.