Blastdb

安裝

ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/中下載最新的BLAST可執行程序

wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.9.0+-x64-linux.tar.gz
mv ncbi-blast-2.9.0+ ~/local/app/ # 移動
cd ~/local/app/                    # 進入本地程序安裝路徑
mv ncbi-blast-2.2.30+ blast        # 修改目錄名

將BLAST+可執行程序所在目錄(bin)的絕對路徑加入到環境變量$PATH中,方便通過程序名直接調用

export PATH=/db/home/shenwei/local/app/blast/bin:$PATH

source .bashrc

五種查詢方式

BLASTN programs search nucleotide databases using a nucleotide query
BLASTP programs search protein databases using a protein query
BLASTX search protein databases using a translated nucleotide query(一條核酸序列會被翻譯成可能的六條蛋白)
TBLASTN search translated nucleotide databases using a protein query
TBLASTX search translated nucleotide databases using a translated nucleotide query

構建數據庫 makeblastdb

BLAST數據庫分爲核酸數據庫和氨基酸數據庫,可以用makeblastdb創建

makeblastdb -in Arabidopsis_thaliana.TAIR10.dna.toplevel.fa -dbtype nucl -out TAIR10 -parse_seqids

-dbtype必須,賦值爲nucl或者prot,代表是核酸或者氨基酸序列。

-in非必須,要構建數據庫的文件名。

-input_type:非必須,制定輸入文件的格式,賦值爲asn1_bin、asn1_txt、blastdb、fasta,默認爲fasta。

-title:非必須,數據庫標題,默認爲-in輸入文件名(加上不同的後綴)。

-parse_seqids:非必須,對於fasta格式文件,會分析輸入序列ID;對於其他格式文件,自動分析。

-hash_idex:非必須(建議有),創建序列的hash。

-out:非必須(建議有),數據庫名稱,默認爲-in輸入文件名。

-max_file_sz:,非必須,數據庫最大容量,默認爲1GB。

-logfile:非必須(建議有),輸出建立數據庫時的log文件。在批量處理數據時候,可以檢查數據庫構建是否正確。默認輸出到屏幕

結果

生成的數據庫中有三個主要的文件——庫索引(indices),序列(sequences)和頭(headers)文件。

生成的文件的擴展名分別是:.pin、.psq、.phr(對蛋白質序列)或.nin、.nsq、.nhr(對核酸序列)。而其他的序列識別符和索引則包含在.psi和.psd(或.nsi和.nsd)中。

注意:自己生成的數據庫中序列命名有以下三種形式:

a) > gnl|database|identifier

b) > lcl|identifier

c)  > identifier

別名

Blast 聚合多個數據庫建立別名數據庫命令

blastdb_aliastool -dblist 'EP/cdr_prot_patent_01 USPTO/cdr_prot_patent_02 WO/cdr_prot_patent_03' -dbtype prot -title "CDR_database" -out CDR_database 

使用別名來查詢

別名只能用來查詢,不能用來獲取序列

查詢命令:

blastp -db CDR_database -task blastp-short -matrix PAM30 -num_threads 4 -evalue 100 -max_hsps 1 -query TestQuery.fa -outfmt 6 -out TestResult.txt

查看數據庫相關信息 blastdbcmd

# 查看信息
blastdbcmd -db TAIR10 -info
# 所有數據
blastdbcmd -db TAIR10 -entry all | head
# 具體關鍵字,如GI號
blastdbcmd -db TAIR10 -entry 3 | head
# 保存序列爲樣本文件
blastdbcmd -db test_db -entry seq1 -out test_query

-db <string>:必須,string表示數據庫所在路徑

-dbtype:必須,guess、nucl、prot,默認爲guess

-info:查看數據庫基本信息

-entry:抽取序列,輸入序列標識,e.g.: 555, AC147927, 'gnl|dbname|tag', or 'all' to select all sequences in the database

-out:保存序列爲樣本文件

-entry_batch 提供一個包含多個檢索關鍵字的文件

-out:輸出文件名

-outfmt:默認是%f

           %f means sequence in FASTA format
           %s means sequence data (without defline)
           %a means accession
           %g means gi
           %o means ordinal id (OID)
           %i means sequence id
           %t means sequence title
           %l means sequence length
           %h means sequence hash value
           %T means taxid
           %X means leaf-node taxids
           %e means membership integer
           %L means common taxonomic name
           %C means common taxonomic names for leaf-node taxids
           %S means scientific name
           %N means scientific names for leaf-node taxids
           %B means BLAST name
           %K means taxonomic super kingdom
           %P means PIG
           %m means sequence masking data.

-show_blastdb_search_path: blast檢索數據庫路徑

blastp

blastp -task blastp -query test.fasta -db rnodb -evalue 1e-5 -num_threads 4 -max_target_seqs 5 -outfmt 6 -out test_out.txt

-query必須,要查詢的序列,需要是fasta格式文件。

-task必須,規定搜索任務類型,blastp、blastp-fast、blastp-short,默認爲blastp。

  • “blastp”, for standard protein-protein comparisons,
  • “blastp-short”, optimized for query sequences shorter than 30 residues
  • “blastp-fast”, a faster version that uses a larger word-size per 

-db必須,指定blast搜索用的數據庫。

-dbsize :非必須,數據庫的有效長度

-out:非必須(建議有),輸出文件名。

-evalue:非必須,搜索E-value閥值,默認爲10。

-max_target_seqs:非必須,設置最多的目標序列匹配數

-num_threads:非必須(建議有),多核計算,默認爲1,可以根據自己系統重新設置。

-remote:如果加上這個參數,就是使用遠程比對,再有互聯網的情況下,連接到NCBI的服務器來進行遠程比對,然後返回到本地,從而不消耗本地的資源,設置了該參數,則-num_threads無效

-perc_identity  相似度,默認是大於0就顯示,如果要顯示大於95%,這後面接95

-comp_based_stats:非必須,組合統計模型,Blastp and blastp-fast的默認值是2,blastp-short的默認值是0(不使用組合統計模型)

-use_sw_tback:是否使用局部最優算法

-outfmt:非必須(建議有),有很多的輸出格式化選項,非常方便用戶選擇。其中,比較常用的是:
     0 = Pairwise,顯示具體匹配信息(缺省)
     1 = Query-anchored showing identities,查詢-比上區域,顯示一致性
     2 = Query-anchored no identities,查詢-比上區域,不顯示一致性
     3 = Flat query-anchored showing identities,查詢-比上區域的屏文形式,顯示一致性
     4 = Flat query-anchored no identities,查詢-比上區域的屏文形式,不顯示一致性
     5 = BLAST XML,信息最全
     6 = Tabular,結果以table的形式給出,清晰易懂
     7 = Tabular with comment lines,表格格式+說明行,有註釋行的table格式,比6多了一些#開頭的註釋行。
     8 = Seqalign (Text ASN.1),
文本方式的ASN格式輸出
     9 = Seqalign (Binary ASN.1),二進制方式的ASN格式輸出
    10 = Comma-separated values,(csv格式)
    11 = BLAST archive (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,
    18 = Organism Report

其中6,7,10,17可以自定輸出格式。默認是

qaccver saccver pident length mismatch gapopen qstart qend sstart send evalue bitscore
簡寫 含義
qaccver 查詢的AC版本(與此類似的還有qseqid,qgi,qacc,與序列命名有關)
saccver 目標的AC版本(於此類似的還有sseqid,sallseqid,sgi,sacc,sallacc,也是序列命名相關)
pident 完全匹配百分比 (響應的nident則是匹配數)
length 聯配長度(另外slen表示查詢序列總長度,qlen表示目標序列總長度)
mismatch 錯配數目
gapopen gap的數目
qstart 查詢序列起始
qstart 查詢序列結束
sstart 目標序列起始
send 目標序列結束
evalue 期望值
bitscore Bit得分
score 原始得分
AC accession


blastn

blastn -db database_name -query input_file -out output_file -evalue evalue -max_target_seqs num_sequences -num_threads int_value -outfmt format "7 qacc sacc evalue length pident"

-task:任務類型,blastn、blastn-short、dc-megablast、megablast、rmblastn,默認是megablast

  • blastn 完全匹配的傳統blastn
  • blastn-short 優化查詢:短於50個鹼基
  • megablast 查找十分相似的序列(如物種內部或相關的物種間)
  • dc-megablast 查找親緣關係比較遠的序列(如物種間)
  • rmblastn 兼容了RepeatMasker

-num_alignments:輸出數據庫中能與Query比對上的的序列數目,與max_target_seqs不能同時使用。
-max_target_seqs:最多允許比對到數據庫中的序列數目,參數僅適用於outfmt >4。
-perc_identity :比對的最低相似度
-max_hsps:由於不對時一條序列比對成多段,如果只想輸出其中的幾段,就設定相應的數目,與-num_alignments不能同時使用。

BLAST程序常用的兩個評價指標 

Score

使用打分矩陣對匹配的片段進行打分,這是對各氨基酸殘基(或鹼基)打分求和的結果,一般來說,匹配片段越長、相似性越高則Score值越大,結果越可信。

E-value

E值的計算:

E=K*m*n*(e-lambda*S)

其中,K和lambda與數據庫和算法有關,是個常量;m代表目標序列的長度,n代表數據庫的大小,S就是前面提到的S值。

E值就是S值可靠性的評價。它表明在隨機的情況下,其它序列與目標序列相似度要大於S值的可能性。所以它的分值越低越好

E值(Expect)表示隨機匹配的可能性,例如,E=1,表示在當前的數據庫中,完全由機率搜到對象數的平均值爲1。

E值越大,隨機匹配的可能性也越大。E值接近零或爲零時,具本上就是完全匹配了。

BLAST程序在搜索空間中可隨機找到獲得這樣高分的序列的可能性(期望值),因此E-value越高,則代表結果越有可能是隨機獲得的,也就越不可信,搜尋空間大小約等於查詢序列的長度乘以全部database序列長度的總和,再乘以一些係數。

如果檢索的序列較短,可適當的提高E值,否則可能會找不到目的序列,反之如果序列較長可適當提高E值。
通常無論是從DNA水平,還是蛋白質水平進行檢索,E值設爲1通常可滿足要求。

通常來講,E值小於10^-5就是比較可性的S值結果。相同的數據庫,如果E=0.001時有1000條的S值比現在這個要高,那麼E設置爲10^-6時可能就會只得到一條結果,就是S值最可靠的那個。但是E值也不是萬能的。它在以下幾個情況下有侷限性:
1)當目標序列過小時,E值會偏大,因爲無法得到較高的S值。
2)當兩序列同源性雖然高,但有較大的gap(空隙)時,S值會下降。這個時候gap scores就非常有用。
3)有些序列的非功能區有較低的隨機性時,可能會造成兩序列較高的同源性。

E值總結:
E值適合於有一定長度,而且複雜度不能太低的序列。

當E值小於10^-5時,表明兩序列有較高的同源性,而不是因爲計算錯誤。

當E值小於10^-6時,表時兩序列的同源性非常高,幾乎沒有必要再做確認。

學習資料

  1. Linux系統中NCBI BLAST+本地化教程 - CSDN博客
  2. Index of /blast/executables/blast+/LATEST
  3. 這或許是我寫的最全的BLAST教程 - 簡書
  4. BLAST® Command Line Applications User Manual - NCBI Bookshelf
  5. BLAST: Basic Local Alignment Search Tool
  6. Linux系統中NCBI BLAST+本地化教程 · Wei Shen's Note
  7. windows 下的blast+安裝以及使用 - 簡書
  8. blast+中blastp參數詳解_LittleStarLord_新浪博客
  9. BLAST Settings
  10. Latest Posts
  11. /blast/executables/blast+/LATEST/ 的索引
  12. BioJava:CookBook:Core:Overview
  13. IMGT/DomainGapAlign
  14. Germline CDR Grafting Humanisation | Abzena
  15. Frontiers | V(D)J Rearrangement Is Dispensable for Producing CDR-H3 Sequence Diversity in a Gene Converting Species | Immunology
  16. sam's note
  17. VBASE2 - the integrative germ-line V gene database
  18. CDR - Wikipedia
  19. search tips
  20. IgBLAST使用及後續結果處理_bioinfomatics2medicine_新浪博客
  21. Overview — changeo 0.4.4.999-2018.11.03 documentation
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章