def cmdRotamers(cmdName, args): from Midas.midas_text import doExtensionFunc from Rotamers import useBestRotamers doExtensionFunc(useBestRotamers, args, specInfo=[("spec", "targets", "residues"), ("densitySpec", "density", "models")])
def cmdRotamers(cmdName, args): from Midas.midas_text import doExtensionFunc from Rotamers import useBestRotamers doExtensionFunc(useBestRotamers, args, specInfo=[ ("spec", "targets", "residues"), ("densitySpec", "density", "models") ])
def cmd_undo_snfg(cmdName, args): def cmd(*args): for instance in SNFG._instances: instance.disable() chimera.viewer.updateCB(chimera.viewer) doExtensionFunc(cmd, args)
def cmdCombine(cmdName, args): from Midas.midas_text import doExtensionFunc import Combine doExtensionFunc(Combine.cmdCombine, args, specInfo=[("spec", "mols", "molecules"), ("refSpec", "refMol", "molecules")])
def coordset(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(show_coordinates, args, specInfo=[('moleculeSpec', 'molecules', 'models'), ('holdSteadySpec', 'holdSteady', 'atoms')])
def mcopy_command(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(molecule_copy, args, specInfo=[('atomSpec', 'from_atoms', 'atoms'), ('atomSpec', 'to_atoms', 'atoms')])
def cmdAddCharge(cmdName, args): from AddCharge import cmdAddStdCharge, \ cmdAddNonstdCharge, cmdAddAllCharge from Midas.midas_text import doExtensionFunc, MidasError if not args: mode = 'a' else: fields = args.split(None, 1) if len(fields) > 1: fullMode, args = fields else: fullMode = fields[0] args = "" mode = fullMode[0].lower() if mode == 's': func = cmdAddStdCharge specInfo = [("spec", "molecules", "molecules")] elif mode == 'n': func = cmdAddNonstdCharge specInfo = [("resSpec", "residues", "residues")] elif mode == 'a': func = cmdAddAllCharge specInfo = [("spec", "molecules", "molecules")] else: raise MidasError("Unknown mode for %s: %s" % (cmdName, fullMode)) doExtensionFunc(func, args, specInfo=specInfo)
def cmdAddCharge(cmdName, args): from AddCharge import cmdAddStdCharge, \ cmdAddNonstdCharge, cmdAddAllCharge from Midas.midas_text import doExtensionFunc, MidasError if not args: mode = 'a' else: fields = args.split(None, 1) if len(fields) > 1: fullMode, args = fields else: fullMode = fields[0] args = "" mode = fullMode[0].lower() if mode == 's': func = cmdAddStdCharge specInfo = [("spec", "molecules", "molecules")] elif mode == 'n': func = cmdAddNonstdCharge specInfo = [("resSpec", "residues", "residues")] elif mode == 'a': func = cmdAddAllCharge specInfo = [("spec", "molecules", "molecules")] else: raise MidasError("Unknown mode for %s: %s" % (cmdName,fullMode)) doExtensionFunc(func, args, specInfo=specInfo)
def commandLine(cmd, args): if args.lower().startswith("co"): # Handle "color" command differently from chimera import LimitationError raise LimitationError("intersurf color not available yet") from Midas.midas_text import doExtensionFunc doExtensionFunc(cmdSurface, args, specInfo=[("refSpec", "refSel", None), ("matchSpec", "matchSel", None)])
def crystal_contacts(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(show_contacts, args, specInfo=[ ('moleculeSpec', 'molecules', 'models'), ])
def unclip_command(cmdname, args): if len(args) == 0: from chimera import openModels as om unclip_models(om.list()) else: from Midas.midas_text import doExtensionFunc doExtensionFunc(unclip_models, args)
def doLabel2DCmd(cmdName, args): from Midas.midas_text import doExtensionFunc from Midas import MidasError import Ilabel try: doExtensionFunc(Ilabel.processLabel2DCmd, args) except MidasError, what: raise
def doMovieCmd(cmdName, args): from Midas.midas_text import doExtensionFunc from Midas import MidasError import MovieRecorder try: doExtensionFunc(MovieRecorder.processMovieCmd, args) except MidasError, what: raise
def run(cmdName, args): from Midas.midas_text import doExtensionFunc if cmdName[0] == "b": f = blast elif cmdName[0] == "p": f = psiblast else: from chimera import UserError raise UserError("unknown command: \"%s\"" % cmdName) doExtensionFunc(f, args, specInfo=[("spec", "molecules", "molecules")])
def process(cmdName, args): from Midas.midas_text import doExtensionFunc try: func, kwargs = _cmdTable[cmdName] except KeyError: # We only get here if the command was registered # in ChimeraExtension.py but is not in our command table. # Assume that registration is correct and that we # just haven't implemented the function yet. import chimera raise chimera.UserError("%s: unimplemented command" % cmdName) doExtensionFunc(func, args, **kwargs)
def cmd_snfg(cmdName, args): def cmd(models=None, method='icon', size=None, **kwargs): methods = ('icon', 'full', 'fullred', 'fullshown') if method not in methods: chimera.statusline.show_message( 'Method {} not supported. Try with: {}'.format( method, ', '.join(methods)), color='red') if models or models is None: snfg = getattr(SNFG, 'as_' + method)(molecules=models, size=size, **kwargs) doExtensionFunc(cmd, args, specInfo=[("spec", "models", 'molecules')])
def mainchainCmd(cmdName, args): # Import the module's workhorse function. # It is imported inside the function definition so that # it does not slow down Chimera startup with extra imports # in the main scope. from ToolbarButtonCommand import mainchain # Import and use the Midas.midas_text doExtensionFunc procedure # to process typed arguments and call the mainchain() function # appropriately. For a simple function like mainchain(), which # takes no arguments, using doExtensionFunc is probably overkill. # One could instead use the approach applied in the revMainchainCmd # function below and simply test for the presence of any # arguments (raising MidasError if any are found) and directly calling # the mainchain() function otherwise. As implemented here, using # doExtensionFunc, if the user does provide arguments then # doExtensionFunc will raise an error complaining that there # were unknown keyword arguments supplied. from Midas.midas_text import doExtensionFunc doExtensionFunc(mainchain, args)
def cmd_cone(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import cone doExtensionFunc(cone, args)
def cmd_box(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import box doExtensionFunc(box, args)
def hkcage_command(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(hkcage, args)
def _cmd_unplip(cmdName, args): doExtensionFunc(cmd_unplip, args)
def cmdHBonds(cmdName, args): from Midas.midas_text import doExtensionFunc from FindHBond import createHBonds doExtensionFunc(createHBonds, args, specInfo=[("spec", "models", "molecules")])
def cmdUnaniso(cmdName, args): import Aniso from Midas.midas_text import doExtensionFunc doExtensionFunc(Aniso.unaniso, args, specInfo=[("spec", "targets", "atoms")])
def midasCmd(cmdName, typedArgs): from Midas.midas_text import doExtensionFunc doExtensionFunc(writeSel, typedArgs)
def topography_command(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(make_surface, args, specInfo=[('volumeSpec', 'volumes', 'models')])
def cmd_vector(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import vector doExtensionFunc(vector, args)
def mcopy_command(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(molecule_copy, args, specInfo = [('atomSpec','from_atoms','atoms'), ('atomSpec','to_atoms','atoms')])
def coordset(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(show_coordinates, args, specInfo = [('moleculeSpec','molecules','models'), ('holdSteadySpec','holdSteady','atoms')])
def mclip_command(cmdname, args): if len(args) == 0: args = 'all' from Midas.midas_text import doExtensionFunc doExtensionFunc(mclip, args)
def cmd_cylinder(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import cylinder doExtensionFunc(cylinder, args)
def topography_command(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(make_surface, args, specInfo = [('volumeSpec','volumes','models')])
def cmd_sphere(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import sphere doExtensionFunc(sphere, args)
def crystal_contacts(cmdname, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(show_contacts, args, specInfo = [('moleculeSpec','molecules','models'),])
def cmdAddAttr(cmdName, args): from AddAttr import addAttributes from Midas.midas_text import doExtensionFunc doExtensionFunc(addAttributes, args, specInfo=[("spec", "models", "molecules")])
def cmd_subrmsd(cmdName, args): from Midas.midas_text import doExtensionFunc from subalign.core import cmd_rmsd doExtensionFunc(cmd_rmsd, args, specInfo=[("refSpec", "reference_sel", None), ("probeSpec", "probe_sel", None)])
def cmdMMMD(self, cmdName, args): from Midas.midas_text import doExtensionFunc func = getattr(self.module('cmdline'), cmdName) doExtensionFunc(func, args, specInfo=[("spec", "molecules", "molecules")])
def run(cmdName, args): from Midas.midas_text import doExtensionFunc doExtensionFunc(mol2diagram, args, specInfo=[("spec", "molecules", "molecules")])
def cmdDetectClash(cmdName, args): import DetectClash from Midas.midas_text import doExtensionFunc doExtensionFunc(DetectClash.cmdDetectClash, args, specInfo=[("atomSpec", "testAtoms", "atoms")])
def run(cmdName, args): fields = args.split(None, 1) if len(fields) > 1: opt, args = fields else: opt = fields[0] args = "" from util import findBestMatch try: bestMatch = findBestMatch(opt, _optArgsTable.iterkeys()) except ValueError, s: from chimera import UserError raise UserError("bad option: %s" % s) func, kw = _optArgsTable[bestMatch] from Midas.midas_text import doExtensionFunc doExtensionFunc(func, args, **kw) def startCommand(molecule, name="default", method="corkscrew", rate="linear", frames=20, cartesian=False): from chimera import UserError if len(molecule) != 1: raise UserError("You must specify exactly one molecule") m = molecule[0] try: ms = _find(name) except UserError: pass else: raise UserError("You already defined \"%s\"" % name) kw = {
def _cmd_plip(cmdName, args): doExtensionFunc(cmd_plip, args, specInfo=[("selSpec", "selection", None)])
def cmd_arrow(cmdName, args): from Midas.midas_text import doExtensionFunc from Chimera_BILD import arrow doExtensionFunc(arrow, args)
def cmdMatchMaker(cmdName, args): from MatchMaker import cmdMatch from Midas.midas_text import doExtensionFunc doExtensionFunc(cmdMatch, args, specInfo=[("refSpec", "refSel", None), ("matchSpec", "matchSel", None)])