Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Application._Option Class Reference
Inheritance diagram for Bio.Application._Option:
Inheritance graph
Collaboration diagram for Bio.Application._Option:
Collaboration graph

List of all members.

Public Member Functions

def __init__
def __str__

Public Attributes


Detailed Description

Represent an option that can be set for a program.

This holds UNIXish options like --append=yes and -a yes,
where a value (here "yes") is generally expected.

For UNIXish options like -kimura in clustalw which don't
take a value, use the _Switch object instead.


o names -- a list of string names by which the parameter can be
referenced (ie. ["-a", "--append", "append"]). The first name in
the list is considered to be the one that goes on the commandline,
for those parameters that print the option. The last name in the list
is assumed to be a "human readable" name describing the option in one

o description -- a description of the option.

o filename -- True if this argument is a filename and should be
automatically quoted if it contains spaces.

o checker_function -- a reference to a function that will determine
if a given value is valid for this parameter. This function can either
raise an error when given a bad value, or return a [0, 1] decision on
whether the value is correct.

o equate -- should an equals sign be inserted if a value is used?

o is_required -- a flag to indicate if the parameter must be set for
the program to be run.

o is_set -- if the parameter has been set

o value -- the value of a parameter

Definition at line 452 of file

Constructor & Destructor Documentation

def Bio.Application._Option.__init__ (   self,
  filename = False,
  checker_function = None,
  is_required = False,
  equate = True 

Definition at line 490 of file

00491                  is_required=False, equate=True):
00492         self.names = names
00493         assert isinstance(description, basestring), \
00494                "%r for %s" % (description, names[-1])
00495         self.is_filename = filename
00496         self.checker_function = checker_function
00497         self.description = description
00498         self.equate = equate
00499         self.is_required = is_required
00501         self.is_set = False
00502         self.value = None

Here is the caller graph for this function:

Member Function Documentation

Return the value of this option for the commandline.

Includes a trailing space.

Reimplemented from Bio.Application._AbstractParameter.

Definition at line 503 of file

00504     def __str__(self):
00505         """Return the value of this option for the commandline.
00507         Includes a trailing space.
00508         """
00509         # Note: Before equate was handled explicitly, the old
00510         # code would do either "--name " or "--name=value ",
00511         # or " -name " or " -name value ".  This choice is now
00512         # now made explicitly when setting up the option.
00513         if self.value is None:
00514             return "%s " % self.names[0]
00515         if self.is_filename:
00516             v = _escape_filename(self.value)
00517         else:
00518             v = str(self.value)
00519         if self.equate:
00520             return "%s=%s " % (self.names[0], v)
00521         else:
00522             return "%s %s " % (self.names[0], v)

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Definition at line 495 of file

Definition at line 496 of file

Definition at line 497 of file

Definition at line 494 of file

Definition at line 498 of file

Definition at line 500 of file

Definition at line 491 of file

Definition at line 501 of file

The documentation for this class was generated from the following file: