From looking at the API (and at what is available to chain via the command dir(chain)
), I can see that there is a method get_residues()
. Looking at one of the residues contained, I can see that there is a function get_resname()
. Using these, one solution for you problem might be:
from Bio import *from Bio.PDB.PDBParser import PDBParserfrom Bio.PDB.Polypeptide import PPBuilderstructure = PDBParser().get_structure('5bmy', '5bmy.pdb') model = structure[0]chain = model['A']for i in chain.get_residues(): print(i.get_resnames())
This gives a solution that doesn't need pymol
.