Find buried waters

From PyMOLWiki
Revision as of 12:44, 11 June 2012 by Inchoate (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

def find_buried_waters(sele,cutoff=0.):
        import pymol
        from pymol import stored

        _self = cmd

        z = _self.get("auto_zoom")
        d = _self.get("dot_solvent")

        tmpObj=_self.get_unused_name("__tmp")

        _self.create(tmpObj, sele);

        _self.set("dot_solvent");
        _self.set("auto_zoom", 0)

        _self.get_area(selection=tmpObj, load_b=1)

        # threshold on what one considers an "exposed" atom (in A**2):                                                                                                                
        surface_residue_cutoff = str(_self.get("surface_residue_cutoff"))
        _self.remove(tmpObj + " and b > %s" % surface_residue_cutoff)

        stored.tmp_dict = {}
        _self.iterate(tmpObj, "stored.tmp_dict[(chain,resv)]=1")
        exposed = stored.tmp_dict.keys()
        exposed.sort()

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

        # clean up                                                                                                                                                                    
        _self.delete(tmpObj)
        _self.set("dot_solvent", d)
        _self.set("auto_zoom", z)

        return exposed