I want to BLAST an mRNA reference sequence against a local database in my directory (a collection of RNA reference sequences) using a BioPython program. I know how to perform BLAST against online database such as NCBI database using the following code:
from Bio.Blast import NCBIWWW
sequence = """GGAGGATATATTCAAC"""
blast_handle = NCBIWWW.qblast('blastn', 'nr', sequence)
blast_handle.seek(0)
blast_file = open('blast-output.xml', 'w')
blast_file.write(blast_handle.read())
blast_file.close()
But my question is how to do BLAST against a local database in my directory?
2 answers
This is covered in the Biopython tutorial under the heading "Running BLAST Locally". You'll need to install the BLAST executables, then follow the examples. If you'd prefer, you can run the create your databases and run your BLASTs via the command line, then use Biopython to parse the resulting xml.
You can also use PrfectBlast, a GUI that perform this task whatever your platform is: http://code.google.com/p/prfectblast/ Easier to handle for people that do not use python/perl.
Log in to answer this question.