Hi Abhinav and Jason,
> The underlying C-object for a measurement does not support
> iterate/alter. This is rather silly; PyMOL should be able to tell you
> what's in the object.
As an ad-hoc hack, I wrote a Python script to access internal C-object
of distance representation and convert it to atom name.
Save the script to somewhere and
run script_name.py
list_dist
will do the job.
Takanori Nakane
=== Script start ===
from pymol import cmd
def parseDistObj(obj):
if (obj[5][0][3][10] != 1): # 'show dashed' flag
return ""
points = obj[5][2][0][1]
ret = []
for i in range(len(points) / 6):
ret.append([(points[i * 6], points[i * 6 + 1], points[i * 6 + 2]),
(points[i * 6 + 3], points[i * 6 + 4], points[i * 6
+ 5])])
return ret
def list_dist():
names = cmd.get_session()['names']
dist_pairs = []
for obj in names:
if (obj == None):
continue
if (obj[1] == 0 and obj[4] == 4):
dist_pairs += parseDistObj(obj)
namespace = {'dict': {}, 'a': 1}
dict = {}
cmd.iterate_state(1, 'all', 'dict[x,y,z] =
chain+"/"+resn+resi+"/"+name' , space=namespace)
dict = namespace['dict']
for pair in dist_pairs:
print dict.get(pair[0], '?') + " - " + dict.get(pair[1], '?')
cmd.extend('list_dist', list_dist)
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]