Hi, Well, the cmd.distance method seems to take minimum 4 parameters, not three:
cmd.distance( string name, string selection1, string selection2, string cutoff, string mode ) where 'mode' is not important. So, in the script you give, the line: HBA = cmd.distance('(lig and acc)','(active and don)',3.2) could become HBA = cmd.distance('HBA', '(lig and acc)','(active and don)', 3.2) or, if you use the atom ids that you get from the (commented out) lines: atoms_Don = cmd.index('don') you could use cmd.get_distance in a loop: for donor in atoms_Don: for acceptor in atoms_Acc: DistOut.write("%s" % cmd.get_distance(donor, acceptor)) or something. gilleain torrance On 5/7/05 11:50, "Andrea Spitaleri" <andrea.spital...@gmail.com> wrote: > 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 ################ > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pymol-users >