I would like to plot a distribution of alpha-cabon
to nitrogen
bond distances of ubiquitin protein. So I downloaded the 1UBQ.pdb from RCSB website. Now using biopython
, I am trying to find the distances between all alpha-cabon(CA)
to nitrogen(N)
bonds.
I have tried doing a code like below:
import sys
#from Bio.PDB import *
from Bio.PDB.PDBParser import PDBParser
from numpy import loadtxt
pdb1 ='/home/devanandt/Documents/VMD/1UBQ.pdb'
sys.stdout = open('file_ubq', 'w')
parser=PDBParser(PERMISSIVE=1)
#file=open('1UBQ.pdb','r')
#header_dict=parse_pdb_header(file)
#file.close()
i=1
structure = parser.get_structure('1UBQ',pdb1)
for model in structure:
for chain in model:
for residue in chain:
for atom in residue:
model = structure[0]
chain = model['A']
residue_1 = chain[i]
atom_1 = residue_1['N']
atom_2 = residue_1['CA']
distance = atom_1-atom_2
#print atom.get_vector(),atom.name,distance
print distance
i=i+1
#lines = loadtxt("file_ubq")
And I got the output in the file 'file_ubq' like below:
1.47369
1.4966
1.47547
1.51187
1.44885
1.50423
1.47052
1.48006
1.50265
.
.
.
.
1.48417
1.47194
1.45661
1.47023
But alongside this, I got error too like as below:
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
EXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
EXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
^CEXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
EXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
EXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
EXECUTING:
/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py
----------------------------------------------
Traceback (most recent call last):
File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in <module>
residue_1 = chain[i]
File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 77, ' ')
----------------------------------------------
Program exited successfully with errcode (1)
Press the Enter key to close this terminal ...
Can any one help me understand and solve this error?