步骤一:NT/NR库全库下载
用wget 对数据库进行下载
NT/NR库:/blast/db/
NT库有76个子文件构建成NT全库
NR库有63个子文件构建成NR全库
(ncbi网站处理好的文件,不需要建库)
/blast/db/FASTA/
/blast/db/FASTA/
这两个为nr/nt的fasta文件,需要建库
写一个简单的脚本,对nr/nt库进行下载
#!/bin/bash
for i in {00..76}
do
wget -c /blast/db/nt.${i}.
wget -c /blast/db/nt.${i}..md5
md5sum -c nt.${i}..md5
tar -zxvf nt.${i}. -C
echo "nt.${i} has done."
done
#!/bin/bash
for i in {00..63}
do
wget -c /blast/db/nr.${i}.
wget -c /blast/db/nr.${i}..md5
md5sum -c nr.${i}..md5
tar -zxvf nr.${i}. -C
echo "nr.${i} has done."
done
注意:下载的时候要加-c参数,避免因网络问题下载失败
下载完后注意删除安装包
步骤二:把序列与nt/nr库进行比对
基本用法
蛋白质序列比对蛋白质数据库(blastp)
blastp -query -out -db dbname -outfmt 7 -evalue 1e-5 -num_des
criptions 10 -num_threads 8
核酸序列比对核算数据库(blastn)
blastn -query -out -db dbname -outfmt 7 -evalue 1e-5 -num_descriptions 10 -num_threads 8
核酸序列比对蛋白质数据库(blastx)
blastx -query -out -db dbname -outfmt 7 -evalue 1e-5 -num_descriptions 10 -num_threads 8
参数:
-query: 输入文件路径及文件名
-out:输出文件路径及文件名
-db:格式化了的数据库路径及数据库名
-outfmt:输出文件格式,总共有12种格式,6是tabular格式对应BLAST的m8格式
-evalue:设置输出结果的e-value值
-num_descriptions:tabular格式输出结果的条数
-num_threads:线程数
创建索引数据库
makeblastdb -in -dbtype nucl -input_type fasta -out dna
参数:
-in: 输入数据库文件
-dbtype:数据库类型 如果是蛋白质数据库则 nucl改为 prot
-out: 索引数据库名称
创建索引文件
dustmasker -in -infmt fasta -parse_seqids -outfmt maskinfo_asn1_bin -out Nuc_all.asnb
参数:
in:输入数据库文件
-infmt:输入文件的格式
-parse_seqids:解析序列的id,这个只需要提供参数,不要提供文件名
-outfmt:输出文件的格式,直接填写即可maskinfo_asnl_bin即可。
out:输出文件的文件名(索引文件名)。
创建数据库
makeblastdb -in -input_type fasta -dbtype nucl -parse_seqids -mask_data -out Nuc_all
参数:
in:原本我们数据库的文件
input_type:输入文件的格式,很明显,我这里是fasta格式