Changeset 1707 in rotdif


Ignore:
Timestamp:
Aug 15, 2019, 2:10:38 PM (11 months ago)
Author:
yuexi
Message:

rename

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/get_elm_tensor.py

    r1705 r1707  
    11import re
    22import operator
    3 
    4 def elm_tensor(pdb, scale=10):
     3import numpy as np
     4from os.path import join
     5def elm_tensor(pdb):
    56    with open('ELM_prediction') as in_f:
    67        tmp = in_f.readlines()
    78    for i in range(len(tmp)):
    89        if tmp[i].startswith('====Diffusion Tensor Sorted Eigendecomposition===='):
    9             row_dx = [float(it)*scale for it in re.findall(r"[-+]?\d*\.\d+|[-+]?\d+",tmp[i+1])[:3]]
    10             row_dy = [float(it)*scale for it in re.findall(r"[-+]?\d*\.\d+|[-+]?\d+",tmp[i+2])[:3]]
    11             row_dz = [float(it)*scale for 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]]
    1213    dx = [row_dx[0],row_dy[0],row_dz[0]]
    1314    dy = [row_dx[1],row_dy[1],row_dz[1]]
    1415    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   
    1524    with open(pdb) as in_f2:
    1625        tmp2 = in_f2.readlines()
     
    5463"obj = " + obj +
    5564"""\n # then we load it into PyMOL \n
    56 cmd.load_cgo(obj,'out_ani')""")   
     65cmd.load_cgo(obj,'diffusion_tensor')""")   
Note: See TracChangeset for help on using the changeset viewer.