[Biopython-dev] [Bug 2822] New: Bio.Application.AbstractCommandline - properties and kwargs

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Apr 29 09:55:13 UTC 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2822

           Summary: Bio.Application.AbstractCommandline - properties and
                    kwargs
           Product: Biopython
           Version: Not Applicable
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: biopython-bugzilla at maubp.freeserve.co.uk


I have two related proposals to make the command line wrapper objects easier to
use,

(1) Supporting keyword arguments in __init__
(2) Supporting parameters as python properties

These both require each parameter to have a "human readable alias" which is
also a valid python identifier (this should be the case in CVS now).  I will
attach patches to this bug, and perhaps put this on github too.

For reference, consider this example (based on one in test_Emboss.py) using the
old code in CVS:

>>> from Bio.Emboss.Applications import WaterCommandline
>>> water_exe = r"C:\Progra~1\Emboss\water.exe"
>>> cline = WaterCommandline(cmd=water_exe)
>>> cline.set_parameter("-asequence", "asis:ACCCGGGCGCGGT")
>>> cline.set_parameter("-bsequence", "asis:ACCCGAGCGCGGT")
>>> cline.set_parameter("-gapopen", "10")
>>> cline.set_parameter("-gapextend", "0.5")
>>> cline.set_parameter("-outfile", "temp_test.water")
>>> print cline
C:\Progra~1\Emboss\water.exe -asequence=asis:ACCCGGGCGCGGT
-bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
-outfile=temp_test.water

Note that the parameters can have aliases (sometimes at the actual command
line, e.g. a long and a short version of the same switch).  Here the following
is also supported:

>>> from Bio.Emboss.Applications import WaterCommandline
>>> water_exe = r"C:\Progra~1\Emboss\water.exe"
>>> cline = WaterCommandline(cmd=water_exe)
>>> cline.set_parameter("asequence", "asis:ACCCGGGCGCGGT")
>>> cline.set_parameter("bsequence", "asis:ACCCGAGCGCGGT")
>>> cline.set_parameter("gapopen", "10")
>>> cline.set_parameter("gapextend", "0.5")
>>> cline.set_parameter("outfile", "temp_test.water")
>>> print cline
C:\Progra~1\Emboss\water.exe -asequence=asis:ACCCGGGCGCGGT
-bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
-outfile=temp_test.water


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list