[Biopython-dev] [Bug 2754] Bio.PDB: Parse warnings should print to stderr, not stdout

Eric Talevich eric.talevich at gmail.com
Sun Mar 22 11:25:23 EDT 2009


On Sun, Mar 22, 2009 at 7:36 AM, <bugzilla-daemon at portal.open-bio.org>wrote:

> http://bugzilla.open-bio.org/show_bug.cgi?id=2754
>
>
>
> ------- Comment #12 from biopython-bugzilla at maubp.freeserve.co.uk 2009-03-22 07:36 EST -------
> I have a thought last night about this - how about we keep PERMISSIVE=1 as
> the
> default but offer a "very permissive" mode:
>
> PERMISSIVE=2 (or more), silently ignore problems, continue parsing.
> PERMISSIVE=1 (or True), use stderr via the warning module, continue
> parsing.
> PERMISSIVE=0 (or False), raise exceptions, halt parsing.
>
> It would ofter an alternative way to silence the warnings in the unit
> tests,
> and could be controlled at the level of individual tests - for example
> where we
> want to make sure certain errors are caught.
>
> It might also be useful in ordinary scripts.
>
>

I like the idea. I still have to comb through the documentation for the
warnings module some more, but I think it should be possible to do all of
this through that API -- loading PERMISSIVE=0 turns the warnings into full
exceptions, =1 makes them messages on stderr, and =2 switches them off.

At some point I'd like to make a script called something like pdbtidy.py
which parses a potentially not-quite-conformant PDB file in a permissive
mode, lists all complaints (including things like discontinuously-numbered
residues, atom collisions, psi-phi outliers, etc.), and writes out a fixed
version of the file. The model for this is HTML Tidy. Do you think this
would have a place in the Biopython distribution?


More information about the Biopython-dev mailing list