[Biopython-dev] Bio.Application interface

Cymon Cox cy at cymon.org
Wed Apr 22 05:48:08 EDT 2009


>From reading the previous discussion on the list, I gather there is a
preference for removing helper functions to the Bio.Application command line
interfaces, such that the user interface would be something like:

from Bio import Application
from Bio.Align.Applications import MafftCommandline
cmd = MafftCommandline()
cmd.set_parameter("input", "sample.fa")
[etc...]
i, o, e = Application.generic_run(cmd)

ie the user explicitly sets the cl parameters.

Ive written Application.AbstractCommandline for both MUSCLE and MAFFT.
However, each of these programmes uses a variation on the parameter styles
not easily covered by the current _AbstractParameter classes _Option and
_Argument. The _Option class deals with parameters of the type "-
-append=yes" and "-a yes", and the _Argument returns just the value to the
command line, ie cmd.set_parameter("input", "sample.fa") puts just
"sample.fa" on the cl.

A muscle command might be:
"muscle -in Fasta/f002 -out Fasta/temp_align_out2.fa -objscore sp
-noanchors"
ie with a "-noanchors" command, currently the parameter would need to be an
_Argument and set using:
cmd.set_parameter("noanchors", "-noanchors")

A MAFFT command might be:
"mafft - -maxiterate 200 - -nofft myInputData.fa"
ie with a "- -nofft" parameter which would need to be an _Argument and set
using:
cmd.set_parameter("nofft", "- -nofft")
and a "- -maxiterate 200" parameter which _Option doesnt cover, that is "-
-" params always have an "=" before the value.

So, it looks like a _OptionNoEquals parameter class is required to cover the
"- -param value", and I would suggest a _ArgumentName class that returns the
parameter name to the command line such that:

cmd.set_parameter("- -nofit") returns "- -nofit" to the cl, and
cmd.set_parameter("- -nofit", value) raises and error via the
checker_function

As and aside, MAFFT also has a:
"mafft - -seed file1 - -seed file2 inputData.fa" ie mulitple number of -
-seed parameters which is not covered by the current interface.

Cheers, C.
--


More information about the Biopython-dev mailing list