ubuntu
,學習筆記
,bioinformatics
許多需要做物種序列比對的人都用過 NCBI 的 BLAST(Basic Local Alignment Search Tool)網頁服務,其實他們也有推出單機版的一系列程式 BLAST+ executables,最新版可以從 https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ 取得。
在 Ubuntu 中的安裝方法:
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.13.0+-x64-linux.tar.gz
tar -zxvf ncbi-blast-2.13.0+-x64-linux.tar.gz
sp -r ./ncbi-blast-2.13.0+ ~/
export PATH=~/ncbi-blast-2.13.0+/bin:$PATH
#檢查是否安裝成功
blastn -version
最後要編輯 /etc/profile
加入 export PATH=${PATH}:/home/USERNAME/ncbi-blast-2.13.0+/bin
如果下載的是 .rpm
檔,用 rpm -ivh
指令安裝即可。
裝好之後,就可以在電腦用指令來做序列比對了。
這是平常在比對序列的時候,自己常用的指令:
$ blastn -remote -db nt -query filename.fasta -outfmt "6 qseqid qgi evalue bitscore pident staxids sscinames" -out outputfilename -perc_identity 90 -evalue 1e-5 -max_hsps 1
最後的輸出會是一個 tab 分隔的文字檔(tsv)。
裡面幾個常用參數解釋如下:
-remote
遠端模式,直接上 NCBI GeneBank 的資料庫比對,而不使用本機儲存的資料庫。-db
database,這邊選的是 nt
,也就是 nucleotide 資料庫。-query
與 -out
分別指定輸入與輸出的檔名。-outfmt
指定輸出的樣式,選擇 6 可以自由指定所需要的參數,參數與其他的樣式詳見後述。perc_identity
指定比對的結果,只回傳大於指定相似度的結果。evalue
比對的期望值(越小越好),只回傳小於指定期望值的結果。預設值為 10,一般會設定 1e-5,即 max_hsps
指定如果一條 query 序列和目標序列有多處對應,可以回傳多少結果。這個指令在 query 序列比較短或目標序列長的情況下可能使用,會依照 evalue 的排序來輸出指定數量的結果。依據 NCBI 的說明文件,我們可以選擇不同的輸出格式 outfmt:
outfmt | 格式 |
---|---|
0 | pairwise |
1 | query-anchored showing identities |
2 | query-anchored no identities |
3 | flat query-anchored, show identities |
4 | flat query-anchored, no identities |
5 | XML Blast output |
6 | tabular |
7 | tabular with comment lines |
8 | Text ASN.1 |
9 | Binary ASN.1 |
10 | Comma-separated values |
11 | BLAST archive format (ASN.1) |
12 | Seqalign (JSON) |
13 | Multiple-file BLAST JSON |
14 | Multiple-file BLAST XML2 |
15 | Single-file BLAST JSON |
16 | Single-file BLAST XML2 |
17 | Sequence Alignment/Map (SAM) |
18 | Organism Report |
如果使用的是 outfmt 6, 7 或 10,以下這些是可已自行選擇加入的參數:
參數 | 解釋 |
---|---|
qseqid | Query Seq-id |
qgi | Query GI |
qacc | Query accesion |
qaccver | Query accesion.version |
qlen | Query sequence length |
sseqid | Subject Seq-id |
sallseqid | All subject Seq-id(s), separated by a ';' |
sgi | Subject GI |
sallgi | All subject GIs |
sacc | Subject accession |
saccver | Subject accession.version |
sallacc | All subject accessions |
slen | Subject sequence length |
qstart | Start of alignment in query |
qend | End of alignment in query |
sstart | Start of alignment in subject |
send | End of alignment in subject |
qseq | Aligned part of query sequence |
sseq | Aligned part of subject sequence |
evalue | Expect value |
bitscore | Bit score |
score | Raw score |
length | Alignment length |
pident | Percentage of identical matches |
nident | Number of identical matches |
mismatch | Number of mismatches |
positive | Number of positive-scoring matches |
gapopen | Number of gap openings |
gaps | Total number of gaps |
ppos | Percentage of positive-scoring matches |
frames | Query and subject frames separated by a '/' |
qframe | Query frame |
sframe | Subject frame |
btop | Blast traceback operations (BTOP) |
staxids | Subject Taxonomy ID(s), separated by a ';' |
sscinames | Subject Scientific Name(s), separated by a ';' |
scomnames | Subject Common Name(s), separated by a ';' |
sblastnames | Subject Blast Name(s), separated by a ';' (in alphabetical order) |
sskingdoms | Subject Super Kingdom(s), separated by a ';' (in alphabetical order) |
stitle | Subject Title |
salltitles | All Subject Title(s), separated by a '<>' |
sstrand | Subject Strand |
qcovs | Query Coverage Per Subject |
qcovhsp | Query Coverage Per HSP |
以上是在本機使用 BLAST+ 工具進行序列的線上比對流程筆記;而取得大量序列資料與自建本機資料庫,另外再來談。
🐕🦺 2022.11.08