matlab读取pdb文件,使用BioPython读取.pdb文件的整个目录
我最近的任務是在python中編寫一個程序,找到距離.pdb(蛋白質數據庫)蛋白質中每種金屬2埃范圍內的原子。這是我為它寫的腳本。
from Bio.PDB import *
parser = PDBParser(PERMISSIVE=True)
def print_coordinates(list):
neighborList = list
for y in neighborList:
print " ", y.get_coord()
structure_id = '5m6n'
fileName = '5m6n.pdb'
structure = parser.get_structure(structure_id, fileName)
atomList = Selection.unfold_entities(structure, 'A')
ns = NeighborSearch(atomList)
for x in structure.get_atoms():
if x.name == 'ZN' or x.name == 'FE' or x.name == 'CU' or x.name == 'MG' or x.name == 'CA' or x.name == 'MN':
center = x.get_coord()
neighbors = ns.search(center,2.0)
neighborList = Selection.unfold_entities(neighbors, 'A')
print x.get_id(), ': ', neighborList
print_coordinates(neighborList)
else:
continue
但這僅適用于單個.pdb文件,我希望能夠讀取它們的整個目錄。由于我直到現在才使用Java,我不完全確定如何在Python 2.7中實現這一點。我的一個想法是,我會將腳本放在try catch語句中,然后放入while循環,然后在它到達結尾時拋出異常,但這就是我將如何在Java中完成的,不知道我將如何在Python中做到這一點。所以我很樂意聽到任何人可能有的想法或示例代碼。
總結
以上是生活随笔為你收集整理的matlab读取pdb文件,使用BioPython读取.pdb文件的整个目录的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 灯谜的由来儿歌(灯谜的由来)
- 下一篇: cad标注面积显示(CAD中怎么标注面积