[Biopython-dev] Code review request for phyloxml branch

Eric Talevich eric.talevich at gmail.com
Mon Jan 11 11:43:01 EST 2010


On Mon, Jan 11, 2010 at 11:17 AM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> On Mon, Jan 11, 2010 at 3:02 PM, Michiel de Hoon wrote:
>>
>> On Mon, 1/11/10, Peter wrote:
>>> What is the benefit of having them also exposed under the
>>> Bio.Phylo namespace, e.g. as Bio.Phylo.read? This means
>>> there are two ways to access them which is confusing.
>>
>> If we use Bio.Phylo.IO.read directly, then for consistency we'd have
>> to do the same for all other modules. Otherwise, we'd be guessing
>> each time whether the read() and parse() functions are in
>> Bio.SomeModule, or Bio.SomeModule.IO.
>
> Fair point.
>
>> For Bio.Phylo, a simple solution is to put whatever is in
>> Bio.Phylo.IO.__init__.py in Bio.Phylo.__init__.py, and
>> remove Bio.Phylo.IO.__init__.py. Then there is only one
>> way to access the read() etc. functions.
>
> Or (if the functions are reasonably complex) keep the
> input/output code in a separate file, but make it explicit
> that it is not a public interface - e.g. use Bio/Phylo/_IO.py?

Something like this?

Phylo/
    BaseTree.py
    Newick.py
    PhyloXML.py
    _IO.py
    _Utils.py
    PhyloXMLIO.py
    NewickIO.py
    NexusIO.py

This plays well with the expected import styles:

from Bio import Phylo  # most common
from Bio.Phylo import PhyloXML  # access the defined types
from Bio.Phylo import PhyloXMLIO  # special parsing


More information about the Biopython-dev mailing list