[BioPython] PDBConstructionException message

Michiel de Hoon mdehoon at c2b2.columbia.edu
Sat Jul 8 17:42:41 UTC 2006


 From looking at the Bio.PDB.PDBParser source code, it appears that
 >>> parser = PDBParser(PERMISSIVE=0)
should solve your problem.

Use
 >>> from Bio.PDB import *
 >>> help(PDBParser)
for more information.

--Michiel.


Gad Abraham wrote:
> Hi,
> 
> I apologise in advance if this question is trivial, but I'm a Python and 
> BioPython novice, and the mailing list search facility isn't working :)
> 
> I'm using Bio.PDB to parse the PDB file 1LUC, and write output to stdout 
> (running python inside a script, not shown here).
> 
> 
> 
> PDBParser seems to be throwing an exception, and its message goes to 
> stdout, even though I'm trying to catch it:
> 
> Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from Bio.PDB import *
>  >>> parser = PDBParser()
>  >>> try:
> ...     s = parser.get_structure('1LUC', 'pdb1luc')
> ... except:
> ...     print "Caught exception"
> ...
> PDBConstructionException: Atom O defined twice in residue <Residue GLN 
> het=  resseq=355 icode= > at line 2930.
> Exception ignored.
> Some atoms or residues will be missing in the data structure.
>  >>>
> 
> (biopython 1.41)
> 
> 
> 
> How can I either catch this exception or prevent the message from being 
> printed to stdout?
> 
> 
> Thanks,
> Gad
> 




More information about the Biopython mailing list