[Biopython-dev] Python 2.4 / Adding QUIET argument to PDBParser()
Peter Cock
p.j.a.cock at googlemail.com
Fri May 6 09:31:50 UTC 2011
On Fri, May 6, 2011 at 10:25 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Fri, May 6, 2011 at 8:54 AM, João Rodrigues <anaryin at gmail.com> wrote:
>> Hello all,
>>
>> The PDBParser is sometimes a bit too loud, making meaningful output drown in
>> dozens of warnings messages. This is partly (mostly) my fault because of the
>> element guessing addition. Therefore, I'd suggest adding a QUIET argument
>> (bool) to PDBParser that would supress all warnings. Of course, default is
>> False. It might come handy for batch processing of proteins.
>>
>> I've added it to my pdb_enhancements branch so you can take a look:
>>
>> https://github.com/JoaoRodrigues/biopython/commit/5405d8a4cc555bcfce6ad0915db62a131cee9493
>>
>
> I had a look and Joao and I have been having a little
> discussion with the github comments feature.
>
> There are two ways to solve this,
> (1) Have a flag which controls issuing the warning
> (2) Filter out PDBConstructionWarning messages
>
> The first approach is messy as the flag needs to passed
> down to any relevant object (or done as a global which is
> nasty).
>
> The second approach requires a temporary warnings filter,
> which I think would easily done with the context manager
> warnings.catch_warnings() in Python 2.5+
Arhh, Jaoa just pointed out warnings.catch_warnings() is
in Python 2.6+ so we have to wait a while longer before
we can use that :(
Peter
More information about the Biopython-dev
mailing list