2024-09-27 22:21:57 发布
网友
{pda}当前正在操作python.m文件的pda}。我的最终目标是将python脚本转换回pdb文件,以便可以在VMD或PyMol.罐谁来帮忙?在
在for/while循环中,将列表中的每个元素都改成这样,这是一种粗略的方法,但BioPDB可以很好地读取输出。我假设您有想要在不同数组中写出的数据。在
j[0] = j[0].ljust(6)#atom#6s j[1] = j[1].rjust(5)#aomnum#5d j[2] = j[2].center(4)#atomname$#4s j[3] = j[3].ljust(3)#resname#1s j[4] = j[4].rjust(1) #Astring j[5] = j[5].rjust(4) #resnum j[6] = str('%8.3f' % (float(coords[i][0]))).rjust(8) #x j[7] = str('%8.3f' % (float(coords[i][1]))).rjust(8)#y j[8] = str('%8.3f' % (float(coords[i][2]))).rjust(8) #z\ j[9] =str('%6.2f'%(float(j[9]))).rjust(6)#occ j[10]=str('%6.2f'%(float(j[10]))).ljust(6)#temp j[11]=j[11].rjust(12)#elname f1.write("%s%s %s %s %s%s %s%s%s%s%s%s\n"% j[0],j[1],j[2],j[3],j[4],j[5],j[6],j[7],j[8],j[9],j[10],j[11]))
然后检查写出来的文件是否可以像其他人建议的那样用BioPython中的PDBParser读取。在
此example code似乎正在执行您想要的操作:
相关部分为:
import sys from Bio.PDB import PDBIO from Bio.PDB.PDBParser import PDBParser PDB_input = sys.argv[1] parser = PDBParser() structure = parser.get_structure('self', PDB_input) # DELETED CODE THAN MANIPULATED PDB OBJECT w = PDBIO() w.set_structure(structure) w.save('corrected_from_CHARMM_to_PDB.pdb')
在for/while循环中,将列表中的每个元素都改成这样,这是一种粗略的方法,但BioPDB可以很好地读取输出。我假设您有想要在不同数组中写出的数据。在
然后检查写出来的文件是否可以像其他人建议的那样用BioPython中的PDBParser读取。在
^{pr2}$此example code似乎正在执行您想要的操作:
相关部分为:
相关问题 更多 >
编程相关推荐