Tara,

Use Python (and the run command with .py files).

from pymol import cmd
f=open('dist.txt','w')
dst=cmd.distance('tmp','mol1///25/ha','mol1///26/ha')
f.write("%8.3f\n"%dst)
f.close()

You could measure the whole protein this way by putting a loop around the 
distance command:

from pymol import cmd
f=open('dist.txt','w')
atom = cmd.get_model("mol1////ha").atom
for i in range(len(atom)-1):
   sele1 = 'mol1///%s/HA'%atom[i].resi
   sele2 = 'mol1///%s/HA'%atom[i+1].resi
   dst=cmd.distance('tmp',sele1,sele2)
   f.write("%14s %14s %8.3f\n"%(sele1,sele2,dst))
f.close()

The output "dist.txt" would then look like:

   mol1///4/HA    mol1///5/HA    4.748
   mol1///5/HA    mol1///6/HA    4.828
   mol1///6/HA    mol1///7/HA    4.861
   mol1///7/HA    mol1///8/HA    4.784
   mol1///8/HA    mol1///9/HA    4.936
   mol1///9/HA   mol1///10/HA    4.833
  mol1///10/HA   mol1///11/HA    4.933
  mol1///11/HA   mol1///12/HA    4.813

etc.

Cheers,
Warren

--
mailto:war...@sunesis.com
Warren L. DeLano, Ph.D. 
Informatics Manager 
Sunesis Pharmaceuticals, Inc. 
341 Oyster Point Blvd. 
S. San Francisco, CA 94080 
(650)-266-3606 FAX:(650)-266-3501



> -----Original Message-----
> From: Tara Sprules [mailto:tspru...@ualberta.ca]
> Sent: Wednesday, January 08, 2003 3:20 PM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] measuring distances
> 
> 
> Hi,
> 
> I have a file which measures a bunch of distances between 
> atoms (of the
> form "distance (mol1///25/ha), (mol1///26/ha)"), and rather 
> than having to
> look at the results on the screen I'd like to have the values output
> to a text file. Is it possible to do this?
> 
> Thanks,
> 
> Tara
> 
> Tara Sprules
> Post-Doctoral Fellow
> Department of Chemistry
> University of Alberta
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 

Reply via email to