From: andrea s. <and...@gm...> - 2005-10-25 09:17:33
|
Jules Jacobsen wrote: > Hi Andrea, > > It depends on how you've written it.... It does sound more than a > little slow if you are just selecting a single residue. I had a script > which ended up looping through several sets of atoms which took ages > for larger models. I finally got fed-up with this and re-wrote it > properly. Now it's practically instantaneous. If you post the script > I'm sure someone will be able to offer you a pointer as to where you > might be going wrong. > > Jules Hi Jules, here it is: ------------------------------------------------- from pymol import cmd import string, sys, os if ("dist.out"): os.system("rm -f dist.out") if ("full.out"): os.system("rm -f full.out") nam = open("file.nam",'r') KeepStruc = [] readnam = nam.readlines() deep = int(15) for j in range(0,deep): readnam[j] = string.strip(readnam[j]) KeepStruc.append(readnam[j]) for i in KeepStruc: cmd.load(i,i) print i cmd.select("lig","segi B") cmd.select("pro","all and not segi B") amb = open("amb",'r') out = open("dist.out","a") full = open("full.out","a") out.write("%4s\n"%(i)) full.write("%4s\n"%(i)) count = 0 for lines in amb.readlines(): lines = string.strip(lines) tmp = string.split(lines,",") resname = tmp[0] atomtypes = tmp[1] tmp1 =string.split(atomtypes,":") atomlig = tmp1[0] atompro = tmp1[1] p = cmd.select("p","resi "+resname+" and name "+atompro+" and "+i) if (atomlig == "*"): ligand = cmd.select("ligand","segi B and "+i) atoms_lig = cmd.get_model('ligand') for atomsL in atoms_lig.atom: t = cmd.select("t","name "+atomsL.name) di = cmd.distance("di","t","p") full.write("%4s%8s%8s%8.3f%12s\n"%(resname,atompro,atomsL.name,di,"DISTANCE")) if (di < 4): count = count + 1 # print resname,atompro,count if (count == 0): out.write("%4s%8s%8s%12s\n"%(resname,atompro,"*",">VIOLATED")) count = 0 else: l = cmd.select("l","name "+atomlig+" and segi B and "+i) d = cmd.distance("dist_"+str(i),"p","l") full.write("%4s%8s%8s%8.3f%12s\n"%(resname,atompro,atomlig,d,"DISTANCE")) if (d > 5): out.write("%4s%8s%8s%8.3f%10s\n"%(resname,atompro,atomlig,d,"VIOLATED")) out.close() -------------------------------------------------- At the beginning I thought that problem was the memory because when I run it it starts fast and then aftr 4 structures it goes slowly slowly per every molecule, but I see my free memory always 50% and the cpu 100%. I tried to empty the list in the script at end of each iteration but it didn't work. thanks andrea |