生物信息学分析-blast序列比对及结果详细说明

1. 软件说明

Blast是一种基于序列比对的分析工具,可以用于寻找生物序列之间的同源性,它的全称是Basic Local Alignment Search Tool。

Blast有多种版本和用途,最常见的是基于Web的Blast和本地安装的Blast程序。Web版Blast可以直接在NCBI网站上使用,而本地安装的Blast程序需要下载和安装在计算机上。

Blast的使用流程一般为输入一个查询序列,与数据库中的序列进行比对,输出比对结果。

2. 软件下载

这里使用linux版本,直接下载二进制的程序,注意如有报错,请按报错配置好gcc等依赖环境即可(一般是gcc版本问题)。

这里是对应工具的介绍页面,可直接使用页面提交比对任务

BLAST: Basic Local Alignment Search Tool

下载链接:

https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.14.1+-x64-linux.tar.gz

解压安装:

bash 复制代码
###解压
tar -xzvf ncbi-blast-2.14.1+-x64-linux.tar.gz
###进入解压目录
cd ncbi-blast-2.14.1+
###查看解压目录内的文件,感兴趣的就读一下README吧。
ls
[root@vmgmt ncbi-blast-2.14.1+]# ls
bin  BLAST_PRIVACY  ChangeLog  doc  LICENSE  ncbi_package_info  README

###可直接使用的文件在bin目录下
cd bin
###查看目录下的文件
ls
[root@vmgmt bin]# ls
blastdb_aliastool  blast_formatter      blastn_vdb     blastx                      deltablast             legacy_blast.pl  makeprofiledb  rpstblastn  tblastn_vdb        windowmasker
blastdbcheck       blast_formatter_vdb  blastp         cleanup-blastdb-volumes.py  dustmasker             makeblastdb      psiblast       segmasker   tblastx
blastdbcmd         blastn               blast_vdb_cmd  convert2blastmask           get_species_taxids.sh  makembindex      rpsblast       tblastn     update_blastdb.pl

###上面目录的文件默认已经可以直接执行,未配置未系统目录时需要加上指定命令的路径
#如:
./blastn -help
[root@vmgmt bin]# ./blastn -help
USAGE
  blastn [-h] [-help] [-import_search_strategy filename]
    [-export_search_strategy filename] [-task task_name] [-db database_name]
    [-dbsize num_letters] [-gilist filename] [-seqidlist filename]
    [-negative_gilist filename] [-negative_seqidlist filename]
    [-taxids taxids] [-negative_taxids taxids] [-taxidlist filename]
    [-negative_taxidlist filename] [-entrez_query entrez_query]
    [-db_soft_mask filtering_algorithm] [-db_hard_mask filtering_algorithm]
    [-subject subject_input_file] [-subject_loc range] [-query input_file]
    [-out output_file] [-evalue evalue] [-word_size int_value]
    [-gapopen open_penalty] [-gapextend extend_penalty]
    [-perc_identity float_value] [-qcov_hsp_perc float_value]
    [-max_hsps int_value] [-xdrop_ungap float_value] [-xdrop_gap float_value]
    [-xdrop_gap_final float_value] [-searchsp int_value] [-penalty penalty]
    [-reward reward] [-no_greedy] [-min_raw_gapped_score int_value]
    [-template_type type] [-template_length int_value] [-dust DUST_options]
    [-filtering_db filtering_database]
    [-window_masker_taxid window_masker_taxid]
    [-window_masker_db window_masker_db] [-soft_masking soft_masking]
    [-ungapped] [-culling_limit int_value] [-best_hit_overhang float_value]
    [-best_hit_score_edge float_value] [-subject_besthit]
    [-window_size int_value] [-off_diagonal_range int_value]
    [-use_index boolean] [-index_name string] [-lcase_masking]
    [-query_loc range] [-strand strand] [-parse_deflines] [-outfmt format]
    [-show_gis] [-num_descriptions int_value] [-num_alignments int_value]
    [-line_length line_length] [-html] [-sorthits sort_hits]
    [-sorthsps sort_hsps] [-max_target_seqs num_sequences]
    [-num_threads int_value] [-mt_mode int_value] [-remote] [-version]

DESCRIPTION
   Nucleotide-Nucleotide BLAST 2.14.1+

Use '-help' to print detailed descriptions of command line arguments
========================================================================

###如果想直接使用的话注意将本目录加入到profile环境中去(推荐,),或者将本目录下的所有命令复制到/usr/bin下(不建议)
vim /etc/profile.d/blast.sh
##前面的/opt根目录请根据自己的实际路径修改
export PATH="/opt/ncbi-blast-2.14.1+/bin":$PATH  

###配置环境路径生效
source /etc/profile.d/blast.sh
#或
source /etc/profile

#直接运行命令测试
blastn -h

使用方法

bash 复制代码
###基于基于核酸序列-参考核酸序列的比对功能
blastn -db database -query input.fasta -out output -outfmt 6
### db 后面接比对的数据库, query后面接核酸序列,out接想要输出的文件名,outfmt输出格式,6表示表格输出,如下:
-outfmt <String>
     alignment view options:
     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

###这个序列比对速度有点慢,建议多核跑加上threads参数, outfmt是大家通用的表格格式,使用6,7都不错。
###输出后看表格头部,大致字段表示如下:

outfmt,格式6输出(无表头,适合文件合并拼接处理)结果如下,没有表头,需要表头说明的采用7输出,从第一列到最后一列解释分别如下:

1、Query id:查询序列ID标识

2、Subject id:比对上的目标序列ID标识

3、% identity:序列比对的一致性百分比

4、alignment length:符合比对的比对区域的长度

5、mismatches:比对区域的错配数

6、gap openings:比对区域的gap数目

7、q. start:比对区域在查询序列(Query id)上的起始位点

8、q. end:比对区域在查询序列(Query id)上的终止位点

9、s. start:比对区域在目标序列(Subject id)上的起始位点

10、s. end:比对区域在目标序列(Subject id)上的终止位点

11、e-value:比对结果的期望值

12、bit score:比对结果的bit score值

一般情况我们看第3、11、12两列,e值越小越可靠

其他blastx,blastp等使用方式基本一致,但需要注意对比的数据库和比对序列是核酸还是蛋白序列。

blastp 基于蛋白序列-参考蛋白序列的比对功能

blastx 基于核酸序列-参考蛋白序列的比对功能

3. 参考数据库构建

这里以NCBI官网的nr数据库为例,大家根据需要下载对应参考库或者自己收集自定义的参考序列库,保持fasta格式即可

下载数据库:

ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/

建议用ftp下载,文件有点大,需要比较长的时间。

有条件的配置Aspera进行传输,速度比ftp要快很多。

构建数据库,时间消耗与fasta文件大小相关,nr完整文件建库需要时间较长,一般半年左右更新一次即可:

bash 复制代码
# 构建参考数据库
makeblastdb -in nr.fa -dbtype nucl -out nrdb
# in        参考数据库fasta序列文件,可以加入自己已经注释的序列库,只要是fasta格式就行
# dbtype    接序列类型nucl表示核酸序列,prot表示蛋白序列
# out       输出数据库的名称,也就是后面blast命令后面的 db参数后接的数据库名

4. 其他工具对比说明

blast系列工具一般速度比较慢,一般用于小的样品序列和小的参考序列库进行对比,不适合大量序列的比对,需要大量序列比对的可参考本人博客 diamond 快速比对工具,速度最大加速20000倍。

diamond的使用方法与blast基本相近,输出格式及表头字段完全一致。

相关推荐
胖子君9 小时前
聊聊 FocusSearch/focus_mcp_sql:Text2SQL 的新玩法
数据分析
Aloudata9 小时前
如何通过指标平台,最大化地提升数据分析的效率和质量?
大数据·数据分析·指标平台·指标体系·noetl
Guheyunyi1 天前
接入DeepSeek后,智慧园区安全调度系统的全面提升
人工智能·python·安全·信息可视化·数据分析·智慧城市
KJYHS1 天前
2024亚马逊数据分析!
数据挖掘·数据分析
赵钰老师1 天前
【物种分布】基于R语言、MaxEnt模型融合技术的物种分布模拟、参数优化方法、结果分析制图与论文写作
开发语言·数据分析·r语言
The god of big data2 天前
深入探索 DeepSeek 在数据分析与可视化中的应用
ai·数据挖掘·数据分析
赵钰老师2 天前
【深度学习】遥感影像目标检测:从CNN(Faster-RCNN)到Transformer(DETR)
pytorch·深度学习·目标检测·机器学习·数据分析·cnn·transformer
♢.*2 天前
析言GBI:用自然语言交互重构企业数据分析范式
人工智能·数据分析·大模型·交互·bi·阿里
初尘屿风2 天前
基于Python的Diango旅游数据分析推荐系统设计与实现+毕业论文(15000字)
数据库·spring boot·python·数据挖掘·数据分析·旅游
莫叫石榴姐2 天前
DeepSeek驱动下的数据仓库范式转移:技术解耦、认知重构与治理演进
大数据·数据仓库·人工智能·重构·数据分析·deep learning