BLAST-The learning notes of the biostar handbook(7)

Basic Local Alignment Search Tool (BLAST)

个用来比对生物序列的一级结构(如不同蛋白质的氨基酸序列或不同基因的DNA序列)的算法。 已知一个包含若干序列的数据库,BLAST可以让研究者在其中寻找与其感兴趣的序列相同或类似的序列。 例如如果某种非人动物的一个以前未知的基因被发现,研究者一般会在人类基因组中做一个BLAST搜索来确认人类是否包含类似的基因(通过序列的相似性)。BLAST算法以及实现它的程序由美国国家生物技术信息中心(NCBI)的Warren Gish、David J. Lipman及Webb Miller博士开发的。(from wikipedia)

A suite of tools

blast-table.png

The key concepts of BLAST

-Search may take place in nucleotide and/or protein space or translated spaces where nucleotides are translated into proteins.
-Searches may implement search “strategies”: optimizations to a certain task. Different search strategies will return different alignments.
-Searches use alignments that rely on scoring matrices
-Searches may be customized with many additional parameters. BLAST has many subtle functions that most users never need.

使用BLAST 的基本步骤

1.使用makeblastdb建立BLAST数据库
2.合适的选择blastn、blastp、blsatx等工具
3.运行工具并在需要的时候格式化输出结果

Build a blast database

#建立database目录
mkdir -p ~/refs/ebola
#获取ebola病毒核酸序列
efetch -db nucleotide -id KM233118 --format fasta > ~/refs/ebola/KM233118.fa

makeblastdb命令建立ebola核酸序列database
makeblastdb -help | more

USAGE
  makeblastdb [-h] [-help] [-in input_file] [-input_type type]
    -dbtype molecule_type [-title database_title] [-parse_seqids]
    [-hash_index] [-mask_data mask_data_files] [-mask_id mask_algo_ids]
    [-mask_desc mask_algo_descriptions] [-gi_mask]
    [-gi_mask_name gi_based_mask_names] [-out database_name]
    [-max_file_sz number_of_bytes] [-logfile File_Name] [-taxid TaxID]
    [-taxid_map TaxIDMapFile] [-version]
DESCRIPTION
   Application to create BLAST databases, version 2.7.1+
REQUIRED ARGUMENTS
 -dbtype <String, `nucl', `prot'>
   Molecule type of target db
OPTIONAL ARGUMENTS
 -h
   Print USAGE and DESCRIPTION;  ignore all other parameters
 -help
   Print USAGE, DESCRIPTION and ARGUMENTS; ignore all other parameters
 -version
   Print version number;  ignore other arguments
 *** Input options
 -in <File_In>
   Input file/database name
   Default = `-'
 -input_type <String, `asn1_bin', `asn1_txt', `blastdb', `fasta'>
   Type of the data specified in input_file
   Default = `fasta'
> *** Configuration options
 -title <String>
   Title for BLAST database
   Default = input file name provided to -in argument
 -parse_seqids
   Option to parse seqid for FASTA input if set, for all other input types
   seqids are parsed automatically
 -hash_index
   Create index of sequence hash values.
 *** Sequence masking options
 -mask_data <String>
   Comma-separated list of input files containing masking data as produced by
   NCBI masking applications (e.g. dustmasker, segmasker, windowmasker)
 -mask_id <String>
   Comma-separated list of strings to uniquely identify the masking algorithm
    * Requires:  mask_data
    * Incompatible with:  gi_mask
 -mask_desc <String>
   Comma-separated list of free form strings to describe the masking algorithm
   details
    * Requires:  mask_id
 -gi_mask
   Create GI indexed masking data.
    * Requires:  parse_seqids
    * Incompatible with:  mask_id
 -gi_mask_name <String>
   Comma-separated list of masking data output files.
    * Requires:  mask_data, gi_mask
 *** Output options
 -out <String>
   Name of BLAST database to be created
   Default = input file name provided to -in argumentRequired if multiple
   file(s)/database(s) are provided as input
 -max_file_sz <String>
   Maximum file size for BLAST database files
   Default = `1GB'
 -logfile <File_Out>
   File to which the program log should be redirected
 *** Taxonomy options
 -taxid <Integer, >=0>
   Taxonomy ID to assign to all sequences
    * Incompatible with:  taxid_map
 -taxid_map <File_In>
   Text file mapping sequence IDs to taxonomy IDs.
   Format:<SequenceId> <TaxonomyId><newline>
    * Requires:  parse_seqids
    * Incompatible with:  taxid
#创建ebola核酸序列数据库
makeblastdb -in ~/refs/ebola/KM233118.fa -dbtype nucl -out ~/refs/ebola/KM233118

创建PRJNA257197氨基酸序列数据库

#下载PRJNA257197所有蛋白质序列fasta文件
esearch -db protein -query PRJNA257197 | efetch -format fasta > index/all-proteins.fa
#创建氨基酸序列数据库
makeblastdb -in index/all-proteins.fa -dbtype prot -out index/all -parse_seqids
#列出数据库内的内容,以“%a”accession格式显示
blastdbcmd -db index/all -entry 'all' -outfmt "%a" | head

BLAST database的下载

NCBI提供许多物种和几乎所有的已知序列的数据库的下载
website

#创建目录用于存放下载的数据库
mkdir -p ~refs/refseq
cd ~/ref/refseq
#blast软件包中已有update_blastdb.pl用于下载NCBI已经做好的数据库
#查看所有数据库
update_blastdb.pl | more
#下载16 microbial database
update_blastdb.pl 16SMicrobial --decompress
#下载分类数据库
update_blastdb.pl taxdb --decompress
#将数据路径加入系统环境变量,这也是分类检索所必须的(for MAC)
echo "export BLASTDB=$BLASTDB:~/refs/refseq/" >> ~/.bahs_profile
source ~/.bash_profile
(未完待续)
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,319评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,801评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,567评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,156评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,019评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,090评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,500评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,192评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,474评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,566评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,338评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,212评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,572评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,890评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,169评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,478评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,661评论 2 335

推荐阅读更多精彩内容

  • 有了黑夜的幽静有了风的微凉有了旧书的沧桑有了烟的灰烬有了诗意有了回忆也有了别离 没了白昼的喧嚣没了雨的暖意没了古道...
    严厚德阅读 189评论 0 1
  • 安妮过完年回成都,我就说请她吃晚饭。 问她想吃什么,回答是不知道。但明确指出,不吃串串,因为我们俩经常去六年二班吃...
    土川兄一终身建设阅读 1,459评论 0 0
  • 上单位通勤车,一眼就看到L姐。她戴了顶毛线编织的帽子,娴静优雅地坐在座位上。 “帽子真漂亮,自己织的?” “买的,...
    铅笔芒种阅读 488评论 0 2