macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

blast解析からArtemis comparison tool 起動まで自動で行うラッパーツール

ローカルblastは通常genbankファイルを扱えない。そのため、ACTのようなツールでゲノム比較を行うためには以下のような面倒な流れを取る必要がある。

 

gbkファイルの入手。

fastaファイルの抽出(またはgenbankと同じfaファイルの入手)

ローカルblast、またはblastサーバーで総当たりblast解析

ACTを起動して、genbankファイルとblast結果テキストを読み込ませる。

ゲノムの比較

  

となり、比較が3生物以上になると作業はかなり煩雑になる。Bryan Weeが開発したラッパーツールbwastはこの作業を半自動化するものである。ツール導入後、ワークフローは以下のようになる。

 sample1-3を比較するなら、以下のように打つ。

bwast.py sample1.gbk sample2.gbk sample3.gbk -a
  • -a, --act Run ACT after performing BLAST 

bwastがfastaファイルの抽出、総当たりblast、ACTの起動を自動処理。

ゲノムの比較

 

 

面倒な部分を完全自動化できていることが分かる。

以下の動画は、このbwastを使って2つのgenbankを比較する例である。解析スタートからACT起動まで30秒程度で済んでいる。


genbankファイルのblast解析を簡単に行うためのツール

 

 

 bwastと必要なツールのダウンロード

作者のGithubページからダウンロードできる。

pythonスクリプトなので、ビルドは必要ない。bwast-master/bwast.pyにパスを通すすだけでどこからでもランできる。

git clone https://github.com/bawee/bwast.git
cd bwast/

python bwast.py -h

$ python bwast.py -h

usage: bwast.py [-h] [-f FLAGS] [-v] [-a] [-b {blastn,tblastx}]

                input [input ...]

 

Wrapper script to run blast on Genbank/EMBL files without having to first convert to fasta.

    

Input: Genbank, EMBL or Fasta

    

Requires: BLAST+, ACT and BioPython on your PATH

    

 

positional arguments:

  input                 Specify at least 2 input files

 

optional arguments:

  -h, --help            show this help message and exit

  -f FLAGS, --flags FLAGS

                        Custom BLAST options, enclosed in quotes. E.g. -f '-task blastn -evalue 0.001'

  -v, --verbose         Verbose mode

  -a, --act             Run ACT.

  -b {blastn,tblastx}, --blast {blastn,tblastx}

                        Blast program to use. Default [blastn]

——

 

ただし、本体の他にACT、blast+、biopythonが必要である。ない人は以下のコマンドでインストールする。

pip install biopython
brew install homebrew/science/blast

ACTは以前の記事でインストールについて書いている。 

http://www.sanger.ac.uk/science/tools/artemis-comparison-tool-actにアクセスしてmac版をクリック→ダウンロード後に解凍してできた4つのアプリファイルをApplications/にコピーする。

bwastの公式サイトにあるようにApplicationsにパスを通す。

export PATH="$PATH:/Applications/Artemis.app/Contents"

これで準備は完了。

 

 

 

ラン

 

genbankファイル2つを比較。

bwast.py -a sample1.gbk sample2.gbk 
  • -a, --act Run ACT after performing BLAST

  • -b {blastn,tblastx}, --blast {blastn,tblastx} Blast program to use. Either tblastn or blastn. Default is blastn

デフォルトではblastnが実行される。-aをつけないと、ACTは自動起動しない。

 

領域を指定

bwast.py sample1.gbk 200..2000 sample2.gbk 7000..9000

 

eバリューをblast+のデフォルトから変更。

bwast.py -a sample1.gbk sample2.gbk -f '-evalue 0.0001'
  • -f FLAGS, --flags FLAGS Custom BLAST options, enclosed in quotes. E.g. -f '-task blastn -evalue 0.001'

 

blastプログラムをデフォルトのblastnからtblastxに変更。

bwast.py -a sample1.gbk sample2.gbk -f '-evalue 0.0001' --blast tblastx

 

3つ以上のファイルを比較。

bwast.py -a sample1.gbk sample2.gbk sample3.fa sample4.gbk 

sample3はfastaファイルである。

 

感度を上げないならtblastxなどに変えてみるとよい。ただし時間は相応にかかる。

 

詳細は公式ページを見てください。

GitHub - bawee/bwast: Command line BLAST made-easy

 

 

追記