[Biopython-dev] Fwd: Where to put command line wrappers

Peter biopython at maubp.freeserve.co.uk
Thu Apr 23 21:21:41 UTC 2009


On Fri, Apr 17, 2009 at 3:02 PM, Brad Chapman <chapmanb at 50mail.com> wrote:
> Hi all;
>
> [Where to put the commandline objects]
>> >  I think that there is a difference between EMBOSS and
>> >  Bio.[Motif|Align]. In EMBOSS we have a very nicely comoditized
>> >  set of tools with similar interfaces, while both for multiple
>> >  alignment and motif searching the tools vary a lot. In case of
>> >  multiple alignments this is only with respect to parameters and
>> >  output format, while in motif searching there is also a lot of
>> >  differences in the types of input (background models etc.).
>>
>> That is a good argument for using Bio/Align/Applications/XXX.py and
>> Bio/Motif/Applications/XXX.py while also having
>> Bio/EMBOSS/Applications.py
>
> There is a natural tension between overgeneralizing and dumping
> too much into one file. At one end you have deeply nested Java-like
> directories with a few lines of code in each file. I tend towards the
> "more in a single file and less nesting" camp. My vote would be that
> if the Motif Applications file will only contain commandline
> wrappers, they could live in one file.

OK, what I propose is that the command line objects are exposed as
Bio.Align.Applications.MuscleCommandline,
Bio.Align.Applications.ClustalwCommandline, etc but that the
implementations live in Bio/Align/Applications/_Muscle.py,
_Clustalw.py etc.  To do this the Bio/Align/Applications/__init__.py
file will look like this:

from _Muscle import MuscleCommandline
from _Clustalw import ClustalwCommandline

This avoids having a single massive file, yet keeps the public
namespace simple.  For the user, they do this:

from Bio.Align.Applications import MuscleCommandline
cline = MuscleCommandline(...)

or if they prefer,

from Bio.Align import Applications
cline = Applications.MuscleCommandline(...)

>From the user's point of view all the alignment command line wrapper
objects live together under Bio.Align.Applications.

This will be consistent with the public API for the EMBOSS wrappers
where you can do:

from Bio.Emboss.Applications import Primer3Commandline
cline = Primer3Commandline(...)

or variants like that.

For Bio.Motif.Applications we can do the same as for
Bio.Align.Applications, or if there are only one or two wrappers
initially put the classes directly in
Bio/Motif/Applications/__init__.py and then split them into private
files later on if the file gets too big.

Peter



More information about the Biopython-dev mailing list