A more common use is to search a custom-made database. A database is simply a text file of FASTA formatted sequences. In order to use one, it must first be processed by the formatdb program provided with the BLAST programs. After formatdb runs, it creates three new files: *.nhr, *.nin and *.nsq. The original database file is no longer needed afterward.
The documentation that comes with formatdb looks forbidding. The program is sophisticated, but its use doesn't have to be complicated. I do not use a configuration (.formatdbrc) file. The following program employs a hard-coded path to the binary. One subtle point about file paths: the shell understands '~' to mean the user's home directory, but formatdb does not. You have to use the full path. Here I obtain that using a Foundation function called NSHomeDirectory(). If the program does not run for this reason, the logfile contains no hint about why. It's interesting that the blast programs can handle '~' correctly.
Minimal flags passed to formatdb include:
-i path to database file
-p protein? F
-o parse SeqId and do fancy stuff? F
-l path to write logfile
Here is a very nice tutorial that covers the whole process of installing BLAST locally.
import os, sys, subprocess