Skip to content

Bio.PDB.Residue raises AssertionError for two alternative 'shifted' conformations #302

Closed

Description

@touwwouter

An AssertionError is raised by StructureBuilder/Residue for two alternative 'shifted' polypeptide stretches (4aph chain P). In the 4aph paper (http://dx.doi.org/10.1038/srep00717) the authors describe that they observed two different conformation of the peptides, shifted by one residue. In the first conformation residues 1 to 6 were fitted (Asp-Arg-Val-Tyr-Ile-His). In the second conformation residues 2-7 (Arg-Val-Tyr-Ile-His-Pro) were fitted. Both conformations were modeled with 50% occupancy.

Under normal circumstances the AssertionError makes sense, but I would like to continue creating a Bio.PDB.Structure for entries like 4aph without catching the AssertionError. I hope this issue can be fixed.

Biopython version 1.63:
-----------------------
>>> from Bio import PDB       
>>> p = PDB.PDBParser()
>>> s = p.get_structure("4aph", "pdb4aph.ent")
/usr/lib/pymodules/python2.7/Bio/PDB/StructureBuilder.py:121: PDBConstructionWarning: WARNING: Residue (' ', 2, ' ') redefined at line 10334.
  PDBConstructionWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/Bio/PDB/PDBParser.py", line 82, in get_structure
    self._parse(handle.readlines())
  File "/usr/lib/pymodules/python2.7/Bio/PDB/PDBParser.py", line 108, in _parse
    self.trailer=self._parse_coordinates(coords_trailer)
  File "/usr/lib/pymodules/python2.7/Bio/PDB/PDBParser.py", line 219, in _parse_coordinates
    structure_builder.init_residue(resname, hetero_flag, resseq, icode)
  File "/usr/lib/pymodules/python2.7/Bio/PDB/StructureBuilder.py", line 153, in init_residue
    disordered_residue.disordered_add(new_residue)
  File "/usr/lib/pymodules/python2.7/Bio/PDB/Residue.py", line 160, in disordered_add
    assert(not self.disordered_has_id(resname))
AssertionError

Activity

  1. JoaoRodrigues commented on Mar 21, 2014

    @JoaoRodrigues
    Member

    Hi there,

    The PDB format specification says the following: "ATOM records for proteins are listed from amino to carboxyl terminus". This file is clearly not abiding to this. The parser reads the file sequentially and then tries to start a new residue when it sees ARG 2 showing up again, but since it has no insertion code it considers it as the same residue and fails.. If we remove this assertion, you could potentially overwrite atoms.

    If you sort your files before parsing them it should work fine (example script below):

    https://gist.github.com/JoaoRodrigues/9689449

  2. touwwouter commented on Mar 21, 2014

    @touwwouter
    Author

    Hi Joao,

    The residues in chain P all have insertion codes but indeed are not listed from N to C. Instead, P conformation 1 (insertion code A) is listed first, and P conformation 2 (insertion code B) is listed second. Sorting therefore solves the problem, but don't you agree that should not be necessary as insertion codes are present? Of course I agree we want to avoid overwriting atoms.

    Cheers,
    Wouter

  3. JoaoRodrigues commented on Mar 21, 2014

    @JoaoRodrigues
    Member

    Hi Wouter,

    Changing that would require a complete change to the parser actually. We
    would have to read all atoms, sort them like I did in the script, and then
    parse them. Since this a very fringe case resulting from bad behaviour from
    the experimentalists ( :) ) I doubt it is worth it..

    I can look into it to see if there is an easier way, but indeed it's a bit
    too "exotic" to deserve a change.

    Cheers,

    João

    2014-03-21 17:57 GMT+01:00 touwwouter [email protected]:

    Hi Joao,

    The residues in chain P all have insertion codes but indeed are not listed
    from N to C. Instead, P conformation 1 (insertion code A) is listed first,
    and P conformation 2 (insertion code B) is listed second. Sorting therefore
    solves the problem, but don't you agree that should not be necessary as
    insertion codes are present? Of course I agree we want to avoid overwriting
    atoms.

    Cheers,
    Wouter

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/302#issuecomment-38297695
    .

  4. touwwouter commented on Apr 17, 2014

    @touwwouter
    Author

    Hi João,

    It might not be as exotic as we initially thought it to be. According to the most recent format docs (v3.3, http://www.wwpdb.org/documentation/format33/sect9.html#ATOM) this behaviour is allowed:

    For atoms that are in alternate sites indicated by the alternate site indicator, sorting of atoms in the ATOM/HETATM list uses the following general rules:
    
    - In the simple case that involves a few  atoms or a few residues with alternate sites, 
      the coordinates occur one after  the other in the entry.
    - In the case of a large heterogen groups  which are disordered, the atoms for each conformer 
      are listed together.
    

    Therefore it might indeed be worth it to see if there is an easy way to prepare the parser for future cases like 4aph.

    Cheers,
    Wouter

  5. JoaoRodrigues commented on Apr 17, 2014

    @JoaoRodrigues
    Member

    Hi Wouter,

    Thanks for the update, I'll have a look at it this weekend.

    Cheers,
    João
    Em 17/04/2014 10:07, "touwwouter" [email protected] escreveu:

    Hi João,

    It might not be as exotic as we initially thought it to be. According to
    the most recent format docs (v3.3,
    http://www.wwpdb.org/documentation/format33/sect9.html#ATOM) this
    behaviour is allowed:

    For atoms that are in alternate sites indicated by the alternate site indicator, sorting of atoms in the ATOM/HETATM list uses the following general rules:

    • In the simple case that involves a few atoms or a few residues with alternate sites,
      the coordinates occur one after the other in the entry.
    • In the case of a large heterogen groups which are disordered, the atoms for each conformer
      are listed together.

    Therefore it might indeed be worth it to see if there is an easy way to
    prepare the parser for future cases like 4aph.

    Cheers,
    Wouter

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/302#issuecomment-40690757
    .

  6. chebizarro commented on Jul 23, 2020

    @chebizarro
    Contributor

    It looks like a fix for this issue was merged with commit a6c8e9b, can this issue be closed now?

  7. peterjc commented on Jul 23, 2020

    @peterjc
    Member

    I think you're right Chris, thanks - closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions