Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Emboss.Applications.Primer3Commandline Class Reference
Inheritance diagram for Bio.Emboss.Applications.Primer3Commandline:
Inheritance graph
[legend]
Collaboration diagram for Bio.Emboss.Applications.Primer3Commandline:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__
def __repr__
def set_parameter
def __setattr__
def __call__

Public Attributes

 parameters
 program_name

Detailed Description

Commandline object for the Primer3 interface from EMBOSS.

The precise set of supported arguments depends on your version of EMBOSS.
This version accepts arguments current at EMBOSS 6.1.0, but in order to
remain backwards compatible also support the old argument names as well.

e.g. Using EMBOSS 6.1.0 or later,

>>> cline = Primer3Commandline(sequence="mysequence.fas", auto=True, hybridprobe=True)
>>> cline.explainflag = True
>>> cline.osizeopt=20
>>> cline.psizeopt=200
>>> cline.outfile = "myresults.out"
>>> cline.bogusparameter = 1967     # Invalid parameter
Traceback (most recent call last):
    ...
ValueError: Option name bogusparameter was not found.
>>> print cline
eprimer3 -auto -outfile=myresults.out -sequence=mysequence.fas -hybridprobe=True -psizeopt=200 -osizeopt=20 -explainflag=True

The equivalent for anyone still using an older version of EMBOSS would be:

>>> cline = Primer3Commandline(sequence="mysequence.fas", auto=True, hybridprobe=True)
>>> cline.explainflag = True
>>> cline.oligosize=20              # Old EMBOSS, instead of osizeopt
>>> cline.productosize=200          # Old EMBOSS, instead of psizeopt
>>> cline.outfile = "myresults.out"
>>> print cline
eprimer3 -auto -outfile=myresults.out -sequence=mysequence.fas -hybridprobe=True -productosize=200 -oligosize=20 -explainflag=True

Definition at line 117 of file Applications.py.


Constructor & Destructor Documentation

def Bio.Emboss.Applications.Primer3Commandline.__init__ (   self,
  cmd = "eprimer3",
  kwargs 
)
Create a new instance of a command line wrapper object.

Reimplemented from Bio.Emboss.Applications._EmbossCommandLine.

Definition at line 149 of file Applications.py.

00149 
00150     def __init__(self, cmd="eprimer3", **kwargs):
00151         self.parameters = [
00152            _Option(["-sequence","sequence"],
00153                    "Sequence to choose primers from.",
00154                    is_required=True),
00155            _Option(["-task","task"],
00156                    "Tell eprimer3 what task to perform."),
00157            _Option(["-hybridprobe","hybridprobe"],
00158                    "Find an internal oligo to use as a hyb probe."),
00159            _Option(["-numreturn","numreturn"],
00160                    "Maximum number of primer pairs to return."),
00161            _Option(["-includedregion","includedregion"],
00162                    "Subregion of the sequence in which to pick primers."),
00163            _Option(["-target","target"],
00164                    "Sequence to target for flanking primers."),
00165            _Option(["-excludedregion","excludedregion"],
00166                    "Regions to exclude from primer picking."),
00167            _Option(["-forwardinput","forwardinput"],
00168                    "Sequence of a forward primer to check."),
00169            _Option(["-reverseinput","reverseinput"],
00170                    "Sequence of a reverse primer to check."),
00171            _Option(["-gcclamp","gcclamp"],
00172                    "The required number of Gs and Cs at the 3' of each primer."),
00173            _Option(["-osize","osize"],
00174                    "Optimum length of a primer oligo."),
00175            _Option(["-minsize","minsize"],
00176                    "Minimum length of a primer oligo."),
00177            _Option(["-maxsize","maxsize"],
00178                    "Maximum length of a primer oligo."),
00179            _Option(["-otm","otm"],
00180                    "Optimum melting temperature for a primer oligo."),
00181            _Option(["-mintm","mintm"],
00182                    "Minimum melting temperature for a primer oligo."),
00183            _Option(["-maxtm","maxtm"],
00184                    "Maximum melting temperature for a primer oligo."),
00185            _Option(["-maxdifftm","maxdifftm"],
00186                    "Maximum difference in melting temperatures between "
00187                    "forward and reverse primers."),
00188            _Option(["-ogcpercent","ogcpercent"],
00189                    "Optimum GC% for a primer."),
00190            _Option(["-mingc","mingc"],
00191                    "Minimum GC% for a primer."),
00192            _Option(["-maxgc","maxgc"],
00193                    "Maximum GC% for a primer."),
00194            _Option(["-saltconc","saltconc"],
00195                    "Millimolar salt concentration in the PCR."),
00196            _Option(["-dnaconc","dnaconc"],
00197                    "Nanomolar concentration of annealing oligos in the PCR."),
00198            _Option(["-maxpolyx","maxpolyx"],
00199                    "Maximum allowable mononucleotide repeat length in a primer."),
00200            #Primer length:
00201            _Option(["-productosize","productosize"],
00202                    """Optimum size for the PCR product (OBSOLETE).
00203 
00204                    Option replaced in EMBOSS 6.1.0 by -psizeopt
00205                    """),
00206            _Option(["-psizeopt", "psizeopt"], 
00207                    """Optimum size for the PCR product.
00208 
00209                    Option added in EMBOSS 6.1.0, replacing -productosize
00210                    """),
00211            _Option(["-productsizerange","productsizerange"],
00212                    """Acceptable range of length for the PCR product (OBSOLETE).
00213 
00214                    Option replaced in EMBOSS 6.1.0 by -prange
00215                    """),
00216            _Option(["-prange", "prange"], 
00217                    """Acceptable range of length for the PCR product.
00218 
00219                    Option added in EMBOSS 6.1.0, replacing -productsizerange
00220                    """),
00221            #Primer temperature:
00222            _Option(["-productotm","productotm"],
00223                    """Optimum melting temperature for the PCR product (OBSOLETE).
00224 
00225                    Option replaced in EMBOSS 6.1.0 by -ptmopt
00226                    """),
00227            _Option(["-ptmopt", "ptmopt"], 
00228                    """Optimum melting temperature for the PCR product.
00229 
00230                    Option added in EMBOSS 6.1.0, replacing -productotm
00231                    """),
00232            _Option(["-productmintm","productmintm"],
00233                    """Minimum allowed melting temperature for the amplicon (OBSOLETE)
00234 
00235                    Option replaced in EMBOSS 6.1.0 by -ptmmin
00236                    """),
00237            _Option(["-ptmmin", "ptmmin"], 
00238                    """Minimum allowed melting temperature for the amplicon."),
00239 
00240                    Option added in EMBOSS 6.1.0, replacing -productmintm
00241                    """),
00242            _Option(["-productmaxtm","productmaxtm"],
00243                    """Maximum allowed melting temperature for the amplicon (OBSOLETE).
00244 
00245                    Option replaced in EMBOSS 6.1.0 by -ptmmax
00246                    """),
00247            _Option(["-ptmmax", "ptmmax"], 
00248                    """Maximum allowed melting temperature for the amplicon."),
00249 
00250                    Option added in EMBOSS 6.1.0, replacing -productmaxtm
00251                    """),
00252            #Note to self, should be -oexcludedregion not -oexcluderegion
00253            _Option(["-oexcludedregion", "oexcludedregion"], 
00254                    """Do not pick internal oligos in this region."),
00255 
00256                    Option added in EMBOSS 6.1.0, replacing -oligoexcludedregion.
00257                    """),
00258            _Option(["-oligoexcludedregion", "oligoexcludedregion"],
00259                    """Do not pick internal oligos in this region (OBSOLETE)."),
00260 
00261                    Option replaced in EMBOSS 6.1.0 by -oexcluderegion.
00262                    """),
00263            _Option(["-oligoinput","oligoinput"],
00264                    "Sequence of the internal oligo."),
00265            #Oligo length:
00266            _Option(["-oligosize","oligosize"], 
00267                    """Optimum length of internal oligo (OBSOLETE).
00268  
00269                    Option replaced in EMBOSS 6.1.0 by -osizeopt.
00270                    """),
00271            _Option(["-osizeopt", "osizeopt"], 
00272                    """Optimum length of internal oligo.
00273 
00274                    Option added in EMBOSS 6.1.0, replaces -oligosize
00275                    """),
00276            _Option(["-oligominsize","oligominsize"], 
00277                    """Minimum length of internal oligo (OBSOLETE)."),
00278  
00279                    Option replaced in EMBOSS 6.1.0 by -ominsize.
00280                    """),
00281            _Option(["-ominsize", "ominsize"], 
00282                    """Minimum length of internal oligo."
00283 
00284                    Option added in EMBOSS 6.1.0, replaces -oligominsize
00285                    """),
00286            _Option(["-oligomaxsize","oligomaxsize"], 
00287                    """Maximum length of internal oligo (OBSOLETE).
00288  
00289                    Option replaced in EMBOSS 6.1.0 by -omaxsize.
00290                    """),
00291            _Option(["-omaxsize", "omaxsize"], 
00292                    """Maximum length of internal oligo.
00293 
00294                    Option added in EMBOSS 6.1.0, replaces -oligomaxsize
00295                    """),
00296            #Oligo GC temperature:
00297            _Option(["-oligotm","oligotm"], 
00298                    """Optimum melting temperature of internal oligo (OBSOLETE).
00299  
00300                    Option replaced in EMBOSS 6.1.0 by -otmopt.
00301                    """),
00302            _Option(["-otmopt", "otmopt"], 
00303                    """Optimum melting temperature of internal oligo.
00304 
00305                    Option added in EMBOSS 6.1.0.
00306                    """),
00307            _Option(["-oligomintm","oligomintm"], 
00308                    """Minimum melting temperature of internal oligo (OBSOLETE).
00309  
00310                    Option replaced in EMBOSS 6.1.0 by -otmmin.
00311                    """),
00312            _Option(["-otmmin", "otmmin"], 
00313                    """Minimum melting temperature of internal oligo.
00314 
00315                    Option added in EMBOSS 6.1.0, replacing -oligomintm
00316                    """),
00317            _Option(["-oligomaxtm","oligomaxtm"], 
00318                    """Maximum melting temperature of internal oligo (OBSOLETE).
00319  
00320                    Option replaced in EMBOSS 6.1.0 by -otmmax.
00321                    """),
00322            _Option(["-otmmax", "otmmax"], 
00323                    """Maximum melting temperature of internal oligo.
00324 
00325                    Option added in EMBOSS 6.1.0, replacing -oligomaxtm
00326                    """),
00327            #Oligo GC percent:
00328            _Option(["-oligoogcpercent","oligoogcpercent"], 
00329                    """Optimum GC% for internal oligo (OBSOLETE).
00330  
00331                    Option replaced in EMBOSS 6.1.0 by -ogcopt.
00332                    """),
00333            _Option(["-ogcopt", "ogcopt"], 
00334                    """Optimum GC% for internal oligo."
00335 
00336                    Option added in EMBOSS 6.1.0, replacing -oligoogcpercent
00337                    """),
00338            _Option(["-oligomingc","oligomingc"], 
00339                    """Minimum GC% for internal oligo (OBSOLETE).
00340  
00341                    Option replaced in EMBOSS 6.1.0 by -ogcmin.
00342                    """),
00343            _Option(["-ogcmin", "ogcmin"], 
00344                    """Minimum GC% for internal oligo.
00345 
00346                    Option added in EMBOSS 6.1.0, replacing -oligomingc
00347                    """),
00348            _Option(["-oligomaxgc","oligomaxgc"], 
00349                    """Maximum GC% for internal oligo.
00350  
00351                    Option replaced in EMBOSS 6.1.0 by -ogcmax
00352                    """),
00353            _Option(["-ogcmax", "ogcmax"], 
00354                    """Maximum GC% for internal oligo."),
00355 
00356                    Option added in EMBOSS 6.1.0, replacing -oligomaxgc
00357                    """),
00358            #Oligo salt concentration:
00359            _Option(["-oligosaltconc","oligosaltconc"], 
00360                    """Millimolar concentration of salt in the hybridisation."),
00361  
00362                    Option replaced in EMBOSS 6.1.0 by -osaltconc
00363                    """),
00364            _Option(["-osaltconc", "osaltconc"], 
00365                    """Millimolar concentration of salt in the hybridisation."),
00366 
00367                    Option added in EMBOSS 6.1.0, replacing -oligosaltconc
00368                    """),
00369            _Option(["-oligodnaconc","oligodnaconc"], 
00370                    """Nanomolar concentration of internal oligo in the hybridisation.
00371  
00372                    Option replaced in EMBOSS 6.1.0 by -odnaconc
00373                    """),
00374            _Option(["-odnaconc", "odnaconc"], 
00375                    """Nanomolar concentration of internal oligo in the hybridisation.
00376 
00377                    Option added in EMBOSS 6.1.0, replacing -oligodnaconc
00378                    """),
00379            #Oligo self complementarity
00380            _Option(["-oligoselfany","oligoselfany"], 
00381                    """Maximum allowable alignment score for self-complementarity (OBSOLETE).
00382  
00383                    Option replaced in EMBOSS 6.1.0 by -oanyself
00384                    """),
00385            _Option(["-oanyself", "oanyself"], 
00386                    """Maximum allowable alignment score for self-complementarity."),
00387 
00388                    Option added in EMBOSS 6.1.0, replacing -oligoselfany
00389                    """),
00390            _Option(["-oligoselfend","oligoselfend"], 
00391                    """Maximum allowable 3`-anchored global alignment score "
00392                    for self-complementarity (OBSOLETE).
00393  
00394                    Option replaced in EMBOSS 6.1.0 by -oendself
00395                    """),
00396            _Option(["-oendself", "oendself"], 
00397                    """Max 3`-anchored self-complementarity global alignment score.
00398 
00399                    Option added in EMBOSS 6.1.0, replacing -oligoselfend
00400                    """),
00401            _Option(["-oligomaxpolyx","oligomaxpolyx"], 
00402                    """Maximum length of mononucleotide repeat in internal oligo (OBSOLETE).
00403 
00404                    Option replaced in EMBOSS 6.1.0 by -opolyxmax
00405                    """),
00406            _Option(["-opolyxmax", "opolyxmax"], 
00407                    """Maximum length of mononucleotide repeat in internal oligo."),
00408 
00409                    Option added in EMBOSS 6.1.0, replacing -oligomaxpolyx
00410                    """),
00411            _Option(["-mispriminglibraryfile","mispriminglibraryfile"],
00412                     "File containing library of sequences to avoid amplifying"),
00413            _Option(["-maxmispriming","maxmispriming"],
00414                    "Maximum allowed similarity of primers to sequences in "
00415                    "library specified by -mispriminglibrary"),
00416            _Option(["-oligomaxmishyb","oligomaxmishyb"], 
00417                    """Maximum alignment score for hybridisation of internal oligo to
00418                    library specified by -oligomishyblibraryfile (OBSOLETE).
00419 
00420                    Option replaced in EMBOSS 6.1.0 by -omishybmax
00421                    """),
00422            _Option(["-omishybmax", "omishybmax"], 
00423                    """Maximum alignment score for hybridisation of internal oligo to
00424                    library specified by -mishyblibraryfile.
00425 
00426                    Option added in EMBOSS 6.1.0, replacing -oligomaxmishyb
00427                    """),
00428            _Option(["-oligomishyblibraryfile", "oligomishyblibraryfile"],
00429                   
00430                     """Library file of seqs to avoid internal oligo hybridisation (OBSOLETE).
00431 
00432                    Option replaced in EMBOSS 6.1.0 by -mishyblibraryfile
00433                    """),
00434            _Option(["-mishyblibraryfile", "mishyblibraryfile"],
00435                     """Library file of seqs to avoid internal oligo hybridisation.
00436 
00437                    Option added in EMBOSS 6.1.0, replacing -oligomishyblibraryfile
00438                    """),
00439            _Option(["-explainflag","explainflag"],
00440                    "Produce output tags with eprimer3 statistics"),
00441            ]
00442         _EmbossCommandLine.__init__(self, cmd, **kwargs)
00443         

Here is the caller graph for this function:


Member Function Documentation

def Bio.Application.AbstractCommandline.__call__ (   self,
  stdin = None,
  stdout = True,
  stderr = True,
  cwd = None,
  env = None 
) [inherited]
Executes the command, waits for it to finish, and returns output.

Runs the command line tool and waits for it to finish. If it returns
a non-zero error level, an exception is raised. Otherwise two strings
are returned containing stdout and stderr.

The optional stdin argument should be a string of data which will be
passed to the tool as standard input.

The optional stdout and stderr argument are treated as a booleans, and
control if the output should be captured (True, default), or ignored
by sending it to /dev/null to avoid wasting memory (False). In the
later case empty string(s) are returned.

The optional cwd argument is a string giving the working directory to
to run the command from. See Python's subprocess module documentation
for more details.

The optional env argument is a dictionary setting the environment
variables to be used in the new process. By default the current
process' environment variables are used. See Python's subprocess
module documentation for more details.

Default example usage:

from Bio.Emboss.Applications import WaterCommandline
water_cmd = WaterCommandline(gapopen=10, gapextend=0.5,
                     stdout=True, auto=True,
                     asequence="a.fasta", bsequence="b.fasta")
print "About to run:\n%s" % water_cmd
std_output, err_output = water_cmd()

This functionality is similar to subprocess.check_output() added in
Python 2.7. In general if you require more control over running the
command, use subprocess directly.

As of Biopython 1.56, when the program called returns a non-zero error
level, a custom ApplicationError exception is raised. This includes
any stdout and stderr strings captured as attributes of the exception
object, since they may be useful for diagnosing what went wrong.

Definition at line 368 of file __init__.py.

00368 
00369                  cwd=None, env=None):
00370         """Executes the command, waits for it to finish, and returns output.
00371         
00372         Runs the command line tool and waits for it to finish. If it returns
00373         a non-zero error level, an exception is raised. Otherwise two strings
00374         are returned containing stdout and stderr.
00375         
00376         The optional stdin argument should be a string of data which will be
00377         passed to the tool as standard input.
00378 
00379         The optional stdout and stderr argument are treated as a booleans, and
00380         control if the output should be captured (True, default), or ignored
00381         by sending it to /dev/null to avoid wasting memory (False). In the
00382         later case empty string(s) are returned.
00383 
00384         The optional cwd argument is a string giving the working directory to
00385         to run the command from. See Python's subprocess module documentation
00386         for more details.
00387 
00388         The optional env argument is a dictionary setting the environment
00389         variables to be used in the new process. By default the current
00390         process' environment variables are used. See Python's subprocess
00391         module documentation for more details.
00392 
00393         Default example usage:
00394 
00395         from Bio.Emboss.Applications import WaterCommandline
00396         water_cmd = WaterCommandline(gapopen=10, gapextend=0.5,
00397                                      stdout=True, auto=True,
00398                                      asequence="a.fasta", bsequence="b.fasta")
00399         print "About to run:\n%s" % water_cmd
00400         std_output, err_output = water_cmd()
00401 
00402         This functionality is similar to subprocess.check_output() added in
00403         Python 2.7. In general if you require more control over running the
00404         command, use subprocess directly.
00405         
00406         As of Biopython 1.56, when the program called returns a non-zero error
00407         level, a custom ApplicationError exception is raised. This includes
00408         any stdout and stderr strings captured as attributes of the exception
00409         object, since they may be useful for diagnosing what went wrong.
00410         """
00411         if stdout:
00412             stdout_arg = subprocess.PIPE
00413         else:
00414             stdout_arg = open(os.devnull)
00415         if stderr:
00416             stderr_arg = subprocess.PIPE
00417         else:
00418             stderr_arg = open(os.devnull)
00419         #We may not need to supply any piped input, but we setup the
00420         #standard input pipe anyway as a work around for a python
00421         #bug if this is called from a Windows GUI program.  For
00422         #details, see http://bugs.python.org/issue1124861
00423         #
00424         #Using universal newlines is important on Python 3, this
00425         #gives unicode handles rather than bytes handles.
00426         child_process = subprocess.Popen(str(self), stdin=subprocess.PIPE,
00427                                          stdout=stdout_arg, stderr=stderr_arg,
00428                                          universal_newlines=True,
00429                                          cwd=cwd, env=env,
00430                                          shell=(sys.platform!="win32"))
00431         #Use .communicate as can get deadlocks with .wait(), see Bug 2804
00432         stdout_str, stderr_str = child_process.communicate(stdin)
00433         if not stdout: assert not stdout_str
00434         if not stderr: assert not stderr_str
00435         return_code = child_process.returncode
00436         if return_code:
00437             raise ApplicationError(return_code, str(self),
00438                                    stdout_str, stderr_str)
00439         return stdout_str, stderr_str
00440 

Here is the call graph for this function:

Here is the caller graph for this function:

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)

Definition at line 251 of file __init__.py.

00251 
00252     def __repr__(self):
00253         """Return a representation of the command line object for debugging.
00254 
00255         e.g.
00256         >>> from Bio.Emboss.Applications import WaterCommandline
00257         >>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
00258         >>> cline.asequence = "asis:ACCCGGGCGCGGT"
00259         >>> cline.bsequence = "asis:ACCCGAGCGCGGT"
00260         >>> cline.outfile = "temp_water.txt"
00261         >>> print cline
00262         water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT -bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
00263         >>> cline
00264         WaterCommandline(cmd='water', outfile='temp_water.txt', asequence='asis:ACCCGGGCGCGGT', bsequence='asis:ACCCGAGCGCGGT', gapopen=10, gapextend=0.5)
00265         """
00266         answer = "%s(cmd=%s" % (self.__class__.__name__, repr(self.program_name))
00267         for parameter in self.parameters:
00268             if parameter.is_set:
00269                 if isinstance(parameter, _Switch):
00270                     answer += ", %s=True" % parameter.names[-1]
00271                 else:
00272                     answer += ", %s=%s" \
00273                               % (parameter.names[-1], repr(parameter.value))
00274         answer += ")"
00275         return answer

def Bio.Application.AbstractCommandline.__setattr__ (   self,
  name,
  value 
) [inherited]
Set attribute name to value (PRIVATE).

This code implements a workaround for a user interface issue.
Without this __setattr__ attribute-based assignment of parameters
will silently accept invalid parameters, leading to known instances
of the user assuming that parameters for the application are set,
when they are not.

>>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5, stdout=True)
>>> cline.asequence = "a.fasta"
>>> cline.bsequence = "b.fasta"
>>> cline.csequence = "c.fasta"
Traceback (most recent call last):
...
ValueError: Option name csequence was not found.
>>> print cline
water -stdout -asequence=a.fasta -bsequence=b.fasta -gapopen=10 -gapextend=0.5

This workaround uses a whitelist of object attributes, and sets the
object attribute list as normal, for these.  Other attributes are
assumed to be parameters, and passed to the self.set_parameter method
for validation and assignment.

Definition at line 337 of file __init__.py.

00337 
00338     def __setattr__(self, name, value):
00339         """Set attribute name to value (PRIVATE).
00340 
00341         This code implements a workaround for a user interface issue.
00342         Without this __setattr__ attribute-based assignment of parameters
00343         will silently accept invalid parameters, leading to known instances
00344         of the user assuming that parameters for the application are set,
00345         when they are not.
00346         
00347         >>> from Bio.Emboss.Applications import WaterCommandline
00348         >>> cline = WaterCommandline(gapopen=10, gapextend=0.5, stdout=True)
00349         >>> cline.asequence = "a.fasta"
00350         >>> cline.bsequence = "b.fasta"
00351         >>> cline.csequence = "c.fasta"
00352         Traceback (most recent call last):
00353         ...
00354         ValueError: Option name csequence was not found.
00355         >>> print cline
00356         water -stdout -asequence=a.fasta -bsequence=b.fasta -gapopen=10 -gapextend=0.5
00357 
00358         This workaround uses a whitelist of object attributes, and sets the
00359         object attribute list as normal, for these.  Other attributes are
00360         assumed to be parameters, and passed to the self.set_parameter method
00361         for validation and assignment.
00362         """
00363         if name in ['parameters', 'program_name']: # Allowed attributes
00364             self.__dict__[name] = value
00365         else:
00366             self.set_parameter(name, value)  # treat as a parameter
    

Here is the call graph for this function:

def Bio.Application.AbstractCommandline.__str__ (   self) [inherited]
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'

Definition at line 229 of file __init__.py.

00229 
00230     def __str__(self):
00231         """Make the commandline string with the currently set options.
00232 
00233         e.g.
00234         >>> from Bio.Emboss.Applications import WaterCommandline
00235         >>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
00236         >>> cline.asequence = "asis:ACCCGGGCGCGGT"
00237         >>> cline.bsequence = "asis:ACCCGAGCGCGGT"
00238         >>> cline.outfile = "temp_water.txt"
00239         >>> print cline
00240         water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT -bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
00241         >>> str(cline)
00242         'water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT -bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5'
00243         """
00244         self._validate()
00245         commandline = "%s " % self.program_name
00246         for parameter in self.parameters:
00247             if parameter.is_set:
00248                 #This will include a trailing space:
00249                 commandline += str(parameter)
00250         return commandline.strip() # remove trailing space

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.Application.AbstractCommandline.set_parameter (   self,
  name,
  value = None 
) [inherited]
Set a commandline option for a program.

Definition at line 297 of file __init__.py.

00297 
00298     def set_parameter(self, name, value = None):
00299         """Set a commandline option for a program.
00300         """
00301         set_option = False
00302         for parameter in self.parameters:
00303             if name in parameter.names:
00304                 if isinstance(parameter, _Switch):
00305                     if value is None:
00306                         import warnings
00307                         warnings.warn("For a switch type argument like %s, "
00308                                       "we expect a boolean.  None is treated "
00309                                       "as FALSE!" % parameter.names[-1])
00310                     parameter.is_set = bool(value)
00311                     set_option = True
00312                 else:
00313                     if value is not None:
00314                         self._check_value(value, name, parameter.checker_function)
00315                         parameter.value = value
00316                     parameter.is_set = True
00317                     set_option = True
00318         if not set_option:
00319             raise ValueError("Option name %s was not found." % name)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from Bio.Emboss.Applications._EmbossCommandLine.

Definition at line 150 of file Applications.py.

Reimplemented in Bio.Align.Applications._Dialign.DialignCommandline.

Definition at line 167 of file __init__.py.


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