From: Andrea S. <and...@gm...> - 2005-10-14 22:02:23
|
Hi all, this script below runs well in pymol. It loads pdb files and calculates the distance of some atoms contained in the fileAmb whose format is: 26,O11:HN 28,*:HE1 ............... With * I select whole ligand (segi B) and pymol returns only one value, the average distance for all atoms to the HE1 atoms. I need to print out all the distances, atom by atom. any helps?? thanks a lot andrea ---------------------- from pymol import cmd import string, sys, os def viol(fileAmb,deep): cmd.reinitialize() if ("dist.out"): os.system("rm -f dist.out") nam =3D open("file.nam",'r') KeepStruc =3D [] readnam =3D nam.readlines() deep =3D int(deep) for j in range(0,deep): readnam[j] =3D string.strip(readnam[j]) KeepStruc.append(readnam[j]) for i in KeepStruc: cmd.load(i,i) cmd.select("lig","segi B") cmd.select("pro","all and not segi B") amb =3D open(fileAmb,'r') out =3D open("dist.out","a") out.write("%4s\n"%(i)) for lines in amb.readlines(): lines =3D string.strip(lines) tmp =3D string.split(lines,",") resname =3D tmp[0] atomtypes =3D tmp[1] tmp1 =3Dstring.split(atomtypes,":") atomlig =3D tmp1[0] atompro =3D tmp1[1] p =3D cmd.select("p","resi "+resname+" and name "+atompro+" and= "+i) l =3D cmd.select("l","name "+atomlig+" and segi B and "+i) d =3D cmd.distance("dist_"+str(i),"p","l") if (d > 5): print resname,":",atompro,"->",atomlig,d out.write("%4s%8s%8s%8.3f\n"%(resname,atompro,atomlig,d)) out.close() cmd.extend('viol',viol) ---------------------------------------- -- "La conoscenza libera il genere umano dalla superstizione" J. Watson |