You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bio.PDB.Residue raises AssertionError for two alternative 'shifted' conformations #302
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
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):
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.
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.
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
.
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.
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
.
Activity
JoaoRodrigues commentedon Mar 21, 2014
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
touwwouter commentedon Mar 21, 2014
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
JoaoRodrigues commentedon Mar 21, 2014
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]:
touwwouter commentedon Apr 17, 2014
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:
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
JoaoRodrigues commentedon Apr 17, 2014
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:
Fixed disordered residue issue #302
Thank Franco Caramia for disordered residue fix
chebizarro commentedon Jul 23, 2020
It looks like a fix for this issue was merged with commit a6c8e9b, can this issue be closed now?
peterjc commentedon Jul 23, 2020
I think you're right Chris, thanks - closing.