Exemple #1
0
    def get_names(type='public_objects',
                  enabled_only=0,
                  selection="",
                  _self=cmd):
        '''
DESCRIPTION

    "get_names" returns a list of object and/or selection names.

PYMOL API

    cmd.get_names( [string: "objects"|"selections"|"all"|"public_objects"|"public_selections"] )

NOTES

    The default behavior is to return only object names.

SEE ALSO

    get_type, count_atoms, count_states
        '''
        selection = selector.process(selection)
        r = DEFAULT_ERROR
        # this needs to be replaced with a flag & masking scheme...
        mode = 1
        if type == 'objects':
            mode = 1
        elif type == 'selections':
            mode = 2
        elif type == 'all':
            mode = 0
        elif type == 'public':
            mode = 3
        elif type == 'public_objects':
            mode = 4
        elif type == 'public_selections':
            mode = 5
        elif type == 'public_nongroup_objects':
            mode = 6
        elif type == 'public_group_objects':
            mode = 7
        elif type == 'nongroup_objects':
            mode = 8
        elif type == 'group_objects':
            mode = 9
        else:
            print "Error: unknown type: '%s'" % str(type)
            if _raising(-1, _self): raise pymol.CmdException
        try:
            _self.lock(_self)
            r = _cmd.get_names(_self._COb, int(mode), int(enabled_only),
                               str(selection))
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #2
0
    def get_names(type='public_objects',enabled_only=0,selection="",_self=cmd):
        '''
DESCRIPTION

    "get_names" returns a list of object and/or selection names.

PYMOL API

    cmd.get_names( [string: "objects"|"selections"|"all"|"public_objects"|"public_selections"] )

NOTES

    The default behavior is to return only object names.

SEE ALSO

    get_type, count_atoms, count_states
        '''
        selection = selector.process(selection)
        r = DEFAULT_ERROR
        # this needs to be replaced with a flag & masking scheme...
        mode = 1
        if type=='objects':
            mode = 1
        elif type=='selections':
            mode = 2
        elif type=='all':
            mode = 0
        elif type=='public':
            mode = 3
        elif type=='public_objects':
            mode = 4
        elif type=='public_selections':
            mode = 5
        elif type=='public_nongroup_objects':
            mode = 6
        elif type=='public_group_objects':
            mode = 7
        elif type=='nongroup_objects':
            mode = 8
        elif type=='group_objects':
            mode = 9
        else:
            print "Error: unknown type: '%s'"%str(type)
            if _raising(-1,_self): raise pymol.CmdException            
        try:
            _self.lock(_self)
            r = _cmd.get_names(_self._COb,int(mode),int(enabled_only),str(selection))
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #3
0
    def get_model(selection="(all)", state=1, ref='', ref_state=0, _self=cmd):
        '''
DESCRIPTION

    "get_model" returns a ChemPy "Indexed" format model from a selection.

PYMOL API

    cmd.get_model(string selection [,int state] )

        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_model(_self._COb, "(" + str(selection) + ")",
                               int(state) - 1, str(ref),
                               int(ref_state) - 1)
            if r == None:
                r = DEFAULT_ERROR
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #4
0
    def get_title(object, state, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_title" retrieves a text string to the state of a particular
    object which will be displayed when the state is active.

USAGE

    set_title object, state

PYMOL API

    cmd.set_title(string object, int state, string text)

    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_title(_self._COb,str(object),int(state)-1)
            if not quiet:
                if r!=None:
                    print " get_title: %s"%r      
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #5
0
    def get_version(quiet=1,_self=cmd):
	'''
DESCRIPTION
 
    "get_version" returns a tuple of length three containing text,
    floating point, and integer representations of the current PyMOL
    version number.
   
PYMOL API

    cmd.get_version(int quiet)

	'''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)   
            r = _cmd.get_version(_self._COb)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self):
            raise pymol.CmdException
        else:
            if not quiet:
                if _feedback(fb_module.cmd,fb_mask.results,_self):
                    print " version: %s (%8.6f) %d"%r
        return r
Exemple #6
0
    def get_version(quiet=1,_self=cmd):
	'''
DESCRIPTION
 
    "get_version" returns a tuple of length six containing text,
    floating point, and integer representations of the current PyMOL
    version number, build date as unix timestamp, GIT SHA and SVN
    code revision so far available.
   
PYMOL API

    cmd.get_version(int quiet)

	'''
        # get_version doesn't need the _COb and doesn't require a lock
        r = _cmd.get_version()
        if _raising(r,_self):
            raise pymol.CmdException
        else:
            quiet = int(quiet)
            if quiet < 1 and _feedback(fb_module.cmd, fb_mask.results, _self):
                import re
                p = pymol.get_version_message(r)
                print re.sub(r'^', ' ', p, re.M)
                if quiet < 0:
                    if r[3]:
                        print ' build date:', time.strftime('%c %Z', time.localtime(r[3]))
                    if r[4]:
                        print ' git sha:', r[4]
        return r
Exemple #7
0
    def count_frames(quiet=1, _self=cmd):
        '''
DESCRIPTION

    "count_frames" returns the number of frames defined for the PyMOL
    movie.

USAGE

    count_frames
    
PYMOL API

    cmd.count_frames()

SEE ALSO

    frame, count_states
    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.count_frames(_self._COb)
            if not quiet: print " cmd.count_frames: %d frames"%r      
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #8
0
    def index(selection="(all)",quiet=1,_self=cmd):
        '''
DESCRIPTION

    "index" returns a list of tuples corresponding to the
    object name and index of the atoms in the selection.

PYMOL API

    list = cmd.index(string selection="(all)")

NOTE

  Atom indices are fragile and will change as atoms are added
  or deleted.  Whenever possible, use integral atom identifiers
  instead of indices.

        '''
        # preprocess selection
        selection = selector.process(selection)
        #      
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.index(_self._COb,"("+str(selection)+")",0) # 0 = default mode
        finally:
            _self.unlock(r,_self)
        if not quiet:
            if is_list(r):
                if len(r):
                    for a in r:
                        print " cmd.index: (%s`%d)"%(a[0],a[1])
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #9
0
    def count_states(selection="(all)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "count_states" returns the number of states in the selection.

USAGE

    count_states
    
PYMOL API

    cmd.count_states(string selection)

SEE ALSO

    frame
    '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.count_states(_self._COb,selection)
        finally:
            _self.unlock(r,_self)
        if is_ok(r):
            if not quiet:
                print " cmd.count_states: %d states."%r            
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #10
0
    def phi_psi(selection="(byres pk1)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "phi_psi" return the phi and psi angles for a protein atom
    selection.
    
USAGE
        '''

        r = cmd.get_phipsi(selection)
        if r != None:
            kees = r.keys()
            kees.sort()
            if not quiet:
                _self.feedback('push')
                _self.feedback('disable', 'executive', 'actions')
                for a in kees:
                    _self.iterate(
                        "(%s`%d)" % a, "print ' %-9s " +
                        ("( %6.1f, %6.1f )" % r[a]) + "'%(resn+'-'+resi+':')")
                _self.feedback('pop')
        elif _feedback(fb_module.cmd, fb_mask.errors, _self):
            print "cmd-Error: can't compute phi_psi"
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #11
0
    def get_extent(selection="(all)", state=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_extent" returns the minimum and maximum XYZ coordinates of a
    selection as an array:
     [ [ min-X , min-Y , min-Z ],[ max-X, max-Y , max-Z ]]

PYMOL API

    cmd.get_extent(string selection="(all)", state=0 )

        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_min_max(_self._COb, str(selection), int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if not r:
            if _self._raising(_self=_self): raise pymol.CmdException
        elif not quiet:
            print " cmd.extent: min: [%8.3f,%8.3f,%8.3f]" % (r[0][0], r[0][1],
                                                             r[0][2])
            print " cmd.extent: max: [%8.3f,%8.3f,%8.3f]" % (r[1][0], r[1][1],
                                                             r[1][2])
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #12
0
    def find_pairs(selection1,
                   selection2,
                   state1=1,
                   state2=1,
                   cutoff=3.5,
                   mode=0,
                   angle=45,
                   _self=cmd):
        '''
DESCRIPTION

    "find_pairs" is currently undocumented.

        '''
        # preprocess selection
        selection1 = selector.process(selection1)
        selection2 = selector.process(selection2)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.find_pairs(_self._COb, "(" + str(selection1) + ")",
                                "(" + str(selection2) + ")",
                                int(state1) - 1,
                                int(state2) - 1, int(mode), float(cutoff),
                                float(angle))
            # 0 = default mode
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #13
0
    def index(selection="(all)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "index" returns a list of tuples corresponding to the
    object name and index of the atoms in the selection.

PYMOL API

    list = cmd.index(string selection="(all)")

NOTE

  Atom indices are fragile and will change as atoms are added
  or deleted.  Whenever possible, use integral atom identifiers
  instead of indices.

        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.index(_self._COb, "(" + str(selection) + ")",
                           0)  # 0 = default mode
        finally:
            _self.unlock(r, _self)
        if not quiet:
            if is_list(r):
                if len(r):
                    for a in r:
                        print " cmd.index: (%s`%d)" % (a[0], a[1])
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #14
0
    def count_atoms(selection="(all)", quiet=1, state=0, domain='', _self=cmd):
        '''
DESCRIPTION

    "count_atoms" returns a count of atoms in a selection.

USAGE

    count_atoms (selection)

PYMOL API

    cmd.count_atoms(string selection)

        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.select(_self._COb, "_count_tmp",
                            "(" + str(selection) + ")", 1,
                            int(state) - 1, str(domain))
            _cmd.delete(_self._COb, "_count_tmp")
        finally:
            _self.unlock(r, _self)
        if not quiet: print " count_atoms: %d atoms" % r
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #15
0
    def get_movie_length(quiet=1, images=-1, _self=cmd):
        '''
DESCRIPTION

    "get_movie_length" returns the number of frames explicitly defined
    in the movie, not including molecular states.

PYMOL API

    cmd.count_frames()

SEE ALSO

    frame, count_states, count_frames
    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_movie_length(_self._COb)
            if r < 0:
                if images == 0:
                    r = 0
                elif images < 0:
                    r = -r
            if images == 1:
                if r > 0:
                    r = 0
            if r >= 0 and not quiet:
                print " cmd.get_movie_length: %d frames" % r
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #16
0
    def get_version(quiet=1,_self=cmd):
	'''
DESCRIPTION
 
    "get_version" returns a tuple of length six containing text,
    floating point, and integer representations of the current PyMOL
    version number, build date as unix timestamp, GIT SHA and SVN
    code revision so far available.
   
PYMOL API

    cmd.get_version(int quiet)

	'''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)   
            r = _cmd.get_version(_self._COb)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self):
            raise pymol.CmdException
        else:
            quiet = int(quiet)
            if quiet < 1 and _feedback(fb_module.cmd, fb_mask.results, _self):
                print " version: %s (%2.3f) %d," % r[:3],
                print "Incentive Product" if pymol.invocation.options.incentive_product else "Open-Source"
                if quiet < 0:
                    if r[3]:
                        print ' build date:', time.strftime('%c %Z', time.localtime(r[3]))
                    if r[4]:
                        print ' git sha:', r[4]
                    if r[5]:
                        print ' svn rev:', r[5]
        return r
Exemple #17
0
    def id_atom(selection,mode=0,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "id_atom" returns the original source id of a single atom, or
    raises and exception if the atom does not exist or if the selection
    corresponds to multiple atoms.

PYMOL API

    list = cmd.id_atom(string selection)
        '''
        r = DEFAULT_ERROR
        selection = str(selection)
        l = apply(identify,(selection,mode,1))
        ll = len(l)
        if not ll:
            if _feedback(fb_module.cmd,fb_mask.errors,_self):
                print "cmd-Error: atom %s not found by id_atom." % selection
            if _self._raising(_self=_self): raise pymol.CmdException
        elif ll>1:
            if _feedback(fb_module.cmd,fb_mask.errors,_self):
                print "cmd-Error: multiple atoms %s found by id_atom." % selection
            if _self._raising(_self=_self): raise pymol.CmdException
        else:
            r = l[0]
            if not quiet:
                if mode:
                    print " cmd.id_atom: (%s and id %d)"%(r[0],r[1])
                else:
                    print " cmd.id_atom: (id %d)"%r
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #18
0
    def overlap(selection1,
                selection2,
                state1=1,
                state2=1,
                adjust=0.0,
                quiet=1,
                _self=cmd):
        '''
DESCRIPTION

    "overlap" is an unsupported command that may have something to do
    with measuring the total amount of van der Waals overlap between
    two selections.

NOTES

    For best performance, use the smaller molecule as selection 1.
    
    '''

        # preprocess selections
        selection1 = selector.process(selection1)
        selection2 = selector.process(selection2)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.overlap(_self._COb, str(selection1), str(selection2),
                             int(state1) - 1,
                             int(state2) - 1, float(adjust))
            if not quiet: print " cmd.overlap: %5.3f Angstroms." % r
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #19
0
    def overlap(selection1, selection2, state1=1, state2=1, adjust=0.0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "overlap" is an unsupported command that may have something to do
    with measuring the total amount of van der Waals overlap between
    two selections.

NOTES

    For best performance, use the smaller molecule as selection 1.
    
    '''
        
        # preprocess selections
        selection1 = selector.process(selection1)
        selection2 = selector.process(selection2)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.overlap(_self._COb,str(selection1),str(selection2),
                                  int(state1)-1,int(state2)-1,
                                  float(adjust))
            if not quiet: print " cmd.overlap: %5.3f Angstroms."%r
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #20
0
    def get_version(quiet=1, _self=cmd):
        '''
DESCRIPTION
 
    "get_version" returns a tuple of length three containing text,
    floating point, and integer representations of the current PyMOL
    version number.
   
PYMOL API

    cmd.get_version(int quiet)

	'''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_version(_self._COb)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self):
            raise pymol.CmdException
        else:
            if not quiet:
                if _feedback(fb_module.cmd, fb_mask.results, _self):
                    print " version: %s (%2.3f) %d" % r
        return r
Exemple #21
0
    def count_atoms(selection="(all)",quiet=1,state=0,domain='',_self=cmd):
        '''
DESCRIPTION

    "count_atoms" returns a count of atoms in a selection.

USAGE

    count_atoms (selection)

PYMOL API

    cmd.count_atoms(string selection)

        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)   
            r = _cmd.select(_self._COb,"_count_tmp","("+str(selection)+")",1,int(state)-1,str(domain))
            _cmd.delete(_self._COb,"_count_tmp")
        finally:
            _self.unlock(r,_self)
        if not quiet: print " count_atoms: %d atoms"%r
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #22
0
    def get_symmetry(selection="(all)",quiet=1,_self=cmd):
        '''
DESCRIPTION

    "get_symmetry" can be used to obtain the crystal
    and spacegroup parameters for a molecule
    (FUTURE - map object - FUTURE)

USAGE

    get_symmetry object-name-or-selection

PYMOL API

    cmd.get_symmetry(string selection)


        '''
        r = DEFAULT_ERROR
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_symmetry(_self._COb,str(selection))
            if not quiet:
                if(is_list(r)):
                    if(len(r)):
                        print " get_symmetry: A     = %7.3f B    = %7.3f C     = %7.3f"%tuple(r[0:3])
                        print " get_symmetry: Alpha = %7.3f Beta = %7.3f Gamma = %7.3f"%tuple(r[3:6])
                        print " get_symmetry: SpaceGroup = %s"%r[6]
                    else:
                        print " get_symmetry: No symmetry defined."
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #23
0
    def id_atom(selection, mode=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "id_atom" returns the original source id of a single atom, or
    raises and exception if the atom does not exist or if the selection
    corresponds to multiple atoms.

PYMOL API

    list = cmd.id_atom(string selection)
        '''
        r = DEFAULT_ERROR
        selection = str(selection)
        l = apply(identify, (selection, mode, 1))
        ll = len(l)
        if not ll:
            if _feedback(fb_module.cmd, fb_mask.errors, _self):
                print "cmd-Error: atom %s not found by id_atom." % selection
            if _self._raising(_self=_self): raise pymol.CmdException
        elif ll > 1:
            if _feedback(fb_module.cmd, fb_mask.errors, _self):
                print "cmd-Error: multiple atoms %s found by id_atom." % selection
            if _self._raising(_self=_self): raise pymol.CmdException
        else:
            r = l[0]
            if not quiet:
                if mode:
                    print " cmd.id_atom: (%s and id %d)" % (r[0], r[1])
                else:
                    print " cmd.id_atom: (id %d)" % r
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #24
0
    def get_title(object, state, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_title" retrieves a text string to the state of a particular
    object which will be displayed when the state is active.

USAGE

    set_title object, state

PYMOL API

    cmd.set_title(string object, int state, string text)

    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_title(_self._COb, str(object), int(state) - 1)
            if not quiet:
                if r != None:
                    print " get_title: %s" % r
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #25
0
    def count_frames(quiet=1, _self=cmd):
        '''
DESCRIPTION

    "count_frames" returns the number of frames defined for the PyMOL
    movie.

USAGE

    count_frames
    
PYMOL API

    cmd.count_frames()

SEE ALSO

    frame, count_states
    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.count_frames(_self._COb)
            if not quiet: print " cmd.count_frames: %d frames" % r
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #26
0
    def get_movie_length(quiet=1, images=-1, _self=cmd):
        '''
DESCRIPTION

    "get_movie_length" returns the number of frames explicitly defined
    in the movie, not including molecular states.

PYMOL API

    cmd.count_frames()

SEE ALSO

    frame, count_states, count_frames
    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_movie_length(_self._COb)
            if r<0:
                if images==0:
                    r = 0
                elif images<0:
                    r = -r
            if images == 1:
                if r>0:
                    r = 0
            if r>=0 and not quiet:
                print " cmd.get_movie_length: %d frames"%r      
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #27
0
    def count_states(selection="(all)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "count_states" returns the number of states in the selection.

USAGE

    count_states
    
PYMOL API

    cmd.count_states(string selection)

SEE ALSO

    frame
    '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.count_states(_self._COb, selection)
        finally:
            _self.unlock(r, _self)
        if is_ok(r):
            if not quiet:
                print " cmd.count_states: %d states." % r
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #28
0
    def get_extent(selection="(all)",state=0,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "get_extent" returns the minimum and maximum XYZ coordinates of a
    selection as an array:
     [ [ min-X , min-Y , min-Z ],[ max-X, max-Y , max-Z ]]

PYMOL API

    cmd.get_extent(string selection="(all)", state=0 )

        '''
        # preprocess selection
        selection = selector.process(selection)
        #      
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_min_max(_self._COb,str(selection),int(state)-1)
        finally:
            _self.unlock(r,_self)
        if not r:
            if _self._raising(_self=_self): raise pymol.CmdException
        elif not quiet:
            print " cmd.extent: min: [%8.3f,%8.3f,%8.3f]"%(r[0][0],r[0][1],r[0][2])
            print " cmd.extent: max: [%8.3f,%8.3f,%8.3f]"%(r[1][0],r[1][1],r[1][2])      
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #29
0
    def phi_psi(selection="(byres pk1)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "phi_psi" return the phi and psi angles for a protein atom
    selection.
    
USAGE
        '''
        
        r = cmd.get_phipsi(selection)
        if r!=None:
            kees = r.keys()
            kees.sort()
            if not quiet:
                _self.feedback('push')
                _self.feedback('disable','executive','actions')
                for a in kees:
                    _self.iterate("(%s`%d)"%a,"print ' %-9s "+
                                ("( %6.1f, %6.1f )"%r[a])+
                                "'%(resn+'-'+resi+':')")
                _self.feedback('pop')
        elif _feedback(fb_module.cmd,fb_mask.errors,_self):      
            print "cmd-Error: can't compute phi_psi"
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #30
0
 def get_legal_name(name,_self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_legal_name(_self._COb,str(name))
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #31
0
 def get_renderer(_self=cmd):  #
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_renderer(_self._COb)
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #32
0
 def get_color_index(color, _self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_color(_self._COb, str(color), 3)
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #33
0
 def get_legal_name(name, _self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_legal_name(_self._COb, str(name))
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #34
0
 def get_renderer(_self=cmd):  # 
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_renderer(_self._COb)
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #35
0
 def get_color_index(color,_self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_color(_self._COb,str(color),3)
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #36
0
 def get_color_indices(all=0, _self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         if all:
             r = _cmd.get_color(_self._COb, '', 2)
         else:
             r = _cmd.get_color(_self._COb, '', 1)
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #37
0
 def get_color_indices(all=0,_self=cmd):
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         if all:
             r = _cmd.get_color(_self._COb,'',2)
         else:
             r = _cmd.get_color(_self._COb,'',1)            
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #38
0
 def get_phipsi(selection="(name ca)",state=-1,_self=cmd):
     # preprocess selections
     selection = selector.process(selection)
     #   
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_phipsi(_self._COb,"("+str(selection)+")",int(state)-1)
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #39
0
    def find_pairs(selection1,
                   selection2,
                   state1=1,
                   state2=1,
                   cutoff=3.5,
                   mode=0,
                   angle=45,
                   _self=cmd):
        '''
DESCRIPTION

    API only function. Returns a list of atom pairs. Atoms are represented as
    (model,index) tuples.

    Can be restricted to hydrogen-bonding-like contacts. WARNING: Only checks
    atom orientation, not atom type (so would hydrogen bond between carbons for
    example), so make sure to provide appropriate atom selections.

ARGUMENTS

    selection1, selection2 = string: atom selections

    state1, state2 = integer: state-index (only positive values allowed) {default: 1}

    cutoff = float: distance cutoff {default: 3.5}

    mode = integer: if mode=1, do coarse hydrogen bonding assessment {default: 0}

    angle = float: hydrogen bond angle cutoff, only if mode=1 {default: 45.0}

NOTE

    Although this does a similar job like "distance", it uses a completely
    different routine and the "mode" argument has different meanings!
        '''
        # preprocess selection
        selection1 = selector.process(selection1)
        selection2 = selector.process(selection2)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.find_pairs(_self._COb, "(" + str(selection1) + ")",
                                "(" + str(selection2) + ")",
                                int(state1) - 1,
                                int(state2) - 1, int(mode), float(cutoff),
                                float(angle))
            # 0 = default mode
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #40
0
 def get_color_tuple(name, mode=0, _self=cmd):
     name = str(name)
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_color(_self._COb, name, mode)
         if r == None:
             if _feedback(fb_module.cmd, fb_mask.errors, _self):
                 print "cmd-Error: Unknown color '%s'." % name
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #41
0
 def get_color_tuple(name,mode=0,_self=cmd):
     name=str(name)
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_color(_self._COb,name,mode)
         if r==None:
             if _feedback(fb_module.cmd,fb_mask.errors,_self):         
                 print "cmd-Error: Unknown color '%s'."%name
     finally:
         _self.unlock(r,_self)
     if _raising(r,_self): raise pymol.CmdException
     return r
Exemple #42
0
 def get_phipsi(selection="(name ca)", state=-1, _self=cmd):
     # preprocess selections
     selection = selector.process(selection)
     #
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_phipsi(_self._COb, "(" + str(selection) + ")",
                             int(state) - 1)
     finally:
         _self.unlock(r, _self)
     if _raising(r, _self): raise pymol.CmdException
     return r
Exemple #43
0
    def get_dihedral(atom1="pk1",
                     atom2="pk2",
                     atom3="pk3",
                     atom4="pk4",
                     state=-1,
                     quiet=1,
                     _self=cmd):
        '''
DESCRIPTION

    "get_dihedral" returns the dihedral angle between four atoms.  By
    default, the coordinates used are from the current state, however
    an alternate state identifier can be provided.

    By convention, positive dihedral angles are right-handed
    (looking down the atom2-atom3 axis).

USAGE

    get_dihedral atom1, atom2, atom3, atom4 [,state ]

EXAMPLES

    get_dihedral 4/n,4/c,4/ca,4/cb
    get_dihedral 4/n,4/c,4/ca,4/cb,state=4

PYMOL API

    cmd.get_dihedral(atom1,atom2,atom3,atom4,state=-1)

        '''
        # preprocess selections
        atom1 = selector.process(atom1)
        atom2 = selector.process(atom2)
        atom3 = selector.process(atom3)
        atom4 = selector.process(atom4)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_dihe(_self._COb, str(atom1), str(atom2), str(atom3),
                              str(atom4),
                              int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_dihedral: %5.3f degrees." % r
        return r
Exemple #44
0
    def export_dots(object, state, _self=cmd):
        '''
DESCRIPTION

    "export_dots" is an old unsupported command that may have
    something to do with returning the coordinates of the dot
    representation back to the Python layer.

    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.export_dots(_self._COb, object, int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #45
0
    def get_collada(version=2, _self=cmd):
        '''
DESCRIPTION

    "get_collada" returns a COLLADA string representing the content
    currently displayed.

PYMOL API

    cmd.get_collada()

        '''
        r = DEFAULT_ERROR
        with _self.lockcm:
            r = _cmd.get_collada(_self._COb,int(version))
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #46
0
    def get_object_matrix(object, state=1, _self=cmd):
        '''
DESCRIPTION

    "get_object_matrix" is an unsupported command that may have
    something to do with querying the transformation matrices
    associated with an object
        '''
        r = DEFAULT_ERROR
        object = str(object)
        try:
            _self.lock(_self)
            r = _cmd.get_object_matrix(_self._COb, str(object), int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #47
0
    def get_object_matrix(object,state=1,_self=cmd):
        '''
DESCRIPTION

    "get_object_matrix" is an unsupported command that may have
    something to do with querying the transformation matrices
    associated with an object
        '''
        r = DEFAULT_ERROR
        object = str(object)
        try:
            _self.lock(_self)   
            r = _cmd.get_object_matrix(_self._COb,str(object), int(state)-1)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #48
0
    def export_dots(object,state,_self=cmd):  
        '''
DESCRIPTION

    "export_dots" is an old unsupported command that may have
    something to do with returning the coordinates of the dot
    representation back to the Python layer.

    '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.export_dots(_self._COb,object,int(state)-1)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #49
0
 def paste(_self=cmd): # INTERNAL
     r=DEFAULT_SUCCESS
     lst = []
     if hasattr(pymol,"machine_get_clipboard"):
         lst = pymol.machine_get_clipboard()
     if len(lst):
         new_lst = []
         for a in lst:
             while len(a):
                 if ord(a[-1])>32:
                     break
                 else:
                     a=a[:-1]
             if len(a):
                 new_lst.append(a)
         r = _cmd.paste(_self._COb,new_lst)
     if _raising(r,_self): raise pymol.CmdException
     return r 
Exemple #50
0
    def get_angle(atom1="pk1",
                  atom2="pk2",
                  atom3="pk3",
                  state=-1,
                  quiet=1,
                  _self=cmd):
        '''
DESCRIPTION

    "get_angle" returns the angle between three atoms.  By default, the
    coordinates used are from the current state, however an alternate
    state identifier can be provided.

USAGE

    get_angle atom1, atom2, atom3, [,state ]

EXAMPLES

    get_angle 4/n,4/c,4/ca
    get_angle 4/n,4/c,4/ca,state=4

PYMOL API

    cmd.get_angle(atom1="pk1",atom2="pk2",atom3="pk3",state=-1)

        '''
        # preprocess selections
        atom1 = selector.process(atom1)
        atom2 = selector.process(atom2)
        atom3 = selector.process(atom3)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_angle(_self._COb, str(atom1), str(atom2), str(atom3),
                               int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_angle: %5.3f degrees." % r
        return r
Exemple #51
0
    def find_pairs(selection1,selection2,state1=1,state2=1,cutoff=3.5,mode=0,angle=45,_self=cmd):
        '''
DESCRIPTION

    API only function. Returns a list of atom pairs. Atoms are represented as
    (model,index) tuples.

    Can be restricted to hydrogen-bonding-like contacts. WARNING: Only checks
    atom orientation, not atom type (so would hydrogen bond between carbons for
    example), so make sure to provide appropriate atom selections.

ARGUMENTS

    selection1, selection2 = string: atom selections

    state1, state2 = integer: state-index (only positive values allowed) {default: 1}

    cutoff = float: distance cutoff {default: 3.5}

    mode = integer: if mode=1, do coarse hydrogen bonding assessment {default: 0}

    angle = float: hydrogen bond angle cutoff, only if mode=1 {default: 45.0}

NOTE

    Although this does a similar job like "distance", it uses a completely
    different routine and the "mode" argument has different meanings!
        '''
        # preprocess selection
        selection1 = selector.process(selection1)
        selection2 = selector.process(selection2)
        #      
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.find_pairs(_self._COb,"("+str(selection1)+")",
                                      "("+str(selection2)+")",
                                      int(state1)-1,int(state2)-1,
                                      int(mode),float(cutoff),float(angle))
            # 0 = default mode
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #52
0
    def get_position(quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_position" returns the 3D coordinates of the center of the
    viewer window.

    '''
        
        try:
            _self.lock(_self)
            r = _cmd.get_position(_self._COb)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_position: [%8.3f,%8.3f,%8.3f]"%(r[0],r[1],r[2])
        return r
Exemple #53
0
    def get_type(name, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_type" returns a string describing the named object or
     selection or the string "nonexistent" if the name in unknown.

PYMOL API

    cmd.get_type(string object-name)

NOTES

    Possible return values are

    "object:molecule"
    "object:map"
    "object:mesh"
    "object:slice"
    "object:surface"
    "object:measurement"
    "object:cgo"
    "object:group"
    "object:volume"
    "selection"

SEE ALSO

    get_names
        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_type(_self._COb, str(name))
        finally:
            _self.unlock(r, _self)
        if is_error(r):
            if not quiet and _feedback(fb_module.cmd, fb_mask.errors, _self):
                print "Cmd-Error: unrecognized name."
        elif not quiet:
            print r
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #54
0
    def get_raw_alignment(name='', active_only=0, _self=cmd):
        '''
DESCRIPTION

    "get_raw_alignment" returns a list of lists of (object,index)
    tuples containing the raw per-atom alignment relationships

PYMOL API

    cmd.get_raw_alignment(name)

        '''
        try:
            _self.lock(_self)
            r = _cmd.get_raw_alignment(_self._COb, str(name), int(active_only))
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #55
0
    def get_position(quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_position" returns the 3D coordinates of the center of the
    viewer window.

    '''

        try:
            _self.lock(_self)
            r = _cmd.get_position(_self._COb)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_position: [%8.3f,%8.3f,%8.3f]" % (r[0], r[1], r[2])
        return r
Exemple #56
0
    def get_type(name,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "get_type" returns a string describing the named object or
     selection or the string "nonexistent" if the name in unknown.

PYMOL API

    cmd.get_type(string object-name)

NOTES

    Possible return values are

    "object:molecule"
    "object:map"
    "object:mesh"
    "object:slice"
    "object:surface"
    "object:measurement"
    "object:cgo"
    "object:group"
    "object:volume"
    "selection"

SEE ALSO

    get_names
        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_type(_self._COb,str(name))
        finally:
            _self.unlock(r,_self)
        if is_error(r):
            if not quiet and _feedback(fb_module.cmd,fb_mask.errors,_self):      
                print "Cmd-Error: unrecognized name."
        elif not quiet:
            print r
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #57
0
    def get_raw_alignment(name='',active_only=0,_self=cmd):
        '''
DESCRIPTION

    "get_raw_alignment" returns a list of lists of (object,index)
    tuples containing the raw per-atom alignment relationships

PYMOL API

    cmd.get_raw_alignment(name)

        '''
        try:
            _self.lock(_self)
            r = _cmd.get_raw_alignment(_self._COb,str(name),int(active_only))
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Exemple #58
0
    def get_dihedral(atom1="pk1",atom2="pk2",atom3="pk3",atom4="pk4",state=-1,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "get_dihedral" returns the dihedral angle between four atoms.  By
    default, the coordinates used are from the current state, however
    an alternate state identifier can be provided.

    By convention, positive dihedral angles are right-handed
    (looking down the atom2-atom3 axis).

USAGE

    get_dihedral atom1, atom2, atom3, atom4 [,state ]

EXAMPLES

    get_dihedral 4/n,4/c,4/ca,4/cb
    get_dihedral 4/n,4/c,4/ca,4/cb,state=4

PYMOL API

    cmd.get_dihedral(atom1,atom2,atom3,atom4,state=-1)

        '''
        # preprocess selections
        atom1 = selector.process(atom1)
        atom2 = selector.process(atom2)
        atom3 = selector.process(atom3)
        atom4 = selector.process(atom4)
        #   
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_dihe(_self._COb,str(atom1),str(atom2),str(atom3),str(atom4),int(state)-1)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_dihedral: %5.3f degrees."%r
        return r
Exemple #59
0
    def get_idtf(_self=cmd):
        '''
DESCRIPTION

    "get_idft" is under development, but should eventually return an
    idtf file containing multiple objects and scenes.

PYMOL API

    cmd.idtf()

        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_idtf(_self._COb)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Exemple #60
0
    def get_vrml(version=2, _self=cmd):
        '''
DESCRIPTION

    "get_vrml" returns a VRML2 string representing the content
    currently displayed.

PYMOL API

    cmd.get_vrml()

        '''
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_vrml(_self._COb, int(version))
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r