From: Andrea S. <and...@gm...> - 2005-07-05 10:50:31
|
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 =3D {} FileToOpen =3D 'Dist' + number=20 DistOutput =3D open(FileToOpen,'w') DistOutput.write("ATOM_PROTEIN ATOM_LIGAND DISTANCE\n") out =3D open('cluster.out','r') pro_atoms =3D cmd.get_model("ref") # read cluster file for i in out.readlines(): i=3Dstring.strip(i) =20 tmp =3D string.split(i," ") index, elems =3D tmp[1], tmp[3:len(tmp)] =20 HoL[index] =3D elems # visualize the structures of cluster number for eachElem in HoL[number]: newElem =3D 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 =3D cmd.select('don','(elem n,o and (neighbor hydro))') Acc =3D cmd.select('acc','(elem o or (elem n and not (neighbor hydr= o)))') # atoms_Don =3D cmd.index('don') # atoms_Acc =3D cmd.index('acc') HBA =3D cmd.distance('(lig and acc)','(active and don)',3.2) HBD =3D cmd.distance('(lig and don)','(active and acc)',3.2) cmd.align('ref',eachElem) DistOutput.write(" %14s %14s %8.3f\n"%(Don,Acc,HBA)) =20 DistOutput.close() =20 cmd.extend('read_cluster',read_cluster) ########## CUT HERE ################ |