Entering edit mode
7.7 years ago
underoath006
▴
10
I want to get residue name, residue ID pairs from a PDB file. Also, just to make sure, If I sort residues by ID and print residue name, I always get the sequence, correct?
Edit: I solved the residue name, but how to get a list of all residue numbers? I also wonder if there's a better solution and if I sort residues by ID and print residue name, would I always get the sequence?
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import PPBuilder
structure = PDBParser().get_structure('5bmy', '5bmy.pdb')
model = structure[0]
chain = model['A']
stored.residues = [1,2,3,4,5]
for i in stored.residues:
print (chain[i].resname)
Posting code you have tried ensures swift results for these type of questions.
edited, plz see the main post