加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Ubuntu16.04 + Biopython简单安装入门

(2017-02-06 16:19:00)
标签:

python

biopython

ubuntu

linux

分类: 生物信息学
1、Biopython
PS. 以下过程中,因为我已经安装好了,所以输入提示符后的样子跟各位小伙伴是不一样的哦。
我将Biopython跟python2用在一起
首先我们要有一个pip,于是在终端输入 sudo apt install python-pip 按照提示输入一路安装好,然后输入 pip 测试一下是否安装好了。
http://s16/mw690/006F8Fblzy78y3BaZUbaf&690Biopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />
安装好以后输入升级一下pip:pip install --upgrade pip

随后安装biopython:pip install biopython 一路按照提示安装好。

测试一下,输入python,出现>>>import Bio(如果在这一步报错,说明Biopython没有安装好)。再输入>>>print Bio.__version__,显示版本号,我这里是1.68。现在我们可以使用Biopython了,请一脸骄傲地鼓掌http://www/uc/myshow/blog/misc/gif/E___7392ZH00SIGG.gifBiopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />

http://s8/mw690/006F8Fblzy78y5qWfNJf7&690Biopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />

 

2、举个栗子,写个biopython.py 输出sequence.fasta文件中的序列信息

PS.如果不会blast+,请阅读http://blog.sina.com.cn/s/blog_16bde33f30102wq9x.html

from Bio import SeqIO
for seq_record in SeqIO.parse("sequence.fasta","fasta"):
    print seq_record.id
    print repr(seq_record.seq)
    print len(seq_record)
http://s10/mw690/006F8Fblzy78zNyswDDf9&690Biopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />
在终端运行python ciopython.py。你会得到如下图所示的结果,为了清晰,sequence.fasta文件中只保存了两条蛋白序列

http://s11/mw690/006F8Fblzy78zNE6DUK4a&690Biopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />

3、再举个栗子:写个try.py批量运行psiblast,每条序列输出一个pssm矩阵

PS.

/blast/db存放格式化好的数据库swissprot

/blast/example存放待测序列example.txt及输出结果

try.py直接放在/blast/bin下(虽然不规矩)

from Bio.Blast.Applications import NcbipsiblastCommandline
for i in range(1, 3+1):
   psiblast_cline=NcbipsiblastCommandline(in_msa="../example/example.txt", db="../db/swissprot", out_ascii_pssm="../example/"+str(i)+".txt", msa_master_idx=i)  

    stdout,stderr=psiblast_cline()

http://s14/mw690/006F8Fblzy78zO5OY9f6d&690Biopython简单安装入门" TITLE="Ubuntu16.04 Biopython简单安装入门" />
终端运行try.py的结果是在/example文件夹下出现三个文件,分别存放了三条序列的PSSM矩阵。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有