Probably faster with "^QWERTY$" but if the aim is to do this for multiple sequences, there are way faster alternatives still that probably require indexing..
What is the fastest way to extract a sequence ID from huge multiple FASTA file based on given sequence?
I have a file containing millions of FASTA protein sequences from more than 2000 species. I'm looking for an efficient way (faster than BLAST) to retrieve protein's ID for a given amino-acid sequence. I know that blastdbcmd can pull out an individual sequence record from the BLAST database based on given sequence identifier, but it doesn't work for querying sequences.
Do you know any tools that skip the "alignment building step" and allow for fast retrieval of a FASTA record based on its sequence?
• 2,821 views
•
link
1 answer
If you know the exact sequence... grep? First you could reformat it to ensure all the letters are on the same line, using BBMap:
reformat.sh in=millions.fasta out=reformatted.fasta fastawrap=9999999
grep -B 1 'QWERTY' reformatted.fasta
Or you could stream it to avoid writing a new file:
reformat.sh in=millions.fasta out=stdout.fasta fastawrap=9999999 | grep -B 1 'QWERTY'
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.