BLAST+

2024 年 3 月 28 日 改訂

BLAST+ は,類似配列検索プログラム集です.従来の local BLAST (legacy blast と呼ばれる) を発展させたものです.Legacy blast はメンテナンスを行なっていないので,BLAST+ を用いた方が良いです.マニュアルはこちらです.

まずは,統合TV をご覧下さい.legacy blast と blast+ 間のオプション表があります.これまで local Blast (legacy blast)を使っていた方は,legacy blast と blast+ の対応表が役に立ちます.


ダウンロード
こちらのページからダウンロードできるはずです.しかし,今試したらブラウザ Safari ではダウンロードできませんでした.Chrome では繋がると思います.
  かわりに以下の手順で terminal を使ってダウンロードも可能です.家の ADSL では 5 分位かかりました (272.5MB).[2013 年 7 月]


[jun-inoue:inoue]$ ftp ftp.ncbi.nlm.nih.gov
Connected to ftp.wip.ncbi.nlm.nih.gov.
220-
Warning Notice!

You are accessing a U.S. Government information system which includes this
....
KERBEROS_V4 rejected as an authentication type
Name (ftp.ncbi.nlm.nih.gov:jun-inoue): anonymous
331 Anonymous login ok, send your complete email address as your password
Password:[email address でも良いですが,単にリターンでも大丈夫です]
230 Anonymous access granted, restrictions apply
....
226 Transfer complete
ftp> cd blast
250 CWD command successful
ftp> ls
227 Entering Passive Mode (130,14,250,12,196,27).
150 Opening ASCII mode data connection for file list
-r--r--r-- 1 ftp anonymous 20087 May 10 2004 blastftp.txt
dr-xr-xr-x 3 ftp anonymous 32768 Jul 9 01:10 db
dr-xr-xr-x 5 ftp anonymous 4096 Feb 27 13:56 demo
dr-xr-xr-x 6 ftp anonymous 4096 Apr 19 18:49 documents
dr-xr-xr-x 10 ftp anonymous 4096 Sep 14 2012 executables
dr-xr-xr-x 2 ftp anonymous 4096 Sep 11 2012 matrices
dr-xr-xr-x 7 ftp anonymous 4096 May 9 12:06 temp
dr-xr-xr-x 2 ftp anonymous 4096 Oct 7 2011 web_services
dr-xr-xr-x 2 ftp anonymous 4096 May 24 2012 windowmasker_files
226 Transfer complete
ftp> cd executables
250 CWD command successful
ftp> cd blast+
250 CWD command successful
ftp> cd LATEST
250 CWD command successful
ftp> get ncbi-blast-2.2.28+-universal-macosx.tar.gz
local: ncbi-blast-2.2.28+-universal-macosx.tar.gz remote: ncbi-blast-2.2.28+-universal-macosx.tar.gz
227 Entering Passive Mode (130,14,250,12,197,60).
150 Opening BINARY mode data connection for ncbi-blast-2.2.28+-universal-macosx.tar.gz (272477554 bytes)
226 Transfer complete
272477554 bytes received in 42 seconds (6.3e+03 Kbytes/s)
ftp> quit


インストール

インストールは単純で,ただダウンロードして得られた .pkg をダブルクリックするだけです.すでにコンパイルされたファイルが ncbi-blast-x.x.x+/bin ディレクトリに入っています (2018 年 3 月).
 ダウンロードファイルに .pkg がない場合もあるようです.この場合は,おそらく bin ディレクトリにコンパイル済みの各種プログラムが入っています.これをコピー&ペースとして使ってください (2015 年 1 月).


余談ですが, 基本的なテクニックを紹介します。
以下を入力すると,インストールされたプログラムの場所がわかります.

which makeblastdb

/usr/local/ncbi/blast/bin に入れます.

cd /usr/local/ncbi/blast/bin

/usr/local/ncbi/blast/bin がウィンドウとして開きます.

open /usr/local/ncbi/blast/bin


データベースの作成,blastp 検索,配列の取得

blastPlusExample.tar.gz 使って説明します.Quick start を参照しました (2019 年 7 月).version 2.15.0 では、makeblastdb でエラーメッセージがでます (2024 年 3 月)。

以下をターミナルから入力してください.

sh 000command.sh

以下,000command.sh の解説です.

# アミノ酸配列データの解析
./makeblastdb -in db_prot.txt -dbtype prot -parse_seqids
prot データベースを作成します.
-parse_seqids: seq ID 検索を可能にします.

./blastp -query query_prot.txt -db db_prot.txt -num_alignments 10 -evalue 1e-12 -out out_protREC.txt

blastp 検索を行います.

./blastdbcmd -entry ENSP00000362111.4 -db db_prot.txt -dbtype prot -out out_protSEC.txt

seq ID を用いて配列を取得します.

# 塩基配列データの解析
./makeblastdb -in db_nucl.txt -dbtype nucl -parse_seqids
nucl データベースを作成します.

./blastn -query query_nucl.txt -db db_nucl.txt -num_alignments 10 -evalue 1e-12 -out out_nuclREC.txt
blastn 検索を行います.

./blastdbcmd -entry ENST00000373020.8 -db db_nucl.txt -dbtype nucl -range 100-150 -out out_nuclSEC.txt
seq ID を用いて「指定したデータベース,レコード,範囲」の配列を取得します.

*makeblastdb で作成されたデータベースは,legacy Blast (blastall) でも使うことができました.また,逆も可能で,formatdb (legacy Blast) で作成されたデータベースを blastp (blast+) で使えました.しかし,一応データベース化はやり直しています.


blastn results から .csv ファイルを作成

listMake_blastnResult.tar.gz

python3 020_read_blastnRes2.py

(2024 年 3 月)
 
パラメーター

各種パラメーターは,以下のコマンドで確認できます.

$ blastn -help

- task (Manual, P7 "BLAST+ features: Tasks")
塩基配列の検索には,megablast (種内解析用) と blastn (種間解析用) が存在する.blastn はデフォルトだと megablast が選ばれる.

- outfmt (Manual, P33)
アウトファイルの形式を設定する.

- bit score (Help)
evalue はデータベースのサイズに依存するので,bit score を使った方が良いと言う意見もある.




fasta file から配列を取得する: blastdbcmd
blastdbcmd によって,position 情報 (コーディネートとも言う) を元に,fasta file から配列を取得します.extractSeqFromFasta.tar.gz 使って説明します.

-parse_seqids オプションを用いて,blastdbcmd で利用可能なデータベースを作成します.
$ makeblastdb -in test.fa -dbtype nucl -parse_seqids
Building a new DB, current time: 08/30/2019 12:02:51
...

作成したデータベースから,blastdbcmd によって目的の配列を取得します.
$ blastdbcmd -db test.fa -dbtype nucl -entry ENST00000373020.8 -range 5-10
>ENST00000373020.8:5-10
CGTCCC

$ cat test.fa
>ENST00000373020.8
ATGGCGTCCCCGTCTCGGAGACTGCAGACTAAACCAGTCATTACTTGTTT

blastdbcmd については,NCBI の公式マニュアルを見ても,あまりよい説明を見つけられませんでした.「blastdbcmd -help」によってオプションを確認してください.おそらく, bedtools getfasta (以下のコラム) のように,repeat 配列を小文字のまま表示するオプションはありません.(2019 年 8 月).

BEDTools の getfasta を用いても,fasta file から配列を得られます.こちらを参照してください.


種ごとにまとめられた ftp サイトのデータをまとめてダウンロード

BLAST Help, PDF にある HowTo_Downloading_Genomic_Data.pdf, P44,にしたがっています.Case 2 にある方法です.

ftp アドレスを用いてデータをダウンロードする

genomic_directory に以下の 2 行を保存します.これらのアドレスは,NCBI の ftp サイトにWebブラウザから入って得ます.

ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/001/477/545/
GCF_001477545.1_Pneu_cari_B80_V3/
ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/001/638/985/
GCF_001638985.1_Phybl2/

以下のコマンドによって,genomic_directory に記述されている ftp ディレクトリに存在するファイルを一気にダウンロードできます.

wget -r --no-parent --no-host-directories --cut-dirs=2 --level=1 \
--input-file=genomic_directory

wget のオプションの説明は以下.

-r: recursively works through the directory
--no-parent: ignores the parent directory
--no-host-directories: saves the files without prepending the NCBI FTP URL
--cut-dirs=2: saves the files without creating intermediate directories
--level=1: works only at that level of directory
--input-file=value: sets directory input to the file specified by value

ある分類群のデータを一気に得る

fungi を例にしています.NCBI がまとめている fungi の ftp サイトでは, assembly_summary.txt にそれぞれの種の ftp アドレスがまとめられています.以下のコマンドによって,assembly_summary.txt から,これらのアドレスを全て genomic_directory というファイルに保存します.

curl 'ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/fungi/
assembly_summary.txt' | \
awk '{FS="\t"} !/^#/ {print $20"/"}' > genomic_directory

あとは,wget によって genomic_directory に保存した ftp アドレスのファイルをダウンロードします.

(2019 年 6 月)


バージョンによる違い

makeblast version 2.15.0 はパスにスペースがあるとエラーメッセージが出る
最新のmakeblastdb ( ncbi-blast-2.15.0+-x64-macosx.tar.gz ) から得られたエラーです。 ただ、その後の blastn 解析は、問題なく動作しました (以下、blastn version 2.15.0 は遅い、の解析)。

BLAST Database error: No alias or index file found for nucleotide database [/Users/username/Dropbox/My] in search path [/Users/username/Dropbox/My Mac (rrcs-xxx.com)/Desktop/blastPlusExample::]

ディレクトリをホームディレクトリに移したところ、エラーは出なくなりました (2024 年 3 月)。

blastn version 2.15.0 は遅い
blastn を比較したら、以下の結果でした。

2.15.0: 2.72 秒
2.9.0: 2.2 秒

一方、makeblastdb は 2.15.0 の方が速いです。

2.15.0: 28.95 秒
2.9.0: 34.32 秒

(2024 年 3 月)


リンク

BLAST+ 公式ページ

最近のマニュアル (PDF ヴァージョンもある) が得られる.

BLAST Help, PDF

PDF マニュアル.種ごとのゲノムデータダウンローについてはこちら (HowTo_Downloading_Genomic_Data.pdf, P44).

NAGRP BLAST Server Documentation

Mega blast などについて、BLAST+ 本家のページより丁寧な解説があります。

PSI-BLAST

統合テレビ。NCBI website。部分特異的スコア行列 (PSSM: Position Specific Scoring Matrix) を利用して、類縁の配列を探す方法の紹介。

mac でバイオインフォマティクス

NCBI からバクテリアゲノムをダウンロードする

mac でバイオインフォマティクス

nr などの NCBI データベースをダウンロードする ncbi-blast-dbs

fastacmd の後継者:blastdbcmd

ゲノム配列の任意の場所を切り出すソフトウェアの紹介.