Dear All,

A while ago, Warren wrote a script for me that takes the output (the .face and .vert files) of the MSMS cavity finding program, and renders the cavity in Pymol.

I've been using this code and have been really happy with it. The code is attached as the last part of this message.

I'd like to be automatically label each of these cavities in the pymol window, and detect if a water molecule is present in the cavity.

Could someone recommend a way to detect if there are one or more water molecules inside these surfaces, and if so, return how the number?

Thanks! and all the best,

--Buz






Here it is for all your information:

# ---------------------------------------------------------------------------- #
# Loop through the face and vert files, and generate graphics
i = 0

objNames = []

while i < len(faceFiles):
        vert = open(vertFiles[i]).readlines()
        face = open(faceFiles[i]).readlines()
        
        # read vertices & normal vectors
        
        vert_array = []
        got_counts = 0
        for line in vert:
                line = string.strip(line)
                if len(line) and line[0] != '#': # skip blanks & comments
                        if not got_counts:
                                (n_vert, n_sph, desn, prob_r) = 
map(float,line.split())
                                got_counts = 1
                        else:
                                vert_array.append( map(float,line.split()) )
                                
        # read faces
        
        face_array = []
        got_counts = 0
        for line in face:
                line = string.strip(line)
                if len(line) and line[0] != '#': # skip blanks & comments
                        if not got_counts:
                                (n_face, n_sph, desn, prob_r) = 
map(float,line.split())
                                got_counts = 1
                        else:
                                face_array.append( map(int,line.split()) )
                
        # build CGO object using faces, vertex coordinates, and normal vectors
        
        cgo = []
        cgo.extend( [BEGIN, TRIANGLES] )
        for face in face_array:
vert = [ vert_array[face[0]-1], vert_array[face[1]-1], vert_array[face[2]-1] ]
                cgo.extend( [NORMAL] + vert[0][3:6] )
                cgo.extend( [VERTEX] + vert[0][0:3] )
                cgo.extend( [NORMAL] + vert[1][3:6] )
                cgo.extend( [VERTEX] + vert[1][0:3] )
                cgo.extend( [NORMAL] + vert[2][3:6] )
                cgo.extend( [VERTEX] + vert[2][0:3] )
                
        cgo.append( END )
        
        objName = faceFiles[i].split('.')[0]
        
        cmd.load_cgo(cgo, objName)
        objNames.append(objName)
        i += 1
# ---------------------------------------------------------------------------- #





# ---------------------------------------------------------------------------- #
# Set up transparency


cmd.set("cgo_transparency",0.9,objNames[0])
cmd.color('white',objNames[0]);


i = 1
while i < len(objNames):
        cmd.set("cgo_transparency",0.75,objNames[i])
        cmd.color('magenta',objNames[i]);
        i += 1


Reply via email to