HappyDoc Generated Documentation ./Midas/midas_text.py

. / Midas / midas_text.py 

Functions   
  doNeon 
doNeon ( cmdName,  args )
  doPreneon 
doPreneon ( cmdName,  args )
  doEcho 
doEcho ( cmdName,  args )
  doSystem 
doSystem ( cmdName,  args )
  NoVdwopt 
NoVdwopt ( cmdName,  args )
  doSurfaceCategory 
doSurfaceCategory ( cmdName,  args )
  doTexture 
doTexture ( cmdName,  args )
Exceptions   

MidasError, 'No "=" found in assignment string'
MidasError, 'unknown texture keyword "%s"' % argWords [ 0 ]
MidasError, "Too many arguments for texture new command"
MidasError, "Left side of map must be an integer"

  doSleep 
doSleep ( cmdName,  args )
  Unimplemented 
Unimplemented ( cmdName,  args )
Exceptions   

MidasError, '"%s" is not yet implemented' %( cmdName )

  doStop 
doStop ( cmdName,  args )
Exceptions   

ChimeraSystemExit, 0

  doMatrixcopy 
doMatrixcopy ( cmdName,  args )
Exceptions   

MidasError, 'two model numbers required'

  doCopy 
doCopy ( cmdName,  args )
Exceptions   

MidasError, "%s keyword not implemented" % argWords [ 0 ]
MidasError, "Argument (to '%s') missing" % argWords [ 0 ]
MidasError, "supersample" " argument must be positive integer"
MidasError, "Unknown copy keyword '%s'" % argWords [ 0 ]
ValueError, ""

  clearError 
clearError ()
  doUnsurface 
doUnsurface ( cmdName,  args )
  doNamesel 
doNamesel ( cmdName,  args )
  doUnalias 
doUnalias ( cmdName,  args )
Exceptions   

MidasError, "No such alias ('%s)" % args

  doStart 
doStart ( cmdName,  args )
Exceptions   

MidasError, "Please specify the name of an extension"

  doSet 
doSet ( cmdName,  args )
Exceptions   

MidasError, 'no such "set" variable (or not implemented): %s' % argWords [ 0 ]
MidasError, "No keywords given to 'set' command"
MidasError, 'no value given for "set %s"' % argWords [ 0 ]

  doSource 
doSource ( cmdName,  args )
  doMove 
doMove ( cmdName,  args )
Exceptions   

MidasError, 'required distance argument missing'
MidasError, 'required motion axis argument missing'
MidasError, 'wait_frames argument not implemented'

  doWait 
doWait ( cmdName,  args )
  doLinewidth 
doLinewidth ( cmdName,  args )
Exceptions   

MidasError, 'No linewidth specified'
MidasError, 'width must be numeric'

  doSwapRes 
doSwapRes ( cmdName,  args )
Exceptions   

MidasError( 'Usage: swapna new_res_type[,preserve] atomspec' )

  doModelFunc 
doModelFunc ( cmdName,  args )
  doSetAttr 
doSetAttr ( cmdName,  args )
Exceptions   

MidasError( "Usage: %s" % usage )

  doAlias 
doAlias ( cmdName,  args )
Exceptions   

MidasError, "No such alias: '%s'" % parts [ 0 ]

  doBondUncolor 
doBondUncolor ( cmdName,  args )
  doAddAA 
doAddAA ( cmdName,  args )
  doRMSD 
doRMSD ( cmdName,  args )
Exceptions   

MidasError, 'missing atom spec'

  doOpen 
doOpen ( cmdName,  args )
Exceptions   

MidasError, 'No file chosen for open'
ValueError, "Cannot use argless 'open' command" "in nogui mode\n"
MidasError, 'opening surfaces unimplemented'

  doUnsavepos 
doUnsavepos ( cmdName,  args )
  addCommand 
addCommand (
        command,
        cmdFunc,
        revFunc=None,
        help=None,
        )

add a command to the interpreter

command is the command name; cmdFunc is the function to call when command is invoked, and revFunc (if any) is the function to call for ~command. cmdFunc and revFunc are both called with two string arguments: the command name and the argument string typed by the user. help is None if no help is provided, True if the command has help integrated with the other built-in commands (i.e. is listed in the User's Guide table of contents of commands), or is a string or tuple that can be used as an argument to chimera.help's display() function (an URL or package/URL tuple).

cmdFunc and revFunc are typically simple wrapper functions that in turn call the doExtensionFunc() command. See the doExtensionFunc doc string for details on usage.

One usually registers the new command from the extension's ChimeraExtension.py file so that it is available to the interpreter without the extension being imported. Don't import your extension directly from within your ChimeraExtension.py! Doing so will slow Chimera startup. Instead, you will import your extension from within your cmdFunc (and revFunc) functions. See FindHBond's ChimeraExtension.py for an example of typical usage [except for the help arg, since FindHBond's help is integrated with the built-in commands].

You will want to use the doExtensionFunc() command to handle parsing the text and calling your command. You may have to provide a shim function that works better (more "user friendly" keywords, etc.) than your normal API for use with doExtensionFunc(). See the doExtensionFunc() doc string for details.

  doCofr 
doCofr ( cmdName,  args )
  doBondDisplay 
doBondDisplay ( cmdName,  args )
  doRepr 
doRepr ( cmdName,  args )
Exceptions   

MidasError, "missing representation argument"
MidasError, 'use "~ribbon" to undisplay ribbons'
MidasError, 'unknown representation type ("%s")' % argWords [ 0 ]

  doArglessFunc 
doArglessFunc ( cmdName,  args )
Exceptions   

MidasError, "'%s' function takes no arguments" % cmdName

  processCommandFile 
processCommandFile (
        filename,
        emulateRead=0,
        usingString=False,
        )

called by source and read commands

  doChirality 
doChirality ( cmdName,  args )
  doClip 
doClip ( cmdName,  args )
Exceptions   

MidasError, '"Unit-less" clip not implemented'
MidasError, 'required clipping plane argument missing'
MidasError, 'wait_frames argument not implemented'
MidasError, 'clip plane must be "hither" or "yon"'

  expandAliases 
expandAliases ( text )

expand aliases

  convertType 
convertType ( value )
  doUnsetAttr 
doUnsetAttr ( cmdName,  args )
Exceptions   

MidasError( "Usage: %s atom|residue|molecule" " attrName atomspec" % cmdName )

  doLoad 
doLoad ( cmdName,  args )
Exceptions   

MidasError, 'No file chosen for load'
ValueError, "Cannot use argless 'load' command" "in nogui mode\n"

  doMsMs 
doMsMs ( cmdName,  args )
Exceptions   

MidasError, 'missing category name'
MidasError, 'unknown msms keyword "%s"' % argWords [ 0 ]

  doRoll 
doRoll ( cmdName,  args )
Exceptions   

MidasError, 'turning bond rotations not implemented'
MidasError, 'wait_frames argument not implemented'

  getSpecs 
getSpecs ( args,  modelLevel=False )
  doScale 
doScale ( cmdName,  args )
Exceptions   

MidasError, 'required scaling factor argument missing'
MidasError, 'wait_frames argument not implemented'

  message 
message ( msg )
  doBondColor 
doBondColor ( cmdName,  args )
Exceptions   

MidasError, 'No color specified'

  doUncolor 
doUncolor ( cmdName,  args )
  findQuoted 
findQuoted ( text )
Exceptions   

MidasError, "Unmatched quote in %s" % text

  doUnset 
doUnset ( cmdName,  args )
Exceptions   

MidasError, "No keywords given to 'set' command"
MidasError, 'no such "unset" variable (or not implemented): %s' % argWords [ 0 ]

  doRock 
doRock ( cmdName,  args )
Exceptions   

MidasError, "axis must be 'x', 'y', or 'z'"
MidasError, 'wait_frames argument not implemented'

  doSection 
doSection ( cmdName,  args )
Exceptions   

MidasError, 'required distance argument missing'
MidasError, 'wait_frames argument not implemented'

  doSurfaceColor 
doSurfaceColor ( cmdName,  args )
Exceptions   

MidasError( "No surface-coloring mode specified" )
MidasError('unknown surface coloring mode ("%s")' % argWords [ 0 ] )

  doWindow 
doWindow ( cmdName,  args )
  doConic 
doConic ( cmdName,  args )
  doUnbond 
doUnbond ( cmdName,  args )
  doUnsurfaceTransparency 
doUnsurfaceTransparency ( cmdName,  args )
  doLongbond 
doLongbond ( cmdName,  args )
Exceptions   

MidasError( "'longbond' command no longer takes arguments" )

  doMatrixget 
doMatrixget ( cmdName,  args )
Exceptions   

ValueError( "Cannot use argless 'matrixget'" " command in nogui mode" )
MidasError, 'No file chosen for matrixget'

  warn 
warn ( warning )
  doSave 
doSave ( cmdName,  args )
Exceptions   

ValueError, "Cannot use argless 'save' command" "in nogui mode\n"
MidasError, 'No file chosen for save'

  doRead 
doRead ( cmdName,  args )
  doVdwDensity 
doVdwDensity ( cmdName,  args )
Exceptions   

MidasError, "missing density argument required"

  doSavepos 
doSavepos ( cmdName,  args )
  doKsdssp 
doKsdssp ( cmdName,  args )
  doThickness 
doThickness ( cmdName,  args )
Exceptions   

MidasError( 'clip plane separation reporting not implemented' )
MidasError, 'wait_frames argument not implemented'

  doClose 
doClose ( cmdName,  args )
Exceptions   

MidasError( "argument must be model" " number, 'session' or 'all'" )

  doBond 
doBond ( cmdName,  args )
  doSelect 
doSelect ( cmdName,  args )
  doVdwDefine 
doVdwDefine ( cmdName,  args )
Exceptions   

MidasError( 'Usage: vdwdefine [+/-]radius [atomSpec]' )

  error 
error ( error )
  doSurfaceTransparency 
doSurfaceTransparency ( cmdName,  args )
Exceptions   

MidasError( "Transparency value must be between" " 0 and 100 (inclusive)" )

  doSurfaceDelete 
doSurfaceDelete ( cmdName,  args )
  doTColor 
doTColor ( cmdName,  args )
Exceptions   

MidasError, 'No texture color specified'

  doMatrixset 
doMatrixset ( cmdName,  args )
Exceptions   

ValueError( "Cannot use argless 'matrixset'" " command in nogui mode" )
MidasError, 'No file chosen for matrixset'

  makeCommand 
makeCommand ( text )
Exceptions   

MidasError, 'Unrecognized command: "%s"' % cmd

  doResrepr 
doResrepr ( cmdName,  args )
Exceptions   

MidasError, "Resrepr command removed. Use ribbon command to show ribbons. Use ribrepr command to set ribbon styles."

  doSurfaceRepr 
doSurfaceRepr ( cmdName,  args )
Exceptions   

MidasError, 'unknown representation type ("%s")' % argWords [ 0 ]

  doPop 
doPop ( cmdName,  args )
Exceptions   

MidasError, 'too many arguments'

  doSurfaceNew 
doSurfaceNew ( cmdName,  args )
  doAtomSpecFunc 
doAtomSpecFunc ( cmdName,  args )
  doStereo 
doStereo ( cmdName,  args )
Exceptions   

MidasError, 'Unrecognized stereo mode: %s' % args

  allModelSelect 
allModelSelect (
        activity,
        ids=None,
        id=None,
        subid=None,
        )

a select where all models with the proper ids are activated

activity: boolean controlled whether to activate or deactivate

ids: a string. Either all or comma-seperated model ids/subids; if all and activity is True, activate all models and remember previous activation states; if all and activity is False, restore remembered activation states; otherwise parsed into individual id/subids and this routine called again for each one

id: model id to activate/deactivate. If subid is None, then all' submodels. if None (and ids is None), then all models.

subid: used in tandem with id

Exceptions   

MidasError, "Could not parse model list"

  doUnselect 
doUnselect ( cmdName,  args )
  doCd 
doCd ( cmdName,  args )
  doLabelopt 
doLabelopt ( cmdName,  args )
Exceptions   

MidasError, "too many arguments to labelopt"
MidasError, 'unknown option "%s"' % argWords [ 0 ]

  doMatch 
doMatch ( cmdName,  args )
Exceptions   

MidasError( "'iterate' argument must be" " a number" )
MidasError( "'iterate' keyword requires" " cutoff distance argument" )
MidasError( "'iterate' argument must be" " a positive number" )
MidasError, 'missing atom spec'

  doColor 
doColor ( cmdName,  args )
Exceptions   

MidasError, 'No color specified'

  doRainbow 
doRainbow ( cmdName,  args )
  doRescolor 
doRescolor ( cmdName,  args )
Exceptions   

MidasError, "Rescolor command removed. Use ribcolor command to set ribbon colors."

  doReset 
doReset ( cmdName,  args )
Exceptions   

MidasError, 'too many arguments'

  doWindowsize 
doWindowsize ( cmd_name,  args )
Exceptions   

MidasError, 'Syntax error: %s ' % cmd_name

  doSurface 
doSurface ( cmdName,  args )
  doRangeColor 
doRangeColor ( cmdName,  args )
Exceptions   

MidasError, "Missing required args (try 'help %s')" % cmdName
MidasError, "Less than two value/color pairs provided (try 'help %s')" % cmdName

  doUnclip 
doUnclip ( cmdName,  args )
Exceptions   

MidasError, "mangled clipping plane name: %s" % args
MidasError, 'required clipping plane argument missing'

  doLabel 
doLabel ( cmdName,  args )
  doX3DSave 
doX3DSave ( cmdName,  args )
Exceptions   

ValueError, "Cannot use argless 'x3dsave' " "command in nogui mode\n"
MidasError, 'No file chosen for save'

  doUndistance 
doUndistance ( cmdName,  args )
  doHelp 
doHelp ( cmdName,  args )
Exceptions   

MidasError, "Cannot provide help for unknown command '%s'" % args
MidasError, 'No help available for "%s"' % args

  getModelId 
getModelId ( s )
Exceptions   

MidasError, "\"%s\" is not a model number" % s

  doPreset 
doPreset ( cmdName,  args )
Exceptions   

MidasError, s
MidasError, "unknown subcommand '%s' for 'preset'" % cmd
MidasError( "usage: preset apply type number" )

  doWrite 
doWrite ( cmdName,  args )
Exceptions   

MidasError, "writing surfaces not yet supported"
MidasError, 'No file chosen for write'
ValueError, "Cannot use argless 'write' command" "in nogui mode\n"
MidasError( "'format' value must either" " be 'pdb' or 'mol2'" )

  doColordef 
doColordef ( cmdName,  args )
Exceptions   

MidasError, "Too few arguments to colordef"
MidasError, 'argument must be a color name, RGB, or RGBA value'

  doPdbrun 
doPdbrun ( cmdName,  args )
Exceptions   

MidasError, "'mark=' not yet implemented"
MidasError, "command to execute missing"

  doExtensionFunc 
doExtensionFunc (
        extFunc,
        typed,
        invalid=[],
        specInfo=[],
        )

Call a function based on user-typed arguments

doExtensionFunc introspects the function extFunc to determine its positional and keyword arguments. The first arguments in the user-typed typed string are taken as the positional arguments, and the remainder of the string is assumed to be (space separated, quoting handled) key/value pairs and are matched up to the appropriate keywords. invalid is a list of arguments that are not valid for the user to provide and are therefore screened from the introspected arguments. specInfo is a list of 3-tuples specifying arguments that expect lists of atoms/residues/models as values and that therefore are typed as atom specifiers. Each 3-tuple consists of:

  • The keyword the user types or, for positional arguments, what the argument name should be treated as for type-guessing purposes (in either case it should end in "spec") - The real argument name used by the function (this will automatically be added to invalid) - The method name applied to the selection generated by the specifier to extract the desired list (typically atoms, residues, molecules, or models)

Keyword argument names can be typed in any case by the user and will be matched to the appropriate keyword regardless of its case.

The user need only type enough characters to uniquely distinguish a keyword argument name. Nonetheless, you may want to provide a "front end" function to your actual workhorse function, where the keyword arguments have more user-friendly names.

Arguments values use some heuristic rules to convert to their most "natural" type. However, argument names can influence how the value is handled. In particular, if the argument name ends in...

  • "color": the argument is treated as a color name and converted to a MaterialColor - "spec": the argument is assumed to be an atom specifier and the value type is a Selection - "file": the argument is file; the user can provide "browse" or "browser" as the typed value and get a file browser for choosing the file. If the argment name ends in "savefile", a save-style browser will be used.

Exceptions   

MidasError, "Missing required argument(s): %s" %(", ".join( missingTyped ) )

Classes   

This document was automatically generated Thu Nov 15 14:11:31 2007 by HappyDoc version 3.0.a1