[Biopython-dev] Repeated options in command line interfaces
Peter
biopython at maubp.freeserve.co.uk
Tue May 19 17:00:41 UTC 2009
Hello all,
Yes - its another thread about command line wrappers!
One of the Roche 454 off instrument applications is runMapping,
which in the most general situation allows you to map one or
more SFF files onto one or more FASTA files, e.g.
runMapping -o ~/test -ref example1.fasta example2.fasta -read
data1.sff data2.sff
Notice that "-ref" and "-read" are not repeated, so we could
treat this via the current application wrapper system as follows:
#These modules don't exist (yet):
from Bio.Sequencing.Applications import RunMappingCommandline
cline = RunMappingCommandline()
cline.ref = "example1.fasta example2.fasta"
cline.read = "data1.sff data2.sff"
This isn't very elegant, but would work. Over on Bug 2815,
Cymon and I have briefly discussed the --seed parameter in
Mafft, which is used to specify one or more alignment files, e.g.
mafft ... --seed alignment1 --seed alignment2 --seed alignment3 ...
Notice that "--seed" is repeated before each value.
I was thinking it would be nice to treat this as a single
property (seed) which takes a list of strings as its value:
from Bio.Align.Applications import MafftCommandline
cline = MafftCommandline()
cline.seed = ["alignment1", "alignment2", ...]
or, equivalently:
from Bio.Align.Applications import MafftCommandline
cline = MafftCommandline(seed=["alignment1", "alignment2", ...])
or, using the old set_parameter approach,
from Bio.Align.Applications import MafftCommandline
cline = MafftCommandline()
cline.set_parameter("seed", ["alignment1", "alignment2", ...])
and similarly for a Roche wrapper, e.g.
#These modules don't exist (yet):
from Bio.Sequencing.Applications import RunMappingCommandline
cline = RunMappingCommandline()
cline.ref = ["example1.fasta", "example2.fasta"]
cline.read = ["data1.sff", "data2.sff"]
Doing this nicely would require two _Option subclasses in
Bio.Application, one for repeated options like "seed" in
Mafft, and one for multiple valued options like "ref" and
"read" in the Roche tools.
Does this sound sensible?
Does anyone have any more examples?
Peter
More information about the Biopython-dev
mailing list