[Biopython-dev] Bio.GFF and Brad's code

Michiel de Hoon mjldehoon at yahoo.com
Wed Dec 2 14:29:27 UTC 2009


--- On Wed, 12/2/09, Brad Chapman <chapmanb at 50mail.com> wrote:
> If I crank that out what do we think about putting it in
> with the __init__.py modifications I suggested?

I'd definitely welcome a GFF parser in Biopython, but I think the current code needs to be simplified and its usage more consistent with other Biopython modules. It's great that the documentation is available. It's a big help in designing the module, in particular what its usage looks like to the user.

Let's start from basic GFF parsing. This is the example in the documentation:

>>> from BCBio.GFF import GFFParser
>>> in_file = "your_file.gff"
>>> parser = GFFParser()
>>> in_handle = open(in_file)
>>> for rec in parser.parse(in_handle):
...    print rec
>>> in_handle.close()

What is the purpose of creating the parser first, and then calling parser.parse on the in_handle? I'd much rather have

>>> from BCBio import GFF
>>> in_file = "your_file.gff"
>>> in_handle = open(in_file)
>>> for rec in GFF.parse(in_handle):
...    print rec
>>> in_handle.close()

which is how most other Biopython parsers work.

--Michiel.


      



More information about the Biopython-dev mailing list