Find buried waters: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(Created page with "=Overview= This script finds and turns a selection of waters determined to be buried (no solvent accessibility) in the original selection. If you prefer to define your own cutof...")
 
(make it work with plugin manager, add state and quiet arguments, fix cutoff argument, add docstring)
 
Line 1: Line 1:
=Overview=
This script finds and turns a selection of waters determined to be buried (no solvent accessibility) in the original selection. If you prefer to define your own cutoff of "accessible" use the 2nd parameter.
 
== Usage ==
 
find_buried_waters [ sele [, cutoff [, state ]]]


This script finds and turns a selection of waters determined to be buried (no solvent accessibility) in the original selection. If you prefer to define your own cutoff of "accessible" use the 2nd parameter.
== Script ==


<source lang="python">
<source lang="python">
def find_buried_waters(sele,cutoff=0.):
from pymol import cmd
        import pymol
        from pymol import stored


        _self = cmd
def find_buried_waters(sele='all', cutoff=-1, state=1, quiet=1, _self=cmd):
    '''
DESCRIPTION


        z = _self.get("auto_zoom")
    Finds and turns a selection of waters determined to be buried (no solvent
        d = _self.get("dot_solvent")
    accessibility) in the original selection.


        tmpObj=_self.get_unused_name("__tmp")
ARGUMENTS


        _self.create(tmpObj, sele);
    sele = string: atom selection {default: all}


        _self.set("dot_solvent");
    cutoff = float: threshold on what one considers an "exposed"
        _self.set("auto_zoom", 0)
    atom (in A**2) {default: surface_residue_cutoff}


        _self.get_area(selection=tmpObj, load_b=1)
    state = int: object state {default: 1}
    '''
    cutoff, state, quiet = float(cutoff), int(state), int(quiet)


        # threshold on what one considers an "exposed" atom (in A**2):                                                                                                               
    tmpObj=_self.get_unused_name("__tmp")
        surface_residue_cutoff = str(_self.get("surface_residue_cutoff"))
    _self.create(tmpObj, sele, state, 1, zoom=0)
        _self.remove(tmpObj + " and b > %s" % surface_residue_cutoff)


        stored.tmp_dict = {}
    _self.set("dot_solvent", 1, tmpObj);
        _self.iterate(tmpObj, "stored.tmp_dict[(chain,resv)]=1")
    _self.get_area(tmpObj, state=1, load_b=1)
        exposed = stored.tmp_dict.keys()
        exposed.sort()


         selName = _self.get_unused_name("buried")
    if cutoff < 0:
        _self.select(selName, "(%s and %s) in %s" % (sele,"solvent",tmpObj))
         cutoff = _self.get("surface_residue_cutoff")
    _self.remove(tmpObj + " and not solvent")
    _self.remove(tmpObj + " and b > %s" % cutoff)


        # clean up                                                                                                                                                                   
    exposed = set()
        _self.delete(tmpObj)
    _self.iterate(tmpObj, "exposed.add((chain,resv))", space=locals())
        _self.set("dot_solvent", d)
        _self.set("auto_zoom", z)


         return exposed
    selName = _self.get_unused_name("buried")
    _self.select(selName, "(%s) in %s" % (sele, tmpObj))
 
    # clean up
    _self.delete(tmpObj)
 
    if not quiet:
         print ' Found %d buried water atoms' % (len(exposed))
 
    return sorted(exposed)
 
cmd.extend('find_buried_waters', find_buried_waters)
</source>
</source>
== See Also ==
* [[Get_Area|get_area]]
* [[FindSurfaceResidues]]
[[Category:Script_Library]]
[[Category:ObjSel_Scripts]]

Latest revision as of 14:59, 11 June 2012

This script finds and turns a selection of waters determined to be buried (no solvent accessibility) in the original selection. If you prefer to define your own cutoff of "accessible" use the 2nd parameter.

Usage

find_buried_waters [ sele [, cutoff [, state ]]]

Script

from pymol import cmd

def find_buried_waters(sele='all', cutoff=-1, state=1, quiet=1, _self=cmd):
    '''
DESCRIPTION

    Finds and turns a selection of waters determined to be buried (no solvent
    accessibility) in the original selection.

ARGUMENTS

    sele = string: atom selection {default: all}

    cutoff = float: threshold on what one considers an "exposed"
    atom (in A**2) {default: surface_residue_cutoff}

    state = int: object state {default: 1}
    '''
    cutoff, state, quiet = float(cutoff), int(state), int(quiet)

    tmpObj=_self.get_unused_name("__tmp")
    _self.create(tmpObj, sele, state, 1, zoom=0)

    _self.set("dot_solvent", 1, tmpObj);
    _self.get_area(tmpObj, state=1, load_b=1)

    if cutoff < 0:
        cutoff = _self.get("surface_residue_cutoff")
    _self.remove(tmpObj + " and not solvent")
    _self.remove(tmpObj + " and b > %s" % cutoff)

    exposed = set()
    _self.iterate(tmpObj, "exposed.add((chain,resv))", space=locals())

    selName = _self.get_unused_name("buried")
    _self.select(selName, "(%s) in %s" % (sele, tmpObj))

    # clean up
    _self.delete(tmpObj)

    if not quiet:
        print ' Found %d buried water atoms' % (len(exposed))

    return sorted(exposed)

cmd.extend('find_buried_waters', find_buried_waters)

See Also