Difference between revisions of "List dist"

From PyMOLWiki
Jump to navigation Jump to search
(merge with Get_raw_distances)
 
Line 1: Line 1:
= Overview =
+
#REDIRECT [[Get_raw_distances]]
This script finds atoms involved in polar contacts and lists their information.
 
 
 
Author:
 
:: Takanori Nakane
 
 
 
Warning:
 
:: the atoms are hashed by coordinates; this could cause issues with multi-state MD trajectories -- use caution!
 
 
 
<source lang="python">
 
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)
 
</source>
 
 
 
[[Category:Script_Library]]
 
[[Category:ObjSel_Scripts]]
 

Latest revision as of 12:54, 1 February 2012

Redirect to: