I have a PDB file '1abz' (https://files.rcsb.org/view/1ABZ.pdb), which is containing the coordinates of a protein structure. Please ignore the lines of the header remarks, the interesting information starts at line 276 which says 'MODEL 1'.
I would like to separately get the X, Y or Z coordinates from a pdb file.
This link explains the column numbers of a pdb file: http://cupnet.net/pdb-format/
This is the code that I have but I got an error message.
from Bio import PDB
parser = PDB.PDBParser()
io = PDB.PDBIO()
struct = parser.get_structure('1abz','1abz.pdb')
for model in struct:
for chain in model:
for residue in chain:
for atom in residue:
XYZ = atom.get_coord()
for line in XYZ:
x_coord = float(line[30:38].strip())
y_coord = float(line[38:46].strip())
z_coord = float(line[46:54].strip())
print x_coord
print y_coord
print z_coord