python重新编号功能_python – 重新编号蛋白质结构文件中的残基(pdb)
我也经常遇到这个问题.在放弃旧的perl脚本后,我已经为此尝试了一些
python.此解决方案假设您已安装Biopython,ProDy(
http://www.csb.pitt.edu/ProDy/#prody)和EMBOSS(
http://emboss.sourceforge.net/).
我在这里使用了一个乳头瘤病毒PDB条目.
from Bio import AlignIO,SeqIO,ExPASy,SwissProt
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from Bio.Emboss.Applications import NeedleCommandline
from prody.proteins.pdbfile import parsePDB, writePDB
import os
oneletter = {
'ASP':'D','GLU':'E','ASN':'N','GLN':'Q',
'ARG':'R','LYS':'K','PRO':'P','GLY':'G',
'CYS':'C','THR':'T','SER':'S','MET':'M',
'TRP':'W','PHE':'F','TYR':'Y','HIS':'H',
'ALA':'A','VAL':'V','LEU':'L','ILE':'I',
}
# Retrieve pdb to extract sequence
# Can probably be done with Bio.PDB but being able to use the vmd-like selection algebra is nice
pdbname="2kpl"
selection="chain A"
structure=parsePDB(pdbname)
pdbseq_str=''.join([oneletter[i] for i in structure.select("protein and name CA and %s"%selection).getResnames()])
alnPDBseq=SeqRecord(Seq(pdbseq_str,IUPAC.protein),id=pdbname)
SeqIO.write(alnPDBseq,"%s.fasta"%pdbname,"fasta")
# Retrieve reference sequence
accession="Q96QZ7"
handle = ExPASy.get_sprot_raw(accession)
swissseq = SwissProt.read(handle)
refseq=SeqRecord(Seq(swissseq.sequence,IUPAC.protein),id=accession)
SeqIO.write(refseq, "%s.fasta"%accession,"fasta")
# Do global alignment with needle from EMBOSS, stores entire sequences which makes numbering easier
needle_cli = NeedleCommandline(asequence="%s.fasta"%pdbname,bsequence="%s.fasta"%accession,gapopen=10,gapextend=0.5,outfile="needle.out")
needle_cli()
aln = AlignIO.read("needle.out", "emboss")
os.remove("needle.out")
os.remove("%s.fasta"%pdbname)
os.remove("%s.fasta"%accession)
alnPDBseq = aln[0]
alnREFseq = aln[1]
# Initialize per-letter annotation for pdb sequence record
alnPDBseq.letter_annotations["resnum"]=[None]*len(alnPDBseq)
# Initialize annotation for reference sequence, assume first residue is #1
alnREFseq.letter_annotations["resnum"]=range(1,len(alnREFseq)+1)
# Set new residue numbers in alnPDBseq based on alignment
reslist = [[i,alnREFseq.letter_annotations["resnum"][i]] for i in range(len(alnREFseq)) if alnPDBseq[i] != '-']
for [i,r] in reslist:
alnPDBseq.letter_annotations["resnum"][i]=r
# Set new residue numbers in the structure
newresnums=[i for i in alnPDBseq.letter_annotations["resnum"][:] if i != None]
resindices=structure.select("protein and name CA and %s"%selection).getResindices()
resmatrix = [[newresnums[i],resindices[i]] for i in range(len(newresnums)) ]
for [newresnum,resindex] in resmatrix:
structure.select("resindex %d"%resindex).setResnums(newresnum)
writePDB("%s.renumbered.pdb"%pdbname,structure)
python重新编号功能_python – 重新编号蛋白质结构文件中的残基(pdb)相关推荐
- html让文本框左剧中对齐_Python批量设置pptx文件中文本框边框与填充样式(含20分钟视频讲解)...
近期会议:10月30-11月1日 全国高校Python课程高级研修班(苏州)推荐图书:<Python程序设计(第3版)>,(ISBN:978-7-302-55083-9),董付国,清华大学 ...
- python重新编号功能_Python:PDB文件中原子和残基重新编号
Python脚本:PDB文件中原子和残基重新编号 Command: python renumber_pdb.py -i protein.pdb -a -r > output.pdb renumb ...
- python解释器的功能_python的解释器是什么?
python解释器是解释python脚本执行的程序.编写python代码保存后,我们会得到一个以.py为扩展名的文本文件.要运行此文件,就需要python解释器去执行.py文件. python解释器种 ...
- python生成shell脚本_Python设置在shell脚本中自动补全功能的方法
本篇博客将会简短的介绍,如何在ubuntu中设置python自动补全功能. 需求:由于python中的内建函数较多,我们在百纳乘时,可能记不清函数的名字,同时自动补全功能,加快了我们开发的效率. 方法 ...
- python实现登录功能_python实现用户登录功能模块
python实现登录功能模块#!/usr/bin/env python while True: user = raw_input('Please input username:') if user = ...
- [转载] python字典查询功能_Python中的字典功能
参考链接: Python中的字典dictionary方法 (cmp(), len(), items()-) python字典查询功能 Let's check out some important fu ...
- python实现计算器功能_python实现计算器功能
本文实例为大家分享了python计算器的具体代码,供大家参考,具体内容如下 主要用到的工具是Python中的Tkinter库 比较简单 直接上图形界面和代码 引用Tkinter库 from tkint ...
- python实现什么功能_Python 实现WC功能
项目要求 基本要求 -c 统计文件字符数 (实现) -w 统计文件词数 (实现) -l 统计文件行数(实现) 扩展功能 -s 递归处理目录下符合条件得文件(实现) -a 返回文件代码行 / 空行 / ...
- python 数据框缺失值_Python:处理数据框中的缺失值
python 数据框缺失值 介绍 (Introduction) In the last article we went through on how to find the missing value ...
最新文章
- ASA 过滤 URL (图解)
- 经验模式分解EMD算法原理
- 使用node来搭建简单的后台业务
- Flex3加载外部数据1
- “大树底下”的阿里电商 淘品牌的“配角变名角”
- 蓝牙信号强度检测app_基于蓝牙技术的智能插座方案
- C++设计模式之Facade模式(外观模式)
- java反序列化为空_Java序列化/反序列化,提供空对象引用
- DWORD WINAPI
- 在angular2项目里使用ng-zorro的icon
- niosii spi 外部_【笔记】NIOS II spi详解
- 天地伟业tiandy如何连手机_西游释厄传手机版下载(附出招表)-西游释厄传手机版金手指下载v2020.10.24.14...
- 一切不能拌饭的菜都是耍流氓
- Android向服务器发送图片(一)
- 户口本识别/户口本OCR识别
- AD根据已有的PCB封装链接至原理图
- 小企业如何利用区块链和大数据获利?
- 美容店信息管理系统与小程序设计与实现
- PS技巧---撕纸效果
- 一份奇奇怪怪的地图设计书