#How to use blast from command-line, on Mac OS X.
Download executables (binary) of blast-commands for Mac OS X.
$ curl -O ftp://ftp.ncbi.nih.gov/blast/executables/blast+/2.2.28/ncbi-blast-2.2.28+.dmg
or
$ wget ftp://ftp.ncbi.nih.gov/blast/executables/blast+/2.2.28/ncbi-blast-2.2.28+.dmg
Install via ncbi-blast-2.2.28+.dmg
Then, you can use folowing commands,
$ blastp -version
blastp: 2.2.28+
Package: blast 2.2.28, build Mar 13 2013 10:25:37
$ makeblastdb -version
makeblastdb: 2.2.28+
Package: blast 2.2.28, build Mar 13 2013 10:25:37
Next, download fasta-file to create database for blast. In this example, we use Swissprot.
$ curl -O ftp://ftp.ncbi.nih.gov/blast/db/FASTA/swissprot.gz
$ gunzip swissprot.gz
$ head swissprot
>gi|13878750|sp|Q9CDN0.1|RS18_LACLA RecName: Full=30S ribosomal protein S18gi|122939895|sp|Q02VU1.1|RS18_LACLS RecName: Full=30S ribosomal protein S18gi|166220956|sp|A2RNZ2.1|RS18_LACLM RecName: Full=30S ribosomal protein S18
MAQQRRGGFKRRKKVDFIAANKIEVVDYKDTELLKRFISERGKILPRRVTGTSAKNQRKVVNAIKRARVMALLPFVAEDQ
N
>gi|1705556|sp|P54670.1|CAF1_DICDI RecName: Full=Calfumirin-1; Short=CAF-1
MASTQNIVEEVQKMLDTYDTNKDGEITKAEAVEYFKGKKAFNPERSAIYLFQVYDKDNDGKITIKELAGDIDFDKALKEY
KEKQAKSKQQEAEVEEDIEAFILRHNKDDNTDITKDELIQGFKETGAKDPEKSANFILTEMDTNKDGTITVKELRVYYQK
VQKLLNPDQ
>gi|30172867|sp|Q8G5F3.1|ARLY_BIFLO RecName: Full=Argininosuccinate lyase; Short=ASAL; AltName: Full=Arginosuccinasegi|238692068|sp|B3DSY6.1|ARLY_BIFLD RecName: Full=Argininosuccinate lyase; Short=ASAL; AltName: Full=Arginosuccinase
MTENNEHLALWGGRFTSGPSPELARLSKSTQFDWRLADDDIAGSRAHARALGRAGLLTADELQRMEDALDTLQRHVDDGS
FAPIEDDEDEATALERGLIDIAGDELGGKLRAGRSRNDQIACLIRMWLRRHSRVIAGLLLDLVNALIEQSEKAGRTVMPG
Then, create databese for blast form this fasta-file.
$ mv swissprot swissprot.fa
$ mkdir -p db/blast/
$ makeblastdb -in swissprot.fa -dbtype prot -out db/blast/swissprot -hash_index
$ ls db/blast/
swissprot.phd swissprot.phi swissprot.phr swissprot.pin swissprot.pog swissprot.psd swissprot.psi swissprot.psq
In this example, we will use blastp
. blastp
is for,
query: protein, database: protein.
Use like following,
$ cat test.fa
>test
GGG
$ blastp -query test.fa -db /path/to/swissprot/swissprot
BLASTP 2.2.28+
...
Query= test
Length=3
***** No hits found *****
...
Notice: For option -db, you have to write /path/to/db/<db-name>, e.g.,
$ ls /Users/numa/blast/db/swissprot
swissprot.fa swissprot.phd swissprot.phi swissprot.phr swissprot.pin swissprot.pog swissprot.psd swissprot.psi swissprot.psq
$ blastp -query test.fa -db /Users/numa/blast/db/swissprot/swissprot
Otherwise (setting just path to db directory /path/to/db/), you will get foloowing error.
$ blastp -query test.fa -db /Users/numa/blast/db/swissprot
BLAST Database error: No alias or index file found for protein database [/Users/numa/blast/db/swissprot] in search path [/Users/numa/blast/db::]
Thanks, your comments helped me get blastp working!