Answers.Body: <p>OK, lets say you need that information for <code>2PE4.pdb</code>, if you look at its webpage on RCSB PDB repository: <a href="https://www.rcsb.org/structure/2pe4" rel="nofollow noreferrer">2PE4</a> and display its .pdb format file at <a href="https://files.rcsb.org/view/2PE4.pdb" rel="nofollow noreferrer">https://files.rcsb.org/view/2PE4.pdb</a>, you'll notice at <code>REMARK 465</code>:</p>
  <pre><code>REMARK 465                                                                      
  REMARK 465 MISSING RESIDUES                                                     
  REMARK 465 THE FOLLOWING RESIDUES WERE NOT LOCATED IN THE                       
  REMARK 465 EXPERIMENT. (M=MODEL NUMBER; RES=RESIDUE NAME; C=CHAIN               
  REMARK 465 IDENTIFIER; SSSEQ=SEQUENCE NUMBER; I=INSERTION CODE.)                
  REMARK 465                                                                      
  REMARK 465   M RES C SSSEQI                                                     
  REMARK 465     GLY A   437                                                      
  REMARK 465     HIS A   438                                                      
  REMARK 465     HIS A   439                                                      
  REMARK 465     HIS A   440                                                      
  REMARK 465     HIS A   441                                                      
  REMARK 465     HIS A   442                                                      
  REMARK 465     HIS A   443            
  </code></pre>
  <p>this should be the missing residues from the full peptide sequence of the protein that is listed as SEQRES:</p>
  <pre><code>SEQRES   1 A  424  ARG SER PHE ARG GLY PRO LEU LEU PRO ASN ARG PRO PHE          
  SEQRES   2 A  424  THR THR VAL TRP ASN ALA ASN THR GLN TRP CYS LEU GLU          
  SEQRES   3 A  424  ARG HIS GLY VAL ASP VAL ASP VAL SER VAL PHE ASP VAL          
  SEQRES   4 A  424  VAL ALA ASN PRO GLY GLN THR PHE ARG GLY PRO ASP MET          
  SEQRES   5 A  424  THR ILE PHE TYR SER SER GLN LEU GLY THR TYR PRO TYR          
  SEQRES   6 A  424  TYR THR PRO THR GLY GLU PRO VAL PHE GLY GLY LEU PRO          
  SEQRES   7 A  424  GLN ASN ALA SER LEU ILE ALA HIS LEU ALA ARG THR PHE          
  SEQRES   8 A  424  GLN ASP ILE LEU ALA ALA ILE PRO ALA PRO ASP PHE SER          
  SEQRES   9 A  424  GLY LEU ALA VAL ILE ASP TRP GLU ALA TRP ARG PRO ARG          
  SEQRES  10 A  424  TRP ALA PHE ASN TRP ASP THR LYS ASP ILE TYR ARG GLN          
  SEQRES  11 A  424  ARG SER ARG ALA LEU VAL GLN ALA GLN HIS PRO ASP TRP          
  SEQRES  12 A  424  PRO ALA PRO GLN VAL GLU ALA VAL ALA GLN ASP GLN PHE          
  SEQRES  13 A  424  GLN GLY ALA ALA ARG ALA TRP MET ALA GLY THR LEU GLN          
  SEQRES  14 A  424  LEU GLY ARG ALA LEU ARG PRO ARG GLY LEU TRP GLY PHE          
  SEQRES  15 A  424  TYR GLY PHE PRO ASP CYS TYR ASN TYR ASP PHE LEU SER          
  SEQRES  16 A  424  PRO ASN TYR THR GLY GLN CYS PRO SER GLY ILE ARG ALA          
  SEQRES  17 A  424  GLN ASN ASP GLN LEU GLY TRP LEU TRP GLY GLN SER ARG          
  SEQRES  18 A  424  ALA LEU TYR PRO SER ILE TYR MET PRO ALA VAL LEU GLU          
  SEQRES  19 A  424  GLY THR GLY LYS SER GLN MET TYR VAL GLN HIS ARG VAL          
  SEQRES  20 A  424  ALA GLU ALA PHE ARG VAL ALA VAL ALA ALA GLY ASP PRO          
  SEQRES  21 A  424  ASN LEU PRO VAL LEU PRO TYR VAL GLN ILE PHE TYR ASP          
  SEQRES  22 A  424  THR THR ASN HIS PHE LEU PRO LEU ASP GLU LEU GLU HIS          
  SEQRES  23 A  424  SER LEU GLY GLU SER ALA ALA GLN GLY ALA ALA GLY VAL          
  SEQRES  24 A  424  VAL LEU TRP VAL SER TRP GLU ASN THR ARG THR LYS GLU          
  SEQRES  25 A  424  SER CYS GLN ALA ILE LYS GLU TYR MET ASP THR THR LEU          
  SEQRES  26 A  424  GLY PRO PHE ILE LEU ASN VAL THR SER GLY ALA LEU LEU          
  SEQRES  27 A  424  CYS SER GLN ALA LEU CYS SER GLY HIS GLY ARG CYS VAL          
  SEQRES  28 A  424  ARG ARG THR SER HIS PRO LYS ALA LEU LEU LEU LEU ASN          
  SEQRES  29 A  424  PRO ALA SER PHE SER ILE GLN LEU THR PRO GLY GLY GLY          
  SEQRES  30 A  424  PRO LEU SER LEU ARG GLY ALA LEU SER LEU GLU ASP GLN          
  SEQRES  31 A  424  ALA GLN MET ALA VAL GLU PHE LYS CYS ARG CYS TYR PRO          
  SEQRES  32 A  424  GLY TRP GLN ALA PRO TRP CYS GLU ARG LYS SER MET TRP          
  SEQRES  33 A  424  THR GLY HIS HIS HIS HIS HIS HIS  
  </code></pre>
  <p>Pay attention that the .pdb starts at residue position 20; that is a cloning artifact, as shown by:</p>
  <pre><code>SEQADV 2PE4 ARG A   20  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 SER A   21  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 THR A  436  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 GLY A  437  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 HIS A  438  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  439  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  440  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  441  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  442  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  443  UNP  Q12794              EXPRESSION TAG              
  </code></pre>
  <p>See <a href="https://bioinformatics.stackexchange.com/questions/14210/pdb-residue-numbering">PDB residue numbering</a></p>
  <p>Using <strong>Biopython</strong> lib you could try using <code>2pe4.cif</code> instead of .pdb file (<a href="https://files.rcsb.org/view/2PE4.cif" rel="nofollow noreferrer">https://files.rcsb.org/view/2PE4.cif</a>) as input :</p>
  <pre class="lang-py prettyprint-override"><code># First import MMCIF2Dict function
  from Bio.PDB.MMCIF2Dict import MMCIF2Dict
  
  # read in the CIF file.
  pdb_info = MMCIF2Dict(&quot;2pe4.cif&quot;)
  
  # 
  print(pdb_info[&quot;_pdbx_unobs_or_zero_occ_residues.label_seq_id&quot;])
  print(pdb_info[&quot;_pdbx_unobs_or_zero_occ_residues.label_comp_id&quot;])
  print(list(zip(pdb_info[&quot;_pdbx_unobs_or_zero_occ_residues.label_seq_id&quot;],
  pdb_info[&quot;_pdbx_unobs_or_zero_occ_residues.label_comp_id&quot;])))
  </code></pre>
  <p>Result:</p>
  <pre><code>['418', '419', '420', '421', '422', '423', '424']
  ['GLY', 'HIS', 'HIS', 'HIS', 'HIS', 'HIS', 'HIS']
  [('418', 'GLY'), ('419', 'HIS'), ('420', 'HIS'), ('421', 'HIS'), ('422', 'HIS'), ('423', 'HIS'), ('424', 'HIS')]        
  </code></pre>
  <p>but for this kind of stuff it's probably better suited</p>
  <p><a href="https://mmcif.wwpdb.org/docs/sw-examples/python/html/index.html" rel="nofollow noreferrer">PDBx Python Parser </a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-26T14:58:38.403Z
Answers.LastActivityDate: 2024-03-26T16:35:28.963Z
Answers.LastEditDate: 2024-03-26T16:35:28.963Z
Answers.UserDisplayName: pippo1980
Body: <p>One of the requirements of simulating the protein chain is to check for missing atoms or residues. I.e., using software tools to identify (and, if necessary, model) any missing regions.</p>
  <p>How can I check if a PDB file is complete or incomplete using Python?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-26T11:56:05.643Z
Comments.Text: Please [edit] your question and add more detail. Ideally, give us an incomplete file and a complete file so we can test any solutions. I know next to nothing about PDB files, so if the information is not in the file itself, you will also need to provide a way to compare it to something, so we would need to know what proteins you are aligning and from what species, so we can try and find the full sequences to check for completion.
Comments.UserDisplayName: terdon
Tags: <python><pdb>
Title: How can I check if a PDB file is incomplete?
ThreadText: # How can I check if a PDB file is incomplete?
  
  (Asked by: username_0 on 2024-03-26)
  
  One of the requirements of simulating the protein chain is to check for missing atoms or residues. I.e., using software tools to identify (and, if necessary, model) any missing regions.
  
  How can I check if a PDB file is complete or incomplete using Python?
  
  **Tags:** python, pdb
  
  > **Comments:**
  > **username_1**: Please [edit] your question and add more detail. Ideally, give us an incomplete file and a complete file so we can test any solutions. I know next to nothing about PDB files, so if the information is not in the file itself, you will also need to provide a way to compare it to something, so we would need to know what proteins you are aligning and from what species, so we can try and find the full sequences to check for completion.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-03-26. Score: 3 | Accepted answer
  
  OK, lets say you need that information for `2PE4.pdb`, if you look at its webpage on RCSB PDB repository: [2PE4](https://www.rcsb.org/structure/2pe4) and display its .pdb format file at <https://files.rcsb.org/view/2PE4.pdb>, you'll notice at `REMARK 465`:
  
  ```
  REMARK 465                                                                      
  REMARK 465 MISSING RESIDUES                                                     
  REMARK 465 THE FOLLOWING RESIDUES WERE NOT LOCATED IN THE                       
  REMARK 465 EXPERIMENT. (M=MODEL NUMBER; RES=RESIDUE NAME; C=CHAIN               
  REMARK 465 IDENTIFIER; SSSEQ=SEQUENCE NUMBER; I=INSERTION CODE.)                
  REMARK 465                                                                      
  REMARK 465   M RES C SSSEQI                                                     
  REMARK 465     GLY A   437                                                      
  REMARK 465     HIS A   438                                                      
  REMARK 465     HIS A   439                                                      
  REMARK 465     HIS A   440                                                      
  REMARK 465     HIS A   441                                                      
  REMARK 465     HIS A   442                                                      
  REMARK 465     HIS A   443            
  
  ```
  
  this should be the missing residues from the full peptide sequence of the protein that is listed as SEQRES:
  
  ```
  SEQRES   1 A  424  ARG SER PHE ARG GLY PRO LEU LEU PRO ASN ARG PRO PHE          
  SEQRES   2 A  424  THR THR VAL TRP ASN ALA ASN THR GLN TRP CYS LEU GLU          
  SEQRES   3 A  424  ARG HIS GLY VAL ASP VAL ASP VAL SER VAL PHE ASP VAL          
  SEQRES   4 A  424  VAL ALA ASN PRO GLY GLN THR PHE ARG GLY PRO ASP MET          
  SEQRES   5 A  424  THR ILE PHE TYR SER SER GLN LEU GLY THR TYR PRO TYR          
  SEQRES   6 A  424  TYR THR PRO THR GLY GLU PRO VAL PHE GLY GLY LEU PRO          
  SEQRES   7 A  424  GLN ASN ALA SER LEU ILE ALA HIS LEU ALA ARG THR PHE          
  SEQRES   8 A  424  GLN ASP ILE LEU ALA ALA ILE PRO ALA PRO ASP PHE SER          
  SEQRES   9 A  424  GLY LEU ALA VAL ILE ASP TRP GLU ALA TRP ARG PRO ARG          
  SEQRES  10 A  424  TRP ALA PHE ASN TRP ASP THR LYS ASP ILE TYR ARG GLN          
  SEQRES  11 A  424  ARG SER ARG ALA LEU VAL GLN ALA GLN HIS PRO ASP TRP          
  SEQRES  12 A  424  PRO ALA PRO GLN VAL GLU ALA VAL ALA GLN ASP GLN PHE          
  SEQRES  13 A  424  GLN GLY ALA ALA ARG ALA TRP MET ALA GLY THR LEU GLN          
  SEQRES  14 A  424  LEU GLY ARG ALA LEU ARG PRO ARG GLY LEU TRP GLY PHE          
  SEQRES  15 A  424  TYR GLY PHE PRO ASP CYS TYR ASN TYR ASP PHE LEU SER          
  SEQRES  16 A  424  PRO ASN TYR THR GLY GLN CYS PRO SER GLY ILE ARG ALA          
  SEQRES  17 A  424  GLN ASN ASP GLN LEU GLY TRP LEU TRP GLY GLN SER ARG          
  SEQRES  18 A  424  ALA LEU TYR PRO SER ILE TYR MET PRO ALA VAL LEU GLU          
  SEQRES  19 A  424  GLY THR GLY LYS SER GLN MET TYR VAL GLN HIS ARG VAL          
  SEQRES  20 A  424  ALA GLU ALA PHE ARG VAL ALA VAL ALA ALA GLY ASP PRO          
  SEQRES  21 A  424  ASN LEU PRO VAL LEU PRO TYR VAL GLN ILE PHE TYR ASP          
  SEQRES  22 A  424  THR THR ASN HIS PHE LEU PRO LEU ASP GLU LEU GLU HIS          
  SEQRES  23 A  424  SER LEU GLY GLU SER ALA ALA GLN GLY ALA ALA GLY VAL          
  SEQRES  24 A  424  VAL LEU TRP VAL SER TRP GLU ASN THR ARG THR LYS GLU          
  SEQRES  25 A  424  SER CYS GLN ALA ILE LYS GLU TYR MET ASP THR THR LEU          
  SEQRES  26 A  424  GLY PRO PHE ILE LEU ASN VAL THR SER GLY ALA LEU LEU          
  SEQRES  27 A  424  CYS SER GLN ALA LEU CYS SER GLY HIS GLY ARG CYS VAL          
  SEQRES  28 A  424  ARG ARG THR SER HIS PRO LYS ALA LEU LEU LEU LEU ASN          
  SEQRES  29 A  424  PRO ALA SER PHE SER ILE GLN LEU THR PRO GLY GLY GLY          
  SEQRES  30 A  424  PRO LEU SER LEU ARG GLY ALA LEU SER LEU GLU ASP GLN          
  SEQRES  31 A  424  ALA GLN MET ALA VAL GLU PHE LYS CYS ARG CYS TYR PRO          
  SEQRES  32 A  424  GLY TRP GLN ALA PRO TRP CYS GLU ARG LYS SER MET TRP          
  SEQRES  33 A  424  THR GLY HIS HIS HIS HIS HIS HIS  
  
  ```
  
  Pay attention that the .pdb starts at residue position 20; that is a cloning artifact, as shown by:
  
  ```
  SEQADV 2PE4 ARG A   20  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 SER A   21  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 THR A  436  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 GLY A  437  UNP  Q12794              CLONING ARTIFACT               
  SEQADV 2PE4 HIS A  438  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  439  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  440  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  441  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  442  UNP  Q12794              EXPRESSION TAG                 
  SEQADV 2PE4 HIS A  443  UNP  Q12794              EXPRESSION TAG              
  
  ```
  
  See [PDB residue numbering](https://bioinformatics.stackexchange.com/questions/14210/pdb-residue-numbering)
  
  Using **Biopython** lib you could try using `2pe4.cif` instead of .pdb file (<https://files.rcsb.org/view/2PE4.cif>) as input :
  
  ```py
  # First import MMCIF2Dict function
  from Bio.PDB.MMCIF2Dict import MMCIF2Dict
  
  # read in the CIF file.
  pdb_info = MMCIF2Dict("2pe4.cif")
  
  # 
  print(pdb_info["_pdbx_unobs_or_zero_occ_residues.label_seq_id"])
  print(pdb_info["_pdbx_unobs_or_zero_occ_residues.label_comp_id"])
  print(list(zip(pdb_info["_pdbx_unobs_or_zero_occ_residues.label_seq_id"],
  pdb_info["_pdbx_unobs_or_zero_occ_residues.label_comp_id"])))
  
  ```
  
  Result:
  
  ```
  ['418', '419', '420', '421', '422', '423', '424']
  ['GLY', 'HIS', 'HIS', 'HIS', 'HIS', 'HIS', 'HIS']
  [('418', 'GLY'), ('419', 'HIS'), ('420', 'HIS'), ('421', 'HIS'), ('422', 'HIS'), ('423', 'HIS'), ('424', 'HIS')]        
  
  ```
  
  but for this kind of stuff it's probably better suited
  
  [PDBx Python Parser](https://mmcif.wwpdb.org/docs/sw-examples/python/html/index.html)
  
  
  ---
  
  