- 将PDB结构与Biopython对齐
下面的源代码是从上面的链接获得的:
import Bio.PDB
# Select what residues numbers you wish to align
# and put them in a list
start_id = 1
end_id = 70
atoms_to_be_aligned = range(start_id, end_id + 1)
# Start the parser
pdb_parser = Bio.PDB.PDBParser(QUIET = True)
# Get the structures
ref_structure = pdb_parser.get_structure("reference", "c:/home/bbq_input_pdb/pdb1a6j.pdb")
sample_structure = pdb_parser.get_structure("sample", "c:/home/bbq_output_pdb/1a6j.pdb")
# Use the first model in the pdb-files for alignment
# Change the number 0 if you want to align to another structure
ref_model = ref_structure[0]
sample_model = sample_structure[0]
# Make a list of the atoms (in the structures) you wish to align.
# In this case we use CA atoms whose index is in the specified range
ref_atoms = []
sample_atoms = []
# Iterate of all chains in the model in order to find all residues
for ref_chain in ref_model:
# Iterate of all residues in each model in order to find proper atoms
for ref_res in ref_chain:
# Check if residue number ( .get_id() ) is in the list
if ref_res.get_id()[1] in atoms_to_be_aligned:
# Append CA atom to list
ref_atoms.append(ref_res['CA'])
# Do the same for the sample structure
for sample_chain in sample_model:
for sample_res in sample_chain:
if sample_res.get_id()[1] in atoms_to_be_aligned:
sample_atoms.append(sample_res['CA'])
# Now we initiate the superimposer:
super_imposer = Bio.PDB.Superimposer()
super_imposer.set_atoms(ref_atoms, sample_atoms)
super_imposer.apply(sample_model.get_atoms())
# Print RMSD:
print("RMSD = ", super_imposer.rms)
## Save the aligned version of 1UBQ.pdb
#io = Bio.PDB.PDBIO()
#io.set_structure(sample_structure)
#io.save("1UBQ_aligned.pdb")
此源代码比较两个PDB蛋白质文件并计算它们的RMSD值。
然而,我观察到:
1.这个工具给出的值与PyMOL给出的值不同
1.即使我们将一个文件与其自身进行比较,它也会显示值-在PyMOL中,不可能将一个文件与其自身进行比较
谁能告诉我bug在哪里,因为我找不到它?
1条答案
按热度按时间njthzxwz1#
我不是这里的Maven,我只是想从代码中找出答案;参见https://github.com/biopython/biopython/blob/master/Bio/PDB/Superimposer.py#L43:
以及https://github.com/biopython/biopython/blob/master/Bio/SVDSuperimposer/init.py#L123
只需在此处添加以下内容:
需要
from numpy import array_equal
不知道SVDSuperimposer(
super_imposer.rotran
)如何返回旋转和从坐标的平移馈送到
算法,但可能是你可以让他们甚至从相同的坐标开始
参考和样品???我不确定我的只是个假设。