将多个 PDB 文件拆分为链并保存为单独的文件
我正在尝试使用 Biopython 拆分大量 pdb 文件,然后将它们保存为名为 pdbid_chain.pdb 的单独文件。到目前为止我还没有成功。另外,我对 python 还很陌生。
非常感谢任何帮助!
这是我的代码:
#pdb_list contains a list of 208 pdb structures
io = PDBIO()
#parse structures
for f in pdb_list:
pdb_parsed = PDBParser().get_structure(pdb_ids, str(PDB_RAW_DIR) + '/' + f)
#save chains
for structure in pdb_parsed:
pdb_chains = structure.get_chains()
for chain in pdb_chains:
io.set_structure(chain)
io.save(pdb_parsed.get_id() + "_" + chain.get_id() + ".pdb")
干杯!
I am trying to split a large number of pdb files using Biopython and then save them as separate files called pdbid_chain.pdb . So far I did not succeed. Additionally, I am quite new to python.
Any help is highly appreciated!
Here is my code:
#pdb_list contains a list of 208 pdb structures
io = PDBIO()
#parse structures
for f in pdb_list:
pdb_parsed = PDBParser().get_structure(pdb_ids, str(PDB_RAW_DIR) + '/' + f)
#save chains
for structure in pdb_parsed:
pdb_chains = structure.get_chains()
for chain in pdb_chains:
io.set_structure(chain)
io.save(pdb_parsed.get_id() + "_" + chain.get_id() + ".pdb")
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种简单的解决方案是使用 MDAnalysis 并使用选择代数来选择不同的链。
这是一个简单的例子。 Complex.pdb 包含两个链 A 和 I。将创建两个新的 pdb 文件,其中链是分开的。
One simple solution is to use MDAnalysis and use the selection algebra to select different chains.
Here is a simple example. The complex.pdb contains two chains A and I. Two new pdb files are created in which the chains are separated.