Changeset 1707 in rotdif
 Timestamp:
 Aug 15, 2019, 2:10:38 PM (10 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

bin/get_elm_tensor.py
r1705 r1707 1 1 import re 2 2 import operator 3 4 def elm_tensor(pdb, scale=10): 3 import numpy as np 4 from os.path import join 5 def elm_tensor(pdb): 5 6 with open('ELM_prediction') as in_f: 6 7 tmp = in_f.readlines() 7 8 for i in range(len(tmp)): 8 9 if tmp[i].startswith('====Diffusion Tensor Sorted Eigendecomposition===='): 9 row_dx = [float(it) *scalefor it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+1])[:3]]10 row_dy = [float(it) *scalefor it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+2])[:3]]11 row_dz = [float(it) *scalefor it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+3])[:3]]10 row_dx = [float(it) for it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+1])[:3]] 11 row_dy = [float(it) for it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+2])[:3]] 12 row_dz = [float(it) for it in re.findall(r"[+]?\d*\.\d+[+]?\d+",tmp[i+3])[:3]] 12 13 dx = [row_dx[0],row_dy[0],row_dz[0]] 13 14 dy = [row_dx[1],row_dy[1],row_dz[1]] 14 15 dz = [row_dx[2],row_dy[2],row_dz[2]] 16 #normalize the length of dx, dy, dz by ellipsoid semi axes 17 with open("str_abc.txt") as in_f: 18 tmp_sa = in_f.readline() 19 semiaxe = [float(s) for s in tmp_sa.split(' ')] 20 dx = dx / np.linalg.norm(dx) * semiaxe[0] 21 dy = dy / np.linalg.norm(dy) * semiaxe[1] 22 dz = dz / np.linalg.norm(dz) * semiaxe[2] 23 15 24 with open(pdb) as in_f2: 16 25 tmp2 = in_f2.readlines() … … 54 63 "obj = " + obj + 55 64 """\n # then we load it into PyMOL \n 56 cmd.load_cgo(obj,' out_ani')""")65 cmd.load_cgo(obj,'diffusion_tensor')""")
Note: See TracChangeset
for help on using the changeset viewer.