Hi guys,
I am trying to make a script to automatize a procedure. I have got a
file where I can pick up the structure of protein-ligand complexes
cluster
The script below read the number of the cluster and then visualize
them align with a protein reference. Everything is fine except I'd
like write on a file the distances between some residues of each
structure with the ligand but I cannot figure out how do it. I read
different post but it seems that I missing something.

thanks a lot

Regards,

andrea

##### CUT HERE #####
from pymol import cmd
import string, sys, os

def read_cluster(number):
    cmd.reinitialize()
    cmd.load('/home/pippo/ref.pdb','ref')
    cmd.select('Refactive','resi 17+20+23+25+26+43+44 in ref')
    HoL = {}
    FileToOpen = 'Dist' + number 
    DistOutput = open(FileToOpen,'w')
    DistOutput.write("ATOM_PROTEIN ATOM_LIGAND DISTANCE\n")
    out = open('cluster.out','r')
    pro_atoms = cmd.get_model("ref")
# read cluster file
    for i in out.readlines():
        i=string.strip(i)       
        tmp = string.split(i," ")
        index, elems = tmp[1], tmp[3:len(tmp)]  
        HoL[index] = elems
# visualize the structures of cluster number
    for eachElem in HoL[number]:
        newElem = eachElem + '.pdb'
        cmd.load(newElem.strip(),eachElem)
        cmd.select('active','resi 17+20+23+25+26+43+44')
        cmd.select('lig','resn CBO')
        cmd.select('ligDon','(elem n,o and (neighbor hydro) in lig)')
        cmd.select('ligAcc','(elem o or (elem n and not (neighbor
hydro)) in lig)')
        Don = cmd.select('don','(elem n,o and (neighbor hydro))')
        Acc = cmd.select('acc','(elem o or (elem n and not (neighbor hydro)))')
#     atoms_Don = cmd.index('don')
#     atoms_Acc = cmd.index('acc')
        HBA = cmd.distance('(lig and acc)','(active and don)',3.2)
        HBD = cmd.distance('(lig and don)','(active and acc)',3.2)
        cmd.align('ref',eachElem)
        DistOutput.write(" %14s  %14s %8.3f\n"%(Don,Acc,HBA))
     
    DistOutput.close()
 
cmd.extend('read_cluster',read_cluster)
########## CUT HERE ################

Reply via email to