<p>Let's check it. I copied your file fragment into <code>a.pdb</code>.</p>

<pre><code>&gt;&gt;&gt; from Bio import PDB
&gt;&gt;&gt; for res in PDB.PDBParser().get_structure('pdb', 'a.pdb')[0].get_residues():
...   print(res.get_full_id())
... 
('pdb', 0, 'A', (' ', 22, ' '))
('pdb', 0, 'A', (' ', 23, ' '))
</code></pre>

<p>So BioPython (ver. 1.66) gives 22 and 23 as expected.</p>

CC BY-SA 3.0
2017-08-03T21:11:00.380Z
Thank you! I'm soo sorry, I've found a bug in my code after 2 days of searching, and everything's working now (I forgot that I passed a pre-processed PDB to my program rather than the original one) . Thank you for your time and sorry that it's not a very useful question! Do you think I should delete it?
GingerBadger
CC BY-SA 3.0
2017-08-03T13:45:40.647Z
2017-08-03T13:45:40.647Z
marcin
<p>I have a PDB file, and I need to extract its residue sequence numbers (resSeq's). Based on manual inspection of the first few lines of the PDB file (pasted below), I would think that resSeq's should begin with 22, 23. However, Biopython's PDB module suggests otherwise (output attached below as well). I wonder if it's a Biopython bug or if I have problems understanding the PDB format. </p>

<pre><code>ATOM      1  N   GLY A  22      78.171  89.858  59.231  1.00 21.24           N  
ATOM      2  CA  GLY A  22      79.174  88.827  58.999  1.00 20.87           C  
ATOM      3  C   GLY A  22      80.438  89.415  58.391  1.00 21.89           C  
ATOM      4  O   GLY A  22      80.362  90.202  57.440  1.00 23.18           O  
ATOM      5  N   LEU A  23      81.588  89.069  58.972  1.00 21.51           N  
ATOM      6  CA  LEU A  23      82.895  89.555  58.527  1.00 20.80           C  
ATOM      7  C   LEU A  23      83.288  89.020  57.162  1.00 22.41           C  
ATOM      8  O   LEU A  23      82.889  87.923  56.788  1.00 22.93           O  
ATOM      9  CB  LEU A  23      83.973  89.232  59.560  1.00 20.97           C  
ATOM     10  CG  LEU A  23      84.225  87.818  60.062  1.00 13.32           C  
ATOM     11  CD1 LEU A  23      85.448  87.888  60.939  1.00 15.24           C  
ATOM     12  CD2 LEU A  23      83.035  87.258  60.829  1.00 12.21           C  
</code></pre>

<p>&nbsp;</p>

<pre><code>...
for i in chain:
    print i.get_full_id()

OUT:('pdb', 0, 'A', (' ', 2, ' '))
    ('pdb', 0, 'A', (' ', 3, ' '))
...
</code></pre>

CC BY-SA 3.0
2017-08-03T09:20:11.860Z
Please post the *complete* relevant code. I.e. how is `chain` exactly defined?
Konrad Rudolph
CC BY-SA 3.0
2017-08-03T10:46:35.740Z
And assuming this is a public PDB file, what is the four character identifier so people can try the example themselves to help you.
Peter Cock
<pdb><python>
Biopython: resseq doesn't match pdb file
# Biopython: resseq doesn't match pdb file

(Asked by: username_0 on 2017-08-02)

I have a PDB file, and I need to extract its residue sequence numbers (resSeq's). Based on manual inspection of the first few lines of the PDB file (pasted below), I would think that resSeq's should begin with 22, 23. However, Biopython's PDB module suggests otherwise (output attached below as well). I wonder if it's a Biopython bug or if I have problems understanding the PDB format. 
ATOM      1  N   GLY A  22      78.171  89.858  59.231  1.00 21.24           N  
ATOM      2  CA  GLY A  22      79.174  88.827  58.999  1.00 20.87           C  
ATOM      3  C   GLY A  22      80.438  89.415  58.391  1.00 21.89           C  
ATOM      4  O   GLY A  22      80.362  90.202  57.440  1.00 23.18           O  
ATOM      5  N   LEU A  23      81.588  89.069  58.972  1.00 21.51           N  
ATOM      6  CA  LEU A  23      82.895  89.555  58.527  1.00 20.80           C  
ATOM      7  C   LEU A  23      83.288  89.020  57.162  1.00 22.41           C  
ATOM      8  O   LEU A  23      82.889  87.923  56.788  1.00 22.93           O  
ATOM      9  CB  LEU A  23      83.973  89.232  59.560  1.00 20.97           C  
ATOM     10  CG  LEU A  23      84.225  87.818  60.062  1.00 13.32           C  
ATOM     11  CD1 LEU A  23      85.448  87.888  60.939  1.00 15.24           C  
ATOM     12  CD2 LEU A  23      83.035  87.258  60.829  1.00 12.21           C  

 
...
for i in chain:
    print i.get_full_id()

OUT:('pdb', 0, 'A', (' ', 2, ' '))
    ('pdb', 0, 'A', (' ', 3, ' '))
...

**Tags:** pdb, python
> **Comments:**
> **username_1**: Please post the *complete* relevant code. I.e. how is `chain` exactly defined?  
> **username_2**: And assuming this is a public PDB file, what is the four character identifier so people can try the example themselves to help you.  

---

## 1 answers

### Answer by username_3 on 2017-08-03. Score: 3

Let's check it. I copied your file fragment into a.pdb.
>>> from Bio import PDB
>>> for res in PDB.PDBParser().get_structure('pdb', 'a.pdb')[0].get_residues():
...   print(res.get_full_id())
... 
('pdb', 0, 'A', (' ', 22, ' '))
('pdb', 0, 'A', (' ', 23, ' '))

So BioPython (ver. 1.66) gives 22 and 23 as expected.

> **Comments:**
> **username_0**: Thank you! I'm soo sorry, I've found a bug in my code after 2 days of searching, and everything's working now (I forgot that I passed a pre-processed PDB to my program rather than the original one) . Thank you for your time and sorry that it's not a very useful question! Do you think I should delete it?  

---

