Пример #1
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
Пример #2
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
Пример #3
0
    def fit(mobile,
            target,
            mobile_state=0,
            target_state=0,
            quiet=1,
            matchmaker=0,
            cutoff=2.0,
            cycles=0,
            object=None,
            _self=cmd):
        '''
DESCRIPTION

	"fit" superimposes the model in the first selection on to the model
	in the second selection.
	
USAGE

	fit mobile, target

EXAMPLES

	fit protA, protB

NOTES

	Only matching atoms in both selections will be used for the fit.
	
	Since atoms are matched based on all of their identifiers
	(including segment and chain identifiers), this command is only
	helpful when comparing very similar structures.

SEE ALSO

	align, super, pair_fit, rms, rms_cur, intra_fit, intra_rms, intra_rms_cur
		'''
        r = DEFAULT_ERROR
        a = str(mobile)
        b = str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object == None: object = ''
        if int(matchmaker) == 0:
            sele1 = "((%s) in (%s))" % (str(a), str(b))
            sele2 = "((%s) in (%s))" % (str(b), str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)
            r = _cmd.fit(_self._COb, sele1, sele2, 2,
                         int(mobile_state) - 1,
                         int(target_state) - 1, int(quiet), int(matchmaker),
                         float(cutoff), int(cycles), str(object))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #4
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
Пример #5
0
    def fit(mobile, target, mobile_state=0, target_state=0,
              quiet=1, matchmaker=0, cutoff=2.0, cycles=0, object=None, _self=cmd):
        '''
DESCRIPTION

    "fit" superimposes the model in the first selection on to the model
    in the second selection.
    
USAGE

    fit mobile, target

EXAMPLES

    fit protA, protB

NOTES

    Only matching atoms in both selections will be used for the fit.
    
    Since atoms are matched based on all of their identifiers
    (including segment and chain identifiers), this command is only
    helpful when comparing very similar structures.

SEE ALSO

    align, super, pair_fit, rms, rms_cur, intra_fit, intra_rms, intra_rms_cur
        '''
        r = DEFAULT_ERROR      
        a=str(mobile)
        b=str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object==None: object=''
        if int(matchmaker)==0:
            sele1 = "((%s) in (%s))" % (str(a),str(b))
            sele2 = "((%s) in (%s))" % (str(b),str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)
            r = _cmd.fit(_self._COb,sele1,sele2,2,
                             int(mobile_state)-1,int(target_state)-1,
                             int(quiet),int(matchmaker),float(cutoff),
                             int(cycles),str(object))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #6
0
    def rms(mobile,
            target,
            mobile_state=0,
            target_state=0,
            quiet=1,
            matchmaker=0,
            cutoff=2.0,
            cycles=0,
            object=None,
            _self=cmd):
        '''
DESCRIPTION

	"rms" computes a RMS fit between two atom selections, but does not
	tranform the models after performing the fit.

USAGE

	rms (selection), (target-selection)

EXAMPLES

	fit ( mutant and name ca ), ( wildtype and name ca )

SEE ALSO

	fit, rms_cur, intra_fit, intra_rms, intra_rms_cur, pair_fit	  
		'''
        r = DEFAULT_ERROR
        a = str(mobile)
        b = str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object == None: object = ''
        if int(matchmaker) == 0:
            sele1 = "((%s) in (%s))" % (str(a), str(b))
            sele2 = "((%s) in (%s))" % (str(b), str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)
            r = _cmd.fit(_self._COb, sele1, sele2, 1,
                         int(mobile_state) - 1,
                         int(target_state) - 1, int(quiet), int(matchmaker),
                         float(cutoff), int(cycles), str(object))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #7
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
Пример #8
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
Пример #9
0
    def rms_cur(mobile,
                target,
                mobile_state=0,
                target_state=0,
                quiet=1,
                matchmaker=0,
                cutoff=2.0,
                cycles=0,
                object=None,
                _self=cmd):
        '''
DESCRIPTION

	"rms_cur" computes the RMS difference between two atom
	selections without performing any fitting.

USAGE

	rms_cur (selection), (selection)

SEE ALSO

	fit, rms, intra_fit, intra_rms, intra_rms_cur, pair_fit	  
		'''
        r = DEFAULT_ERROR
        a = str(mobile)
        b = str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object == None: object = ''
        if int(matchmaker) == 0:
            sele1 = "((%s) in (%s))" % (str(a), str(b))
            sele2 = "((%s) in (%s))" % (str(b), str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)
            r = _cmd.fit(_self._COb, sele1, sele2, 0,
                         int(mobile_state) - 1,
                         int(target_state) - 1, int(quiet), int(matchmaker),
                         float(cutoff), int(cycles), str(object))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #10
0
    def symexp(prefix, object, selection, cutoff, segi=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "symexp" creates all symmetry-related objects for the specified
    object that occur within a cutoff about an atom selection.

USAGE

    symexp prefix, object, selection, cutoff

NOTES

    The newly objects are labeled using the prefix provided along with
    their crystallographic symmetry operation and translation.

SEE ALSO

    load
        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.symexp(_self._COb, str(prefix),
                            str(object), "(" + str(selection) + ")",
                            float(cutoff), int(segi), int(quiet))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #11
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
Пример #12
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
Пример #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
Пример #14
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
Пример #15
0
    def mask(selection="(all)",quiet=1,_self=cmd):
        '''
DESCRIPTION

    "mask" makes it impossible to select the indicated atoms using the
    mouse.  This is useful when you are working with one molecule in
    front of another and wish to avoid accidentally selecting atoms in
    the background.

USAGE

    mask (selection)

PYMOL API

    cmd.mask( string selection="(all)" )

SEE ALSO

    unmask, protect, deprotect, mouse
    '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)   
            r = _cmd.mask(_self._COb,"("+str(selection)+")",1,int(quiet))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #16
0
    def unmask(selection="(all)",quiet=1,_self=cmd):
        '''
DESCRIPTION

    "unmask" reverses the effect of "mask" on the indicated atoms.

PYMOL API

    cmd.unmask( string selection="(all)" )

USAGE

    unmask (selection)

SEE ALSO

    mask, protect, deprotect, mouse
    '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #   
        try:
            _self.lock(_self)   
            r = _cmd.mask(_self._COb,"("+str(selection)+")",0,int(quiet))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #17
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
Пример #18
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
Пример #19
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
Пример #20
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
Пример #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
Пример #22
0
    def symexp(prefix, object, selection, cutoff, segi=0, quiet=1,_self=cmd):
        '''
DESCRIPTION

    "symexp" creates all symmetry-related objects for the specified
    object that occur within a cutoff about an atom selection.

USAGE

    symexp prefix, object, selection, cutoff

NOTES

    The newly objects are labeled using the prefix provided along with
    their crystallographic symmetry operation and translation.

SEE ALSO

    load
        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection=selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.symexp(_self._COb,str(prefix),str(object),
                            "("+str(selection)+")",float(cutoff),
                            int(segi),int(quiet))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException                           
        return r
Пример #23
0
    def unmask(selection="(all)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "unmask" reverses the effect of "mask" on the indicated atoms.

PYMOL API

    cmd.unmask( string selection="(all)" )

USAGE

    unmask (selection)

SEE ALSO

    mask, protect, deprotect, mouse
    '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.mask(_self._COb, "(" + str(selection) + ")", 0,
                          int(quiet))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #24
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
Пример #25
0
    def mask(selection="(all)", quiet=1, _self=cmd):
        '''
DESCRIPTION

    "mask" makes it impossible to select the indicated atoms using the
    mouse.  This is useful when you are working with one molecule in
    front of another and wish to avoid accidentally selecting atoms in
    the background.

USAGE

    mask (selection)

PYMOL API

    cmd.mask( string selection="(all)" )

SEE ALSO

    unmask, protect, deprotect, mouse
    '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #
        try:
            _self.lock(_self)
            r = _cmd.mask(_self._COb, "(" + str(selection) + ")", 1,
                          int(quiet))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #26
0
    def indicate(selection="(all)",_self=cmd):
        '''
DESCRIPTION

    "indicate" shows a visual representation of an atom selection.

USAGE

    indicate (selection)

PYMOL API

    cmd.count(string selection)

        '''
        r = DEFAULT_ERROR
        # preprocess selection
        selection = selector.process(selection)
        #      
        try:
            _self.lock(_self)   
            r = _cmd.select(_self._COb,"indicate","("+str(selection)+")",1,-1,'')
            if is_error(r):
                _self.delete("indicate")
            else:
                _self.enable("indicate")
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException                  
        return r
Пример #27
0
    def intra_fit(selection, state=1, quiet=1, mix=0, _self=cmd):
        '''
DESCRIPTION

    "intra_fit" fits all states of an object to an atom selection
    in the specified state.  It returns the rms values to python
    as an array.

USAGE 

    intra_fit selection [, state]

ARGUMENTS

    selection = string: atoms to fit

    state = integer: target state

PYMOL API

    cmd.intra_fit( string selection, int state )

EXAMPLES

    intra_fit ( name ca )

PYTHON EXAMPLE

    from pymol import cmd
    rms = cmd.intra_fit("(name ca)",1)

SEE ALSO

    fit, rms, rms_cur, intra_rms, intra_rms_cur, pair_fit
        '''
        # preprocess selection
        selection = selector.process(selection)
        #   
        r = DEFAULT_ERROR
        state = int(state)
        mix = int(mix)
        try:
            _self.lock(_self)
            r = _cmd.intrafit(_self._COb,"("+str(selection)+")",int(state)-1,2,int(quiet),int(mix))
        finally:
            _self.unlock(r,_self)
        if r<0.0:
            r = DEFAULT_ERROR
        elif not quiet:
            st = 1
            for a in r:
                if a>=0.0:
                    if mix:
                        print " cmd.intra_fit: %5.3f in state %d vs mixed target"%(a,st)
                    else:
                        print " cmd.intra_fit: %5.3f in state %d vs state %d"%(a,st,state)
                st = st + 1
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #28
0
    def isodot(name,
               map,
               level=1.0,
               selection='',
               buffer=0.0,
               state=0,
               carve=None,
               source_state=0,
               quiet=1,
               _self=cmd):
        '''
DESCRIPTION

    "isodot" creates a dot isosurface object from a map object.

USAGE

    isodot name = map, level [,(selection) [,buffer [, state ] ] ] 

ARGUMENTS

    map = the name of the map object to use.

    level = the contour level.

    selection = an atom selection about which to display the mesh with
        an additional "buffer" (if provided).

NOTES

    If the dot isosurface object already exists, then the new dots will
    be appended onto the object as a new state.

SEE ALSO

    load, isomesh
        '''
        r = DEFAULT_ERROR
        if selection != '':
            region = 1  # about a selection
        else:
            region = 0  # render the whole map
        # preprocess selections
        selection = selector.process(selection)
        if selection not in ['center', 'origin']:
            selection = "(" + selection + ")"
        #
        if carve == None:
            carve = 0.0
        try:
            _self.lock(_self)
            r = _cmd.isomesh(_self._COb, str(name), str(map), int(region),
                             selection, float(buffer), float(level), 1,
                             int(state) - 1, float(carve),
                             int(source_state) - 1, int(quiet), float(level))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #29
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
Пример #30
0
    def rms(mobile, target, mobile_state=0, target_state=0, quiet=1,
              matchmaker=0, cutoff=2.0, cycles=0, object=None, _self=cmd):
        '''
DESCRIPTION

    "rms" computes a RMS fit between two atom selections, but does not
    tranform the models after performing the fit.

USAGE

    rms (selection), (target-selection)

EXAMPLES

    fit ( mutant and name ca ), ( wildtype and name ca )

SEE ALSO

    fit, rms_cur, intra_fit, intra_rms, intra_rms_cur, pair_fit   
        '''
        r = DEFAULT_ERROR      
        a=str(mobile)
        b=str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object==None: object=''      
        if int(matchmaker)==0:
            sele1 = "((%s) in (%s))" % (str(a),str(b))
            sele2 = "((%s) in (%s))" % (str(b),str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)   
            r = _cmd.fit(_self._COb,sele1,sele2,1,
                             int(mobile_state)-1,int(target_state)-1,
                             int(quiet),int(matchmaker),float(cutoff),
                             int(cycles),str(object))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #31
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
Пример #32
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
Пример #33
0
    def pseudoatom(object='', selection='', name='PS1', resn='PSD', resi='1', chain='P',
                   segi='PSDO', elem='PS', vdw=-1.0, hetatm=1, b=0.0, q=0.0, color='',
                   label='', pos=None, state=0, mode='rms', quiet=1,_self=cmd):
        '''
        
DESCRIPTION

    "pseudoatom" adds a pseudoatom to a molecular object, and will
    creating the molecular object if it does not yet exist.
    
USAGE

    pseudoatom object [, selection [, name [, resn [, resi [, chain
        [, segi [, elem [, vdw [, hetatm [, b [, q [, color [, label
        [, pos [, state [, mode [, quiet ]]]]]]]]]]]]]]]]]

NOTES

    "pseudoatom" can be used for a wide variety of random tasks where
    on must place an atom or a label in 3D space.
    
    '''
        
        r = DEFAULT_ERROR      
        # preprocess selection
        if len(color):
            color = _self.get_color_index(str(color))
        else:
            color = -1 # default
        object = str(object)
        if not len(object):
            object = _self.get_unused_name(prefix="pseudo")
        selection = selector.process(selection)
        mode = pseudoatom_mode_dict[pseudoatom_mode_sc.auto_err(str(mode),'pseudoatom mode')]
        
        (name,resn,resi,chain,segi,elem,label) = map(unquote,(name,resn,resi,chain,segi,elem,label))
        #      
        try:
            _self.lock(_self)
            if pos!=None:
                if not (is_list(pos) or is_tuple(pos)):
                    pos = safe_list_eval(pos)
                pos = (float(pos[0]), # tuple-ize
                       float(pos[1]),
                       float(pos[2]))
            if len(selection.split())>1:
                selection = "("+str(selection)+")"
            r = _cmd.pseudoatom(_self._COb,str(object), str(selection),
                                str(name), str(resn), str(resi), str(chain),
                                str(segi), str(elem), float(vdw), int(hetatm),
                                float(b), float(q), str(label), pos, int(color),
                                int(state)-1, int(mode), int(quiet))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException                                    
        return r
Пример #34
0
    def gradient(name,
                 map,
                 minimum=1.0,
                 maximum=-1.0,
                 selection='',
                 buffer=0.0,
                 state=0,
                 carve=None,
                 source_state=0,
                 quiet=1,
                 _self=cmd):
        '''
DESCRIPTION

    "gradient" creates a gradient object from a map object.

USAGE

    gradient name = map, [ minimum, [, maximum [, selection [, buffer [, state ]]]]]

ARGUMENTS

    map = the name of the map object to use.

    minimum, maximum = minimum and maximum levels (default: full map range)

    selection = an atom selection about which to display the mesh with
        an additional "buffer" (if provided).

SEE ALSO

    load, isomesh
        '''
        r = DEFAULT_ERROR
        if selection != '':
            region = 1  # about a selection
        else:
            region = 0  # render the whole map
        # preprocess selections
        selection = selector.process(selection)
        if selection not in ['center', 'origin']:
            selection = "(" + selection + ")"
        #
        if carve == None:
            carve = 0.0
        try:
            _self.lock(_self)
            r = _cmd.isomesh(_self._COb, str(name), str(map), int(region),
                             selection, float(buffer), float(minimum), 3,
                             int(state) - 1, float(carve),
                             int(source_state) - 1, int(quiet), float(maximum))
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #35
0
    def rms_cur(mobile, target, mobile_state=0, target_state=0,
                quiet=1, matchmaker=0, cutoff=2.0, cycles=0,
                object=None, _self=cmd):
        
        '''
DESCRIPTION

    "rms_cur" computes the RMS difference between two atom
    selections without performing any fitting.

USAGE

    rms_cur (selection), (selection)

SEE ALSO

    fit, rms, intra_fit, intra_rms, intra_rms_cur, pair_fit   
        '''
        r = DEFAULT_ERROR      
        a=str(mobile)
        b=str(target)
        # preprocess selections
        a = selector.process(a)
        b = selector.process(b)
        #
        if object==None: object=''            
        if int(matchmaker)==0:
            sele1 = "((%s) in (%s))" % (str(a),str(b))
            sele2 = "((%s) in (%s))" % (str(b),str(a))
        else:
            sele1 = str(a)
            sele2 = str(b)
        try:
            _self.lock(_self)
            r = _cmd.fit(_self._COb,sele1,sele2,0,
                             int(mobile_state)-1,int(target_state)-1,
                             int(quiet),int(matchmaker),float(cutoff),
                             int(cycles),str(object))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #36
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
Пример #37
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
Пример #38
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
Пример #39
0
    def isodot(name,map,level=1.0,selection='',buffer=0.0,state=0,
                  carve=None,source_state=0,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "isodot" creates a dot isosurface object from a map object.

USAGE

    isodot name = map, level [,(selection) [,buffer [, state ] ] ] 

ARGUMENTS

    map = the name of the map object to use.

    level = the contour level.

    selection = an atom selection about which to display the mesh with
        an additional "buffer" (if provided).

NOTES

    If the dot isosurface object already exists, then the new dots will
    be appended onto the object as a new state.

SEE ALSO

    load, isomesh
        '''
        r = DEFAULT_ERROR
        if selection!='':
            region = 1 # about a selection
        else:
            region = 0 # render the whole map
        # preprocess selections
        selection = selector.process(selection)
        if selection not in [ 'center', 'origin' ]:
            selection = "("+selection+")"
        #
        if carve==None:
            carve=0.0
        try:
            _self.lock(_self)
            r = _cmd.isomesh(_self._COb,str(name),str(map),int(region),
                             selection,float(buffer),
                             float(level),1,int(state)-1,
                             float(carve),int(source_state)-1,int(quiet),
                             float(level))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException                  
        return r
Пример #40
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
Пример #41
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
Пример #42
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
Пример #43
0
    def gradient(name, map, minimum=1.0, maximum=-1.0,
                 selection='', buffer=0.0, state=0,
                 carve=None, source_state=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "gradient" creates a gradient object from a map object.

USAGE

    gradient name = map, [ minimum, [, maximum [, selection [, buffer [, state ]]]]]

ARGUMENTS

    map = the name of the map object to use.

    minimum, maximum = minimum and maximum levels (default: full map range)

    selection = an atom selection about which to display the mesh with
        an additional "buffer" (if provided).

SEE ALSO

    load, isomesh
        '''
        r = DEFAULT_ERROR
        if selection!='':
            region = 1 # about a selection
        else:
            region = 0 # render the whole map
        # preprocess selections
        selection = selector.process(selection)
        if selection not in [ 'center', 'origin' ]:
            selection = "("+selection+")"
        #
        if carve==None:
            carve=0.0
        try:
            _self.lock(_self)
            r = _cmd.isomesh(_self._COb,str(name),str(map),int(region),
                             selection,float(buffer),
                             float(minimum),3,int(state)-1,
                             float(carve),int(source_state)-1,int(quiet),
                             float(maximum))
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException                  
        return r
Пример #44
0
    def get_coords(selection='all', state=1, quiet=1, _self=cmd):
        '''
DESCRIPTION

    API only. Get selection coordinates as numpy array.

ARGUMENTS

    selection = str: atom selection {default: all}

    state = int: state index or all states if state=0 {default: 1}
        '''
        selection = selector.process(selection)
        with _self.lockcm:
            r = _cmd.get_coords(_self._COb, selection, int(state) - 1)
            return r
Пример #45
0
    def pair_fit(*arg, **kw):
        '''
DESCRIPTION

    "pair_fit" fits matched sets of atom pairs between two objects.

USAGE

    pair_fit selection, selection, [ selection, selection [ ... ]]

EXAMPLES

    # superimpose protA residues 10-25 and 33-46 to protB residues 22-37 and 41-54:
    
    pair_fit protA/10-25+33-46/CA, protB/22-37+41-54/CA

    # superimpose ligA atoms C1, C2, and C4 to ligB atoms C8, C4, and C10, respectively:
    
    pair_fit ligA////C1, ligB////C8, ligA////C2, ligB////C4, ligA////C3, ligB////C10
    
NOTES

    So long as the atoms are stored in PyMOL with the same order
    internally, you can provide just two selections.  Otherwise, you
    may need to specify each pair of atoms separately, two by two, as
    additional arguments to pair_fit.
    
    Script files are usually recommended when using this command.

SEE ALSO

    fit, rms, rms_cur, intra_fit, intra_rms, intra_rms_cur
        '''
        _self = kw.get('_self',cmd)
        r = DEFAULT_ERROR      
        new_arg = []
        for a in arg:
            new_arg.append(selector.process(a))
        try:
            _self.lock(_self)   
            r = _cmd.fit_pairs(_self._COb,new_arg)
        finally:
            _self.unlock(r,_self)
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #46
0
    def intra_rms(selection, state=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

        "intra_rms" calculates rms fit values for all states of an object
        over an atom selection relative to the indicated state.
        Coordinates are left unchanged.  The rms values are returned as a
        python array.

EXAMPLE

        from pymol import cmd
        rms = cmd.intra_rms("(name ca)",1)
        print rms

PYMOL API

        cmd.intra_rms(string selection, int state)

SEE ALSO

        fit, rms, rms_cur, intra_fit, intra_rms_cur, pair_fit
                '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        state = int(state)
        try:
            _self.lock(_self)
            r = _cmd.intrafit(_self._COb, "(" + str(selection) + ")",
                              int(state) - 1, 1, int(quiet), int(0))
        finally:
            _self.unlock(r, _self)
        if r < 0.0:
            r = DEFAULT_ERROR
        elif not quiet:
            st = 1
            for a in r:
                if a >= 0.0:
                    print " cmd.intra_rms: %5.3f in state %d vs state %d" % (
                        a, st, state)
                st = st + 1
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #47
0
    def pair_fit(*arg, **kw):
        '''
DESCRIPTION

	"pair_fit" fits matched sets of atom pairs between two objects.

USAGE

	pair_fit selection, selection, [ selection, selection [ ... ]]

EXAMPLES

	# superimpose protA residues 10-25 and 33-46 to protB residues 22-37 and 41-54:
	
	pair_fit protA/10-25+33-46/CA, protB/22-37+41-54/CA

	# superimpose ligA atoms C1, C2, and C4 to ligB atoms C8, C4, and C10, respectively:
	
	pair_fit ligA////C1, ligB////C8, ligA////C2, ligB////C4, ligA////C3, ligB////C10
	
NOTES

	So long as the atoms are stored in PyMOL with the same order
	internally, you can provide just two selections.  Otherwise, you
	may need to specify each pair of atoms separately, two by two, as
	additional arguments to pair_fit.
	
	Script files are usually recommended when using this command.

SEE ALSO

	fit, rms, rms_cur, intra_fit, intra_rms, intra_rms_cur
		'''
        _self = kw.get('_self', cmd)
        r = DEFAULT_ERROR
        new_arg = []
        for a in arg:
            new_arg.append(selector.process(a))
        try:
            _self.lock(_self)
            r = _cmd.fit_pairs(_self._COb, new_arg)
        finally:
            _self.unlock(r, _self)
        if _self._raising(r, _self): raise pymol.CmdException
        return r
Пример #48
0
 def get_area(selection="(all)",state=1,load_b=0,quiet=1,_self=cmd):
     '''
     PRE-RELEASE functionality - API will change
     '''
     # preprocess selection
     selection = selector.process(selection)
     #
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_area(_self._COb,"("+str(selection)+")",int(state)-1,int(load_b))
     finally:
         _self.unlock(r,_self)
     if r<0.0: # negative area signals error condition
         if _self._raising(): raise pymol.CmdException
     elif not quiet:
         print " cmd.get_area: %5.3f Angstroms^2."%r
     return r
Пример #49
0
    def intra_rms(selection, state=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "intra_rms" calculates rms fit values for all states of an object
    over an atom selection relative to the indicated state.
    Coordinates are left unchanged.  The rms values are returned as a
    python array.

EXAMPLE

    from pymol import cmd
    rms = cmd.intra_rms("(name ca)",1)
    print rms

PYMOL API

    cmd.intra_rms(string selection, int state)

SEE ALSO

    fit, rms, rms_cur, intra_fit, intra_rms_cur, pair_fit
        '''
        # preprocess selection
        selection = selector.process(selection)
        #   
        r = DEFAULT_ERROR
        state = int(state)
        try:
            _self.lock(_self)
            r = _cmd.intrafit(_self._COb,"("+str(selection)+")",int(state)-1,1,int(quiet),int(0))
        finally:
            _self.unlock(r,_self)
        if r<0.0:
            r = DEFAULT_ERROR
        elif not quiet:
            st = 1
            for a in r:
                if a>=0.0:
                    print " cmd.intra_rms: %5.3f in state %d vs state %d"%(a,st,state)
                st = st + 1
        if _self._raising(r,_self): raise pymol.CmdException         
        return r
Пример #50
0
 def get_area(selection="(all)", state=1, load_b=0, quiet=1, _self=cmd):
     '''
     PRE-RELEASE functionality - API will change
     '''
     # preprocess selection
     selection = selector.process(selection)
     #
     r = DEFAULT_ERROR
     try:
         _self.lock(_self)
         r = _cmd.get_area(_self._COb, "(" + str(selection) + ")",
                           int(state) - 1, int(load_b))
     finally:
         _self.unlock(r, _self)
     if r < 0.0:  # negative area signals error condition
         if _self._raising(): raise pymol.CmdException
     elif not quiet:
         print " cmd.get_area: %5.3f Angstroms^2." % r
     return r
Пример #51
0
    def get_object_list(selection="(all)", quiet=1, _self=cmd):
        '''
        
DESCRIPTION

    "get_object_list" is an unsupported command that may have
    something to do with querying the objects covered by a selection.
    '''
        
        r = DEFAULT_ERROR
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_object_list(_self._COb,str(selection))
            if not quiet:
                if(is_list(r)):
                    print " get_object_list: ",str(r)
        finally:
            _self.unlock(r,_self)
        if _raising(r,_self): raise pymol.CmdException
        return r
Пример #52
0
    def get_object_list(selection="(all)", quiet=1, _self=cmd):
        '''
        
DESCRIPTION

    "get_object_list" is an unsupported command that may have
    something to do with querying the objects covered by a selection.
    '''

        r = DEFAULT_ERROR
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_object_list(_self._COb, str(selection))
            if not quiet:
                if (is_list(r)):
                    print " get_object_list: ", str(r)
        finally:
            _self.unlock(r, _self)
        if _raising(r, _self): raise pymol.CmdException
        return r
Пример #53
0
    def get_atom_coords(selection, state=0,quiet=1,_self=cmd):
        '''
DESCRIPTION

    "get_atom_coords" returns the 3D coordinates of a single atom.
    
    '''
        # low performance way to get coords for a single atom
        r = []
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_atom_coords(_self._COb,str(selection),int(state)-1,int(quiet))
        finally:
            _self.unlock(r,_self)
        if r==None:
            if _self._raising(_self=_self): raise pymol.CmdException
        elif not quiet:
            for a in r:
                print " cmd.get_coords: [%8.3f,%8.3f,%8.3f]"%(a)
        if _raising(r,_self): raise pymol.CmdException
        return r
Пример #54
0
    def check(selection=None, preserve=0):
        '''
DESCRIPTION

    "check" is unsupported command that may eventually have something
    to do with assigning forcefield parameters to a selection of
    atoms.
    
'''
        # This function relies on code that is not currently part of PyMOL/ChemPy
        # NOTE: the realtime module relies on code that is not yet part of PyMOL/ChemPy
        from chempy.tinker import realtime
        if selection == None:
            arg = cmd.get_names("objects")
            arg = arg[0:1]
            if arg:
                if len(arg):
                    selection = arg
        if selection != None:
            selection = selector.process(selection)
            realtime.assign("(" + selection + ")", int(preserve))
            realtime.setup("(" + selection + ")")
Пример #55
0
    def identify(selection="(all)", mode=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "identify" returns a list of atom IDs corresponding to the ID code
    of atoms in the selection.

PYMOL API

    list = cmd.identify(string selection="(all)",int mode=0)

NOTES

    mode 0: only return a list of identifiers (default)
    mode 1: return a list of tuples of the object name and the identifier

        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.identify(_self._COb, "(" + str(selection) + ")",
                              int(mode))  # 0 = default mode
        finally:
            _self.unlock(r, _self)
        if is_list(r):
            if len(r):
                if not quiet:
                    if mode:
                        for a in r:
                            print " cmd.identify: (%s and id %d)" % (a[0],
                                                                     a[1])
                    else:
                        for a in r:
                            print " cmd.identify: (id %d)" % a
        if _raising(r, _self): raise pymol.CmdException
        return r
Пример #56
0
    def get_chains(selection="(all)",state=0,quiet=1,_self=cmd):
        '''
        PRE-RELEASE functionality - API will change

        state is currently ignored
        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_chains(_self._COb,"("+str(selection)+")",int(state)-1)
        finally:
            _self.unlock(r,_self)
        if r==None:
            return []
        if _raising(r,_self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_chains: ",str(r)
        return r
Пример #57
0
    def get_atom_coords(selection, state=0, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_atom_coords" returns the 3D coordinates of a single atom.
    
    '''
        # low performance way to get coords for a single atom
        r = []
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_atom_coords(_self._COb, str(selection),
                                     int(state) - 1, int(quiet))
        finally:
            _self.unlock(r, _self)
        if r == None:
            if _self._raising(_self=_self): raise pymol.CmdException
        elif not quiet:
            for a in r:
                print " cmd.get_coords: [%8.3f,%8.3f,%8.3f]" % (a)
        if _raising(r, _self): raise pymol.CmdException
        return r
Пример #58
0
    def get_chains(selection="(all)", state=0, quiet=1, _self=cmd):
        '''
        PRE-RELEASE functionality - API will change

        state is currently ignored
        '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        try:
            _self.lock(_self)
            r = _cmd.get_chains(_self._COb, "(" + str(selection) + ")",
                                int(state) - 1)
        finally:
            _self.unlock(r, _self)
        if r == None:
            return []
        if _raising(r, _self):
            raise pymol.CmdException
        elif not quiet:
            print " cmd.get_chains: ", str(r)
        return r
Пример #59
0
    def get_symmetry(selection="(all)", state=-1, quiet=1, _self=cmd):
        '''
DESCRIPTION

    "get_symmetry" can be used to obtain the crystal
    and spacegroup parameters for a molecule or map.

USAGE

    get_symmetry object-name-or-selection

PYMOL API

    cmd.get_symmetry(string selection, int state, int quiet)


        '''
        r = DEFAULT_ERROR
        selection = selector.process(selection)
        try:
            _self.lock(_self)
            r = _cmd.get_symmetry(_self._COb, str(selection), int(state))
            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
Пример #60
0
    def intra_fit(selection, state=1, quiet=1, mix=0, _self=cmd):
        '''
DESCRIPTION

        "intra_fit" fits all states of an object to an atom selection
        in the specified state.  It returns the rms values to python
        as an array.

USAGE 

        intra_fit selection [, state]

ARGUMENTS

        selection = string: atoms to fit

        state = integer: target state

PYMOL API

        cmd.intra_fit( string selection, int state )

EXAMPLES

        intra_fit ( name ca )

PYTHON EXAMPLE

        from pymol import cmd
        rms = cmd.intra_fit("(name ca)",1)

SEE ALSO

        fit, rms, rms_cur, intra_rms, intra_rms_cur, pair_fit
                '''
        # preprocess selection
        selection = selector.process(selection)
        #
        r = DEFAULT_ERROR
        state = int(state)
        mix = int(mix)
        try:
            _self.lock(_self)
            r = _cmd.intrafit(_self._COb, "(" + str(selection) + ")",
                              int(state) - 1, 2, int(quiet), int(mix))
        finally:
            _self.unlock(r, _self)
        if r < 0.0:
            r = DEFAULT_ERROR
        elif not quiet:
            st = 1
            for a in r:
                if a >= 0.0:
                    if mix:
                        print " cmd.intra_fit: %5.3f in state %d vs mixed target" % (
                            a, st)
                    else:
                        print " cmd.intra_fit: %5.3f in state %d vs state %d" % (
                            a, st, state)
                st = st + 1
        if _self._raising(r, _self): raise pymol.CmdException
        return r