biopython 进行global blast with NCBIWWW
首先安装Pyhon 2.7 http://www.python.org/getit/
Biopython http://biopython.org/wiki/Biopython
我把python 默认安装在C:\Python27
我要处理的序列文件(fasta格式)在D:\myseqs 文件夹中
然后打开Python(Command Line)或者IDLE(Python GUI)
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chdir("D:\\myseqs")
>>> from Bio.Blast import NCBIWWW
>>> fasta_string = open("a517.fasta").read()
>>> result_handle = NCBIWWW.qblast("blastn","nr",fasta_string)
>>>
>>> save_file = open("my_blast.xml","w")
>>> save_file.write(result_handle.read())
>>> save_file.close()
>>> result_handle.close()
>>>
也可以修改Python27\Lib\site-packages\Bio\Blast NCBIWWW.py 中hitlist_size值为10(BLAST默认设置为50),使生成的结果my_blast.xml 内容少点,文件小点(该文件在D:\myseqs中)
参考资料:http://www.bio-cloud.info/Biopython/en/ch7.html
Biopython http://biopython.org/wiki/Biopython
我把python 默认安装在C:\Python27
我要处理的序列文件(fasta格式)在D:\myseqs 文件夹中
然后打开Python(Command Line)或者IDLE(Python GUI)
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chdir("D:\\myseqs")
>>> from Bio.Blast import NCBIWWW
>>> fasta_string = open("a517.fasta").read()
>>> result_handle = NCBIWWW.qblast("blastn","nr",fasta_string)
>>>
>>> save_file = open("my_blast.xml","w")
>>> save_file.write(result_handle.read())
>>> save_file.close()
>>> result_handle.close()
>>>
也可以修改Python27\Lib\site-packages\Bio\Blast NCBIWWW.py 中hitlist_size值为10(BLAST默认设置为50),使生成的结果my_blast.xml 内容少点,文件小点(该文件在D:\myseqs中)
参考资料:http://www.bio-cloud.info/Biopython/en/ch7.html
-
tjbdzr 赞了这篇日记 2016-05-02 19:40:19