Using Biopython's PDB Header parser to get missing residues

Previously this worked out and had to be run at that time with a development version of Biopython that I got working here. Now current Bioython has the essential functionality about missing residues in structure files, and so this notebook can be run here where the current Biopython is installed.

You may also be interested in the notebook entitled, 'Using Biopython's PDB module to list resolved residues and construct fit commands'. Think of this notebook as complementing that one. Depending on what you are trying to do (or use as the source of information), that one may be better suited.

In [1]:
#get stuctures
import os
files_needed = ["6AGB.pdb","6AH3.pdb"]
for file_needed in files_needed:
    if not os.path.isfile(file_needed):
        #os.system(f"curl -OL https://files.rcsb.org/download/{file_needed}.gz") #version of next line that works outside Jupyter/IPython
        !curl -OL https://files.rcsb.org/download/{file_needed}.gz # gives more feedback in Jupyter
        # os.system(f"gunzip {file_needed}.gz") #version of next line that works outside Jupyter/IPYthon
        !gunzip {file_needed}.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  491k  100  491k    0     0   666k      0 --:--:-- --:--:-- --:--:--  665k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  519k  100  519k    0     0   872k      0 --:--:-- --:--:-- --:--:--  871k
In [2]:
from Bio.PDB import *
h =parse_pdb_header('6AGB.pdb')
h['has_missing_residues']
Out[2]:
True
In [3]:
from Bio.PDB import *
h =parse_pdb_header('6AGB.pdb')
h['missing_residues']
Out[3]:
[{'model': None,
  'res_name': 'MET',
  'chain': 'B',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 2,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 3,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 4,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 5,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 6,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 7,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 8,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 9,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 10,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 11,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 12,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 13,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'B',
  'ssseq': 14,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 15,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 16,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 17,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 18,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'B',
  'ssseq': 19,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 20,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 21,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 22,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 23,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 24,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 25,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'B',
  'ssseq': 26,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 27,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 28,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 29,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 30,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 31,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'B',
  'ssseq': 32,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 33,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 34,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'B',
  'ssseq': 35,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 36,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'B',
  'ssseq': 37,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 38,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 39,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 40,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 41,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'B',
  'ssseq': 42,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 43,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'B',
  'ssseq': 44,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 45,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'B',
  'ssseq': 46,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'B',
  'ssseq': 47,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 48,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'B',
  'ssseq': 49,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 50,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 51,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'B',
  'ssseq': 52,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 53,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'B',
  'ssseq': 125,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'B',
  'ssseq': 126,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'B',
  'ssseq': 127,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'B',
  'ssseq': 128,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'B',
  'ssseq': 129,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 130,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 131,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 132,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 133,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 134,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 135,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 136,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'B',
  'ssseq': 137,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 138,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'B',
  'ssseq': 525,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 526,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 527,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'B',
  'ssseq': 528,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 529,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 686,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 687,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'B',
  'ssseq': 688,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'B',
  'ssseq': 689,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'B',
  'ssseq': 690,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'B',
  'ssseq': 691,
  'insertion': None},
 {'model': None,
  'res_name': 'PHE',
  'chain': 'B',
  'ssseq': 692,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 693,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'B',
  'ssseq': 694,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'B',
  'ssseq': 695,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'B',
  'ssseq': 743,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'B',
  'ssseq': 744,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 745,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'B',
  'ssseq': 746,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 747,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'B',
  'ssseq': 748,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'B',
  'ssseq': 749,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 750,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'B',
  'ssseq': 751,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'C',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'C',
  'ssseq': 2,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'C',
  'ssseq': 3,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'C',
  'ssseq': 4,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'C',
  'ssseq': 5,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 6,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'C',
  'ssseq': 7,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'C',
  'ssseq': 8,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'C',
  'ssseq': 9,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 10,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 11,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'C',
  'ssseq': 12,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'C',
  'ssseq': 13,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'C',
  'ssseq': 189,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'C',
  'ssseq': 190,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 191,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 192,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'C',
  'ssseq': 193,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'C',
  'ssseq': 194,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'C',
  'ssseq': 195,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'D',
  'ssseq': 25,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'D',
  'ssseq': 26,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'D',
  'ssseq': 27,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'D',
  'ssseq': 28,
  'insertion': None},
 {'model': None,
  'res_name': 'PHE',
  'chain': 'D',
  'ssseq': 29,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 30,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'D',
  'ssseq': 31,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'D',
  'ssseq': 32,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 33,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 34,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 35,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 36,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'D',
  'ssseq': 37,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'D',
  'ssseq': 38,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'D',
  'ssseq': 39,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'D',
  'ssseq': 40,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'D',
  'ssseq': 41,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 42,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'D',
  'ssseq': 43,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'D',
  'ssseq': 44,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'D',
  'ssseq': 45,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 46,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 47,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'D',
  'ssseq': 48,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 49,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 50,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'D',
  'ssseq': 51,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'D',
  'ssseq': 52,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'D',
  'ssseq': 53,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'D',
  'ssseq': 54,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 55,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'D',
  'ssseq': 56,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 57,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'D',
  'ssseq': 58,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'D',
  'ssseq': 59,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 60,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 61,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'D',
  'ssseq': 62,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'D',
  'ssseq': 63,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'D',
  'ssseq': 64,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 65,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 66,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'D',
  'ssseq': 67,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'D',
  'ssseq': 68,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'D',
  'ssseq': 69,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'D',
  'ssseq': 70,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'D',
  'ssseq': 71,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'D',
  'ssseq': 72,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'D',
  'ssseq': 73,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'D',
  'ssseq': 74,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'D',
  'ssseq': 75,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'D',
  'ssseq': 76,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'E',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'E',
  'ssseq': 148,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'E',
  'ssseq': 149,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'E',
  'ssseq': 150,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'E',
  'ssseq': 151,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'E',
  'ssseq': 152,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'E',
  'ssseq': 153,
  'insertion': None},
 {'model': None,
  'res_name': 'PHE',
  'chain': 'E',
  'ssseq': 154,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'E',
  'ssseq': 155,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'E',
  'ssseq': 156,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'E',
  'ssseq': 157,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'E',
  'ssseq': 158,
  'insertion': None},
 {'model': None,
  'res_name': 'PHE',
  'chain': 'E',
  'ssseq': 159,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'E',
  'ssseq': 160,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'E',
  'ssseq': 161,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'E',
  'ssseq': 162,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'E',
  'ssseq': 163,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'E',
  'ssseq': 164,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'E',
  'ssseq': 165,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'E',
  'ssseq': 166,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'E',
  'ssseq': 167,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'E',
  'ssseq': 168,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'E',
  'ssseq': 169,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'E',
  'ssseq': 170,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'E',
  'ssseq': 171,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'E',
  'ssseq': 172,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'E',
  'ssseq': 173,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'F',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'G',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'G',
  'ssseq': 2,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'G',
  'ssseq': 3,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'G',
  'ssseq': 4,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'G',
  'ssseq': 5,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'G',
  'ssseq': 6,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'G',
  'ssseq': 7,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'G',
  'ssseq': 8,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'G',
  'ssseq': 9,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'G',
  'ssseq': 10,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'G',
  'ssseq': 11,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'G',
  'ssseq': 12,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'G',
  'ssseq': 108,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'G',
  'ssseq': 109,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'G',
  'ssseq': 110,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'G',
  'ssseq': 111,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'G',
  'ssseq': 112,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'G',
  'ssseq': 113,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'G',
  'ssseq': 114,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'H',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'H',
  'ssseq': 2,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'I',
  'ssseq': 243,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'I',
  'ssseq': 244,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'I',
  'ssseq': 245,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'I',
  'ssseq': 246,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'I',
  'ssseq': 247,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 248,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'I',
  'ssseq': 249,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 250,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 251,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 252,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'I',
  'ssseq': 253,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 254,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'I',
  'ssseq': 255,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 256,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 257,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 258,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 259,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 260,
  'insertion': None},
 {'model': None,
  'res_name': 'ASN',
  'chain': 'I',
  'ssseq': 261,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 262,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 263,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'I',
  'ssseq': 264,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 265,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'I',
  'ssseq': 266,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 267,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 268,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 269,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'I',
  'ssseq': 270,
  'insertion': None},
 {'model': None,
  'res_name': 'THR',
  'chain': 'I',
  'ssseq': 271,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'I',
  'ssseq': 272,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'I',
  'ssseq': 273,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 274,
  'insertion': None},
 {'model': None,
  'res_name': 'VAL',
  'chain': 'I',
  'ssseq': 275,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'I',
  'ssseq': 276,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'I',
  'ssseq': 277,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'I',
  'ssseq': 278,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'I',
  'ssseq': 279,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'I',
  'ssseq': 280,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'I',
  'ssseq': 281,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'I',
  'ssseq': 282,
  'insertion': None},
 {'model': None,
  'res_name': 'GLN',
  'chain': 'I',
  'ssseq': 283,
  'insertion': None},
 {'model': None,
  'res_name': 'LEU',
  'chain': 'I',
  'ssseq': 284,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'I',
  'ssseq': 285,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'I',
  'ssseq': 286,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'I',
  'ssseq': 287,
  'insertion': None},
 {'model': None,
  'res_name': 'SER',
  'chain': 'I',
  'ssseq': 288,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'I',
  'ssseq': 289,
  'insertion': None},
 {'model': None,
  'res_name': 'ARG',
  'chain': 'I',
  'ssseq': 290,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'I',
  'ssseq': 291,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'I',
  'ssseq': 292,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'I',
  'ssseq': 293,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'K',
  'ssseq': 1,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'K',
  'ssseq': 2,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'K',
  'ssseq': 3,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'K',
  'ssseq': 4,
  'insertion': None},
 {'model': None,
  'res_name': 'ALA',
  'chain': 'K',
  'ssseq': 5,
  'insertion': None},
 {'model': None,
  'res_name': 'HIS',
  'chain': 'K',
  'ssseq': 6,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'K',
  'ssseq': 7,
  'insertion': None},
 {'model': None,
  'res_name': 'GLY',
  'chain': 'K',
  'ssseq': 8,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'K',
  'ssseq': 9,
  'insertion': None},
 {'model': None,
  'res_name': 'MET',
  'chain': 'K',
  'ssseq': 10,
  'insertion': None},
 {'model': None,
  'res_name': 'LYS',
  'chain': 'K',
  'ssseq': 11,
  'insertion': None},
 {'model': None,
  'res_name': 'PRO',
  'chain': 'K',
  'ssseq': 12,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'K',
  'ssseq': 13,
  'insertion': None},
 {'model': None,
  'res_name': 'ILE',
  'chain': 'K',
  'ssseq': 14,
  'insertion': None},
 {'model': None,
  'res_name': 'ASP',
  'chain': 'K',
  'ssseq': 15,
  'insertion': None},
 {'model': None,
  'res_name': 'GLU',
  'chain': 'K',
  'ssseq': 16,
  'insertion': None}]
In [4]:
# Missing residue positions for specific chains
from Bio.PDB import *
from collections import defaultdict
h =parse_pdb_header('6AGB.pdb')
#parse per chain
chains_of_interest = ["F","G"]
# make a dictionary for each chain of interest with value of a list. The list will be the list of residues later
missing_per_chain = defaultdict(list)
# go through missing residues and populate each chain's list
for residue in h['missing_residues']:
    if residue["chain"] in chains_of_interest:
        missing_per_chain[residue["chain"]].append(residue["ssseq"])
#print(missing_per_chain)



print('')
print("Missing from chain 'G':\n{}".format(missing_per_chain['G']))
print('\n\n')
for chain in missing_per_chain:
    print(chain,missing_per_chain[chain])
Missing from chain 'G':
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114]



F [1]
G [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114]
In [5]:
# Missing residue positions for ALL chains
from Bio.PDB import *
from collections import defaultdict
# extract information on chains in structure
structure = PDBParser().get_structure('6AGB', '6AGB.pdb')
chains = [each.id for each in structure.get_chains()]

h =parse_pdb_header('6AGB.pdb')

# make a dictionary for each chain of interest with value of a list. The list will be the list of residue positions later
missing_per_chain = defaultdict(list)
# go through missing residues and populate each chain's list
for residue in h['missing_residues']:
    if residue["chain"] in chains:
        missing_per_chain[residue["chain"]].append(residue["ssseq"])
print(missing_per_chain)



print('')
print("Missing from chain 'K':\n{}".format(missing_per_chain['K']))
defaultdict(<class 'list'>, {'B': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 525, 526, 527, 528, 529, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 743, 744, 745, 746, 747, 748, 749, 750, 751], 'C': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 189, 190, 191, 192, 193, 194, 195], 'D': [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76], 'E': [1, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173], 'F': [1], 'G': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114], 'H': [1, 2], 'I': [243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293], 'K': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]})

Missing from chain 'K':
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]

Compare two structures

In [6]:
# Does 6AH3 have any residues missing that 6AGB doesn't, for chains shared between them?
from Bio.PDB import *
from collections import defaultdict
# extract information on chains in structure
structure = PDBParser().get_structure('6AGB', '6AGB.pdb') # USING CHAIN LISTING FROM THAT BECAUSE ONLY CARE ABOUT ONES SHARED
chains = [each.id for each in structure.get_chains()]

h =parse_pdb_header('6AH3.pdb')

# make a dictionary for each chain of interest with value of a list. The list will be the list of residue positions later
missing_per_chainh3 = defaultdict(list)
# go through missing residues and populate each chain's list
for residue in h['missing_residues']:
    if residue["chain"] in chains:
        missing_per_chainh3[residue["chain"]].append(residue["ssseq"])
print("Missing from chains in AGH3:\n{}".format(missing_per_chainh3))



print('')
print("Missing from chain 'K':\n{}".format(missing_per_chainh3['K']))

print ('')
same_result = missing_per_chainh3 == missing_per_chain
print("Same residues missing for chains shared by 6AGB and 6AH3?:\n{}".format(same_result))
print ('')
print("Chain by chain accounting of whether missing same residues between 6AGB and 6AH3?:")
same_residues_present_list = []
for chain in chains:
    print(chain)
    print (missing_per_chainh3[chain] == missing_per_chain[chain])
    if missing_per_chainh3[chain] != missing_per_chain[chain]:
        same_residues_present_list.append(chain)
print("\n\nFurther details on those chains where not the same residues missing:")
for chain in same_residues_present_list:
    print("chain '{}' in 6AH3 has more missing residues than 6AGB:\n{}".format(chain,len(missing_per_chainh3[chain]) > len(missing_per_chain[chain]) ))
    print("\ntotal # residues missing in chain '{}' of 6AH3: {}".format(chain,len(missing_per_chainh3[chain]) ))
    print("total # residues missing in chain '{}' of 6AGB: {}\n".format(chain,len(missing_per_chain[chain]) ))
Missing from chains in AGH3:
defaultdict(<class 'list'>, {'B': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 525, 526, 527, 528, 529, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 743, 744, 745, 746, 747, 748, 749, 750, 751], 'C': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 189, 190, 191, 192, 193, 194, 195], 'D': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76], 'E': [1, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173], 'F': [1], 'G': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114], 'H': [1, 2], 'I': [243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293], 'K': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]})

Missing from chain 'K':
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]

Same residues missing for chains shared by 6AGB and 6AH3?:
False

Chain by chain accounting of whether missing same residues between 6AGB and 6AH3?:
A
True
B
True
C
True
D
False
E
True
F
True
G
True
H
True
I
True
J
True
K
True


Further details on those chains where not the same residues missing:
chain 'D' in 6AH3 has more missing residues than 6AGB:
True

total # residues missing in chain 'D' of 6AH3: 76
total # residues missing in chain 'D' of 6AGB: 52

Chain D is the only one with differences. The one in 6AGB(without the substrate) has more residues total, as it has less missing. (Note that depending on how the gaps are distributed the the chain with the most residues may not have more information than the other for a region you are particularly interested in. It is just a rough metric and you should look into details. The 'Protein' tab at PDBsum is particularly useful for comparing missing residues in specific regions of proteins in structures.)

Python's set math can be used to look into some of the specific missing residues. Here that is done to provide some insight into the parts to examine for Chain D:

In [7]:
# How does Chain D compare specifically:
print("total missing:",len(missing_per_chain['D']))
print("total missing:",len(missing_per_chainh3['D']))
A= set(missing_per_chainh3['D'])
B= set(missing_per_chain['D']) 
print("These are missing in 6AH3 Chain D but present in 6AGB:",A-B) # set math based on https://stackoverflow.com/a/1830195/8508004
print("These are present in 6AH3 Chain D but missing in 6AGB:",B-A) # set math based on https://stackoverflow.com/a/1830195/8508004
total missing: 52
total missing: 76
These are missing in 6AH3 Chain D but present in 6AGB: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}
These are present in 6AH3 Chain D but missing in 6AGB: set()

Note that there are none present in 6AH3 Chain D but missing in 6AGB and so the result is an empty set for this case.