Extracting residue name and residue ID from PDB.
1
0
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)
biopython pdb • 6.9k views
ADD COMMENT
0
Entering edit mode

Posting code you have tried ensures swift results for these type of questions.

ADD REPLY
0
Entering edit mode

edited, plz see the main post

ADD REPLY
0
Entering edit mode
7.7 years ago

Have you tried get_sequece() method from Bio.PDB.Polypeptide http://biopython.org/DIST/docs/api/Bio.PDB.Polypeptide-pysrc.html ?

ADD COMMENT
0
Entering edit mode

I'm not interested in the sequence per se, I want to get the residue number (ID).

ADD REPLY

Login before adding your answer.

Traffic: 1855 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6