Class AbstractCommandline
source code
object --+
|
AbstractCommandline
- Known Subclasses:
-
- PopGen.GenePop.Controller._GenePopCommandline
- , Emboss.Applications._EmbossMinimalCommandLine
- , AlignAce.Applications.AlignAceCommandline
- , AlignAce.Applications.CompareAceCommandline
- , Blast.Applications._BlastCommandLine
- , Blast.Applications.FastacmdCommandline
- , Sequencing.Applications._Novoalign.NovoalignCommandline
- , Motif.Applications._AlignAce.AlignAceCommandline
- , Motif.Applications._AlignAce.CompareAceCommandline
- , Align.Applications._Prank.PrankCommandline
- , Align.Applications._Clustalw.ClustalwCommandline
- , Align.Applications._Mafft.MafftCommandline
- , Align.Applications._Probcons.ProbconsCommandline
- , Align.Applications._TCoffee.TCoffeeCommandline
- , Align.Applications._Dialign.DialignCommandline
- , Align.Applications._Muscle.MuscleCommandline
Generic interface for constructing command line strings.
This class shouldn't be called directly; it should be subclassed to
provide an implementation for a specific application.
For a usage example we'll show one of the EMBOSS wrappers. You can
set options when creating the wrapper object using keyword arguments - or
later using their corresponding properties:
>>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
>>> cline
WaterCommandline(cmd='water', gapopen=10, gapextend=0.5)
You can instead manipulate the parameters via their properties,
e.g.
>>> cline.gapopen
10
>>> cline.gapopen = 20
>>> cline
WaterCommandline(cmd='water', gapopen=20, gapextend=0.5)
You can clear a parameter you have already added by 'deleting' the
corresponding property:
>>> del cline.gapopen
>>> cline.gapopen
>>> cline
WaterCommandline(cmd='water', gapextend=0.5)
Once you have set the parameters you need, turn the object into a
string:
>>> str(cline)
Traceback (most recent call last):
...
ValueError: You must either set outfile (output filename), or enable filter or stdout (output to stdout).
In this case the wrapper knows certain arguments are required to
construct a valid command line for the tool. For a complete example,
>>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
>>> cline.asequence = "asis:ACCCGGGCGCGGT"
>>> cline.bsequence = "asis:ACCCGAGCGCGGT"
>>> cline.outfile = "temp_water.txt"
>>> print cline
water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT -bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
>>> cline
WaterCommandline(cmd='water', outfile='temp_water.txt', asequence='asis:ACCCGGGCGCGGT', bsequence='asis:ACCCGAGCGCGGT', gapopen=10, gapextend=0.5)
You would typically run the command line via a standard Python
operating system call (e.g. using the subprocess module).
|
__init__(self,
cmd,
**kwargs)
Create a new instance of a command line wrapper object. |
source code
|
|
|
|
|
|
|
|
|
_clear_parameter(self,
name)
Reset or clear a commandline option value. |
source code
|
|
|
_get_parameter(self,
name)
Get a commandline option value. |
source code
|
|
|
|
|
set_parameter(self,
name,
value=None)
Set a commandline option for a program. |
source code
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|
Inherited from object :
__class__
|
__init__(self,
cmd,
**kwargs)
(Constructor)
| source code
|
Create a new instance of a command line wrapper object.
- Overrides:
object.__init__
|
Return a representation of the command line object for debugging.
e.g. >>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
>>> cline.asequence = "asis:ACCCGGGCGCGGT"
>>> cline.bsequence = "asis:ACCCGAGCGCGGT"
>>> cline.outfile = "temp_water.txt" >>>
print cline water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT
-bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5 >>>
cline WaterCommandline(cmd='water', outfile='temp_water.txt',
asequence='asis:ACCCGGGCGCGGT', bsequence='asis:ACCCGAGCGCGGT',
gapopen=10, gapextend=0.5)
- Overrides:
object.__repr__
|
__str__(self)
(Informal representation operator)
| source code
|
Make the commandline string with the currently set options.
e.g. >>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
>>> cline.asequence = "asis:ACCCGGGCGCGGT"
>>> cline.bsequence = "asis:ACCCGAGCGCGGT"
>>> cline.outfile = "temp_water.txt" >>>
print cline water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT
-bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5 >>>
str(cline) 'water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT
-bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5'
- Overrides:
object.__str__
|
_check_value(self,
value,
name,
check_function)
| source code
|
Check whether the given value is valid.
No return value - it either works or raises a ValueError.
This uses the passed function 'check_function', which can either
return a [0, 1] (bad, good) value or raise an error. Either way this
function will raise an error if the value is not valid, or finish
silently otherwise.
|
Make sure the required parameters have been set (PRIVATE).
No return value - it either works or raises a ValueError.
This is a separate method (called from __str__) so that subclasses may
override it.
|