py-packman 1.4.0__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Program Files/Python39/Lib/site-packages/packman/__init__.py +18 -0
- Program Files/Python39/Lib/site-packages/packman/__main__.py +4 -0
- Program Files/Python39/Lib/site-packages/packman/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/__pycache__/__main__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__init__.py +25 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/hd_anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/anm.py +317 -0
- Program Files/Python39/Lib/site-packages/packman/anm/hd_anm.py +656 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__init__.py +25 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/calculate_entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/dci.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/hdanm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/predict_hinge.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/calculate_entropy.py +60 -0
- Program Files/Python39/Lib/site-packages/packman/apps/dci.py +323 -0
- Program Files/Python39/Lib/site-packages/packman/apps/hdanm.py +47 -0
- Program Files/Python39/Lib/site-packages/packman/apps/predict_hinge.py +375 -0
- Program Files/Python39/Lib/site-packages/packman/bin/GUI.py +709 -0
- Program Files/Python39/Lib/site-packages/packman/bin/PACKMAN.py +154 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__init__.py +27 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/GUI.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/PACKMAN.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/logo.ico +0 -0
- Program Files/Python39/Lib/site-packages/packman/constants/Constants.py +236 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__init__.py +3 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/Constants.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__init__.py +12 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/entropy.py +155 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__init__.py +17 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/geometry.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/geometry.py +112 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__init__.py +45 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/annotations.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/atom.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/bond.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/chain.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/hetmol.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/model.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/molecule.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/protein.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/residue.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/annotations.py +92 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/atom.py +332 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/bond.py +186 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/chain.py +323 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/hetmol.py +224 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/model.py +703 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/molecule.py +470 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/protein.py +162 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/residue.py +322 -0
- Program Files/Python39/Lib/site-packages/packman/tests/__init__.py +4 -0
- Program Files/Python39/Lib/site-packages/packman/tests/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/test_anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/test_anm.py +52 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.hng +3 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.pdb +1871 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/4hla.cif +5058 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/test_entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/test_entropy.py +30 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/test_molecule.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/test_molecule.py +95 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__init__.py +1 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/utilities.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/utilities.py +180 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/PKG-INFO +86 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/SOURCES.txt +51 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/dependency_links.txt +1 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/entry_points.txt +3 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/requires.txt +5 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/top_level.txt +1 -0
- Program Files/Python39/Scripts/packman-script.py +33 -0
- Program Files/Python39/Scripts/packman.exe +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Author: Pranav Khade, Iowa State University
|
|
3
|
+
# Please read the project licence file for the Copyrights.
|
|
4
|
+
|
|
5
|
+
"""The py-PACKMAN is a collection of subpackages built on the packman.molecule API.
|
|
6
|
+
|
|
7
|
+
Please check the corresponding packages and tutorials for more information about the package use.
|
|
8
|
+
"""
|
|
9
|
+
from .molecule import *
|
|
10
|
+
from .apps import *
|
|
11
|
+
from .bin import *
|
|
12
|
+
from .anm import *
|
|
13
|
+
from .constants import *
|
|
14
|
+
from .utilities import *
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#VERSION CHANGE HERE CHANGES IT IN docs AND setup.py
|
|
18
|
+
__version__='1.4.0'
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Author: Pranav Khade, Iowa State University
|
|
3
|
+
# Please read the project licence file for the Copyrights.
|
|
4
|
+
|
|
5
|
+
"""The 'packman.anm' module is a collection of anm methods and applications built on packman.molecule API.
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
* Current apps list: - packman.anm.ANM, packman.anm.RDANM
|
|
9
|
+
* Cite the following paper:
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
* Review the packman.bin.PACKMAN.py file for the app use.
|
|
14
|
+
|
|
15
|
+
Todo:
|
|
16
|
+
* Add new features
|
|
17
|
+
* Add citations in the note
|
|
18
|
+
* Use ``sphinx.ext.todo`` extension
|
|
19
|
+
* Clean the code
|
|
20
|
+
* Redesign print statements
|
|
21
|
+
* Add Tutorial Link
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
from .anm import ANM
|
|
25
|
+
from .hd_anm import hdANM
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The 'ANM' object host file.
|
|
3
|
+
|
|
4
|
+
This is file information, not the class information. This information is only for the API developers.
|
|
5
|
+
Please read the 'ANM' object documentation for details.
|
|
6
|
+
|
|
7
|
+
Example::
|
|
8
|
+
from packman.anm import ANM
|
|
9
|
+
help( ANM )
|
|
10
|
+
|
|
11
|
+
Notes:
|
|
12
|
+
* Tutorial: https://jerniganlab.github.io/Software/PACKMAN/Tutorials/compliance
|
|
13
|
+
* For more details about the parameters for compliance, or to site this, read the following paper: https://doi.org/10.1002/prot.25968
|
|
14
|
+
|
|
15
|
+
Todo:
|
|
16
|
+
* Finish writing up the documentation.
|
|
17
|
+
* Finish error handling.
|
|
18
|
+
* Finish optimizing the performance.
|
|
19
|
+
* Make sure that parameter to the ANM is changed from [float] to packman.molecule.atom
|
|
20
|
+
|
|
21
|
+
Authors:
|
|
22
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
23
|
+
* Part Credits: Ambuj Kumar (ambuj@iastate.edu)
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
import numpy
|
|
27
|
+
|
|
28
|
+
from packman.molecule import Protein, Model, Atom
|
|
29
|
+
|
|
30
|
+
'''
|
|
31
|
+
##################################################################################################
|
|
32
|
+
# ANM #
|
|
33
|
+
##################################################################################################
|
|
34
|
+
'''
|
|
35
|
+
|
|
36
|
+
class ANM:
|
|
37
|
+
"""This class contains the functions essential to carry out the Anisotropic Network Model and Compliance analysis.
|
|
38
|
+
|
|
39
|
+
Notes:
|
|
40
|
+
* Tutorial: https://jerniganlab.github.io/Software/PACKMAN/Tutorials/compliance
|
|
41
|
+
* For more details about the parameters for compliance, or to site this, read the following paper:
|
|
42
|
+
|
|
43
|
+
Todo:
|
|
44
|
+
* fix init; coords to atoms
|
|
45
|
+
* Change the pf in such a way that it is not confusing
|
|
46
|
+
* Add set_ functions
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
coords ([float]) : Two dimentional array of three dimentional points in the space.
|
|
50
|
+
gamma (float, optional): Spring Constant Value. Defaults to 1.0.
|
|
51
|
+
dr (float, optional) : Distance Cutoff. Defaults to 15.0.
|
|
52
|
+
power (int, optional) : Power of distance (mainly useful in non-parametric mode). Defaults to 0.
|
|
53
|
+
pf (None, optional) : Parameter free model?. Defaults to None.
|
|
54
|
+
|
|
55
|
+
Raises:
|
|
56
|
+
Exception: [description]
|
|
57
|
+
Exception: [description]
|
|
58
|
+
Exception: [description]
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
def __init__(self, atoms, gamma=1.0, dr=15.0, power=0, pf=None):
|
|
62
|
+
self.gamma = gamma
|
|
63
|
+
self.dr = dr
|
|
64
|
+
self.power = power
|
|
65
|
+
self.pf = pf
|
|
66
|
+
self.atoms = [i for i in atoms]
|
|
67
|
+
self.coords = numpy.array([i.get_location() for i in self.atoms])
|
|
68
|
+
if self.pf != None and self.pf <= 0:
|
|
69
|
+
raise Exception("pf value cannot be zero or negative")
|
|
70
|
+
if self.gamma <= 0:
|
|
71
|
+
raise Exception("gamma value cannot be zero or negative")
|
|
72
|
+
if self.dr <= 0:
|
|
73
|
+
raise Exception("distance cutoff value cannot be zero or negative")
|
|
74
|
+
|
|
75
|
+
self.fluctuations = None
|
|
76
|
+
self.stiffness_map = None
|
|
77
|
+
self.compliance_map = None
|
|
78
|
+
self.stiffness_profile = None
|
|
79
|
+
self.compliance_profile = None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
'''Get Functions'''
|
|
83
|
+
def get_hessian(self):
|
|
84
|
+
"""Get the Hessian Matrix of the ANM model.
|
|
85
|
+
|
|
86
|
+
Notes:
|
|
87
|
+
* Make sure that the ANM().calculate_hessian() is called before calling this function. (will return None otherwise)
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
numpy.ndarray: Hessian matrix if successful; None otherwise
|
|
91
|
+
"""
|
|
92
|
+
return self.hessian
|
|
93
|
+
|
|
94
|
+
def get_eigenvalues(self):
|
|
95
|
+
"""Get the Eigenvalues obtained by decomposing the Hessian Matrix of the ANM model.
|
|
96
|
+
|
|
97
|
+
Notes:
|
|
98
|
+
* Make sure that the ANM().calculate_hessian() and ANM().calculate_decomposition() is called before calling this function. (will return None otherwise)
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
numpy.ndarray: Eigenvalues if successful; None otherwise
|
|
102
|
+
"""
|
|
103
|
+
return self.eigen_values
|
|
104
|
+
|
|
105
|
+
def get_eigenvectors(self):
|
|
106
|
+
"""Get the Eigenvectors obtained by decomposing the Hessian Matrix of the ANM model.
|
|
107
|
+
|
|
108
|
+
Notes:
|
|
109
|
+
* Make sure that the ANM().calculate_hessian() and ANM().calculate_decomposition() is called before calling this function. (will return None otherwise)
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
numpy.ndarray: Eigenvectors if successful; None otherwise
|
|
113
|
+
"""
|
|
114
|
+
return self.eigen_vectors
|
|
115
|
+
|
|
116
|
+
def get_fluctuations(self):
|
|
117
|
+
"""Get the Fluctuations obtained from Eigenvectors and Eigenvalues
|
|
118
|
+
|
|
119
|
+
Notes:
|
|
120
|
+
* Make sure that the ANM().calculate_hessian(), ANM().calculate_decomposition() and ANM().calculate_fluctuations() is called before calling this function. (will return None otherwise)
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
numpy.ndarray: Eigenvectors if successful; None otherwise
|
|
124
|
+
"""
|
|
125
|
+
return self.fluctuations
|
|
126
|
+
|
|
127
|
+
def get_stiffness_map(self):
|
|
128
|
+
"""Get the Stiffness Map obtained from Stiffness and Compliance Analysis
|
|
129
|
+
|
|
130
|
+
Notes:
|
|
131
|
+
* Make sure that the ANM().calculate_hessian(), ANM().calculate_decomposition() and ANM().calculate_stiffness_compliance() is called before calling this function. (will return None otherwise)
|
|
132
|
+
* Stiffness=1/Compliance
|
|
133
|
+
Returns:
|
|
134
|
+
numpy.ndarray: Stiffness Map if successful; None otherwise
|
|
135
|
+
"""
|
|
136
|
+
return self.stiffness_map
|
|
137
|
+
|
|
138
|
+
def get_compliance_map(self):
|
|
139
|
+
"""Get the Compliance Map obtained from Stiffness and Compliance Analysis
|
|
140
|
+
|
|
141
|
+
Notes:
|
|
142
|
+
* Make sure that the ANM().calculate_hessian(), ANM().calculate_decomposition() and ANM().calculate_stiffness_compliance() is called before calling this function. (will return None otherwise)
|
|
143
|
+
* Stiffness=1/Compliance
|
|
144
|
+
Returns:
|
|
145
|
+
numpy.ndarray: Compliance Map if successful; None otherwise
|
|
146
|
+
"""
|
|
147
|
+
return self.compliance_map
|
|
148
|
+
|
|
149
|
+
def get_stiffness_profile(self):
|
|
150
|
+
"""Get the Stiffness profile obtained from Stiffness and Compliance Analysis
|
|
151
|
+
|
|
152
|
+
Notes:
|
|
153
|
+
* Make sure that the ANM().calculate_hessian(), ANM().calculate_decomposition() and ANM().calculate_stiffness_compliance() is called before calling this function. (will return None otherwise)
|
|
154
|
+
* Stiffness=1/Compliance
|
|
155
|
+
Returns:
|
|
156
|
+
numpy.ndarray: Stiffness profile if successful; None otherwise
|
|
157
|
+
"""
|
|
158
|
+
return self.stiffness_profile
|
|
159
|
+
|
|
160
|
+
def get_compliance_profile(self):
|
|
161
|
+
"""Get the Compliance profile obtained from Stiffness and Compliance Analysis
|
|
162
|
+
|
|
163
|
+
Notes:
|
|
164
|
+
* Make sure that the ANM().calculate_hessian(), ANM().calculate_decomposition() and ANM().calculate_stiffness_compliance() is called before calling this function. (will return None otherwise)
|
|
165
|
+
* Stiffness=1/Compliance
|
|
166
|
+
Returns:
|
|
167
|
+
numpy.ndarray: Compliance profile if successful; None otherwise
|
|
168
|
+
"""
|
|
169
|
+
return self.compliance_profile
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
'''Calculate Functions'''
|
|
173
|
+
def calculate_hessian(self):
|
|
174
|
+
"""Build the Hessian Matrix of the ANM model.
|
|
175
|
+
|
|
176
|
+
This is the most essential step for ANM/ Compliance analysis.
|
|
177
|
+
|
|
178
|
+
Notes:
|
|
179
|
+
* Hessian matrix is built; use ANM().get_hessian() to obtain the hessian matrix.
|
|
180
|
+
"""
|
|
181
|
+
n_atoms=len(self.coords)
|
|
182
|
+
hessian=numpy.zeros((n_atoms*3, n_atoms*3), float)
|
|
183
|
+
distance_mat=numpy.ones((n_atoms*3, n_atoms*3), float)
|
|
184
|
+
for i in range(len(self.coords)):
|
|
185
|
+
diff = self.coords[i+1:, :] - self.coords[i]
|
|
186
|
+
squared_diff = diff**2
|
|
187
|
+
for j, s_ij in enumerate(squared_diff.sum(1)):
|
|
188
|
+
if s_ij <= self.dr**2:
|
|
189
|
+
diff_coords = diff[j]
|
|
190
|
+
j = j + i + 1
|
|
191
|
+
derivative = numpy.outer(diff_coords, diff_coords)*(float(-self.gamma)/numpy.sqrt(s_ij)**(2+self.power))
|
|
192
|
+
hessian[i*3:i*3+3, j*3:j*3+3] = derivative
|
|
193
|
+
hessian[j*3:j*3+3, i*3:i*3+3] = derivative
|
|
194
|
+
hessian[i*3:i*3+3, i*3:i*3+3] = hessian[i*3:i*3+3, i*3:i*3+3] - derivative
|
|
195
|
+
hessian[j*3:j*3+3, j*3:j*3+3] = hessian[j*3:j*3+3, j*3:j*3+3] - derivative
|
|
196
|
+
#abs added to avoid negative numbers
|
|
197
|
+
d = numpy.sqrt(s_ij)
|
|
198
|
+
lobj = [[d,d,d],[d,d,d], [d,d,d]]
|
|
199
|
+
dmat = numpy.array(lobj)
|
|
200
|
+
distance_mat[i*3:i*3+3, j*3:j*3+3] = dmat
|
|
201
|
+
|
|
202
|
+
if self.pf != None:
|
|
203
|
+
hessian = numpy.divide(hessian, distance_mat)
|
|
204
|
+
|
|
205
|
+
self.hessian=hessian
|
|
206
|
+
return True
|
|
207
|
+
|
|
208
|
+
def calculate_decomposition(self):
|
|
209
|
+
"""Decompose the Hessian Matrix of the ANM model.
|
|
210
|
+
|
|
211
|
+
Note:
|
|
212
|
+
Eigen values and Eigen Vectors are calculated. use ANM().get_eigenvalues() and ANM().get_eigenvectors() to obtain them.
|
|
213
|
+
"""
|
|
214
|
+
self.eigen_values,self.eigen_vectors=numpy.linalg.eigh(self.hessian)
|
|
215
|
+
return True
|
|
216
|
+
|
|
217
|
+
def calculate_fluctuations(self,endmode=None):
|
|
218
|
+
"""Calculate the Fluctuations of the ANM model.
|
|
219
|
+
|
|
220
|
+
The fluctualtions/ theoretical b-factors are calculated using this method.
|
|
221
|
+
|
|
222
|
+
Note:
|
|
223
|
+
- Fluctuations are calculated. use ANM().get_fluctuations() to obtain the fluctuations.
|
|
224
|
+
- Endmode needs to be put in the code if and when required.
|
|
225
|
+
"""
|
|
226
|
+
EVec=self.eigen_vectors.T
|
|
227
|
+
mode_bfactors=[]
|
|
228
|
+
for numi,i in enumerate(self.eigen_values[6:]):
|
|
229
|
+
evec_row=EVec[numi+6]
|
|
230
|
+
mode_bfactors.append([ float(evec_row[j]**2 + evec_row[j+1]**2 + evec_row[j+2]**2)/i for j in range(0,len(self.eigen_values),3)])
|
|
231
|
+
|
|
232
|
+
mode_bfactors=numpy.array(mode_bfactors)
|
|
233
|
+
self.fluctuations=[numpy.sum(i) for i in mode_bfactors.T]
|
|
234
|
+
return True
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def calculate_stiffness_compliance(self):
|
|
238
|
+
"""Carry out the Stiffness and Compliance analysis of the ANM model.
|
|
239
|
+
|
|
240
|
+
Citation:
|
|
241
|
+
Scaramozzino, D., Khade, P.M., Jernigan, R.L., Lacidogna, G. and Carpinteri, A.
|
|
242
|
+
(2020), Structural Compliance ‐ A New Metric for Protein Flexibility. Proteins. Accepted Author Manuscript.
|
|
243
|
+
doi:10.1002/prot.25968
|
|
244
|
+
|
|
245
|
+
Note:
|
|
246
|
+
* Obtain the following properties by using functions followed by it:
|
|
247
|
+
Stiffness Map : ANM().get_stiffness_map()
|
|
248
|
+
Compliance Map : ANM().get_compliance_map()
|
|
249
|
+
Stiffness Profile : ANM().get_stiffness_profile()
|
|
250
|
+
Compliance Profile: ANM().get_compliance_profile()
|
|
251
|
+
|
|
252
|
+
"""
|
|
253
|
+
EVec=self.eigen_vectors.T
|
|
254
|
+
hessian_inv= numpy.matmul( numpy.matmul( EVec[6:].transpose() , numpy.diag(1/self.get_eigenvalues()[6:]) ) , EVec[6:] )
|
|
255
|
+
compliance_map=numpy.zeros((len(self.coords),len(self.coords)))
|
|
256
|
+
stiffness_map=numpy.zeros((len(self.coords),len(self.coords)))
|
|
257
|
+
|
|
258
|
+
for numi,i in enumerate(self.coords):
|
|
259
|
+
for numj,j in enumerate(self.coords):
|
|
260
|
+
if(numi!=numj):
|
|
261
|
+
FMAT=numpy.zeros((len(self.coords),3))
|
|
262
|
+
Fij=(j-i)/numpy.linalg.norm(i-j)
|
|
263
|
+
FMAT[numi]=-Fij
|
|
264
|
+
FMAT[numj]=Fij
|
|
265
|
+
FMAT=FMAT.flatten()
|
|
266
|
+
|
|
267
|
+
d=numpy.matmul(hessian_inv,FMAT)
|
|
268
|
+
|
|
269
|
+
compliance= (d[(numj*3)+0]-d[(numi*3)+0])*Fij[0] + (d[(numj*3)+1]-d[(numi*3)+1])*Fij[1] + (d[(numj*3)+2]-d[(numi*3)+2])*Fij[2]
|
|
270
|
+
stiffness= 1/ compliance
|
|
271
|
+
|
|
272
|
+
compliance_map[numi][numj]= compliance
|
|
273
|
+
stiffness_map[numi][numj] = stiffness
|
|
274
|
+
|
|
275
|
+
self.stiffness_map = stiffness_map
|
|
276
|
+
self.compliance_map = compliance_map
|
|
277
|
+
self.stiffness_profile = [numpy.nanmean(i) for i in stiffness_map]
|
|
278
|
+
self.compliance_profile = [numpy.nanmean(i) for i in compliance_map]
|
|
279
|
+
return True
|
|
280
|
+
|
|
281
|
+
def calculate_movie(self, mode_number, scale=1.5, n=20, ftype='cif'):
|
|
282
|
+
"""Get the movie of the obtained LINEAR modes. The first frame is the original structure and the projection progresses in positive (+) direction, returning to original structure and then in negative direction (-) again returning to the original structure.
|
|
283
|
+
|
|
284
|
+
Args:
|
|
285
|
+
mode_number (int) : Mode number. (first non-rigid mode is 6th)
|
|
286
|
+
scale (float) : Multiplier; extent to which mode will be extrapolated. Defaults to 1.5
|
|
287
|
+
n (int) : Number of frames in output (should be =>8 and ideally multiple of 4) Defaults to 20
|
|
288
|
+
ftype (string) : Extension of the output file (.cif / .pdb)
|
|
289
|
+
|
|
290
|
+
Note:
|
|
291
|
+
- Scale and n parameters should be redesigned.
|
|
292
|
+
- direction is the variable which be allow user to explore only positive or only negative direction of the modes.
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
True if successful; false otherwise.
|
|
296
|
+
"""
|
|
297
|
+
x0=self.coords
|
|
298
|
+
new_coords=[]
|
|
299
|
+
|
|
300
|
+
movement = [ numpy.sin(k*(1.0/float(n))*2*numpy.pi) for k in range(0,n+1,1) ]
|
|
301
|
+
ModelsOfTheProtein = []
|
|
302
|
+
for j in movement:
|
|
303
|
+
AtomsOfTheFrame = {}
|
|
304
|
+
for numi,i in enumerate(x0):
|
|
305
|
+
new_x=i[0]+scale*j*self.eigen_vectors[:,mode_number][(numi*3)+0]
|
|
306
|
+
new_y=i[1]+scale*j*self.eigen_vectors[:,mode_number][(numi*3)+1]
|
|
307
|
+
new_z=i[2]+scale*j*self.eigen_vectors[:,mode_number][(numi*3)+2]
|
|
308
|
+
new_x , new_y, new_z = new_x.real , new_y.real , new_z.real
|
|
309
|
+
currentatm = Atom(self.atoms[numi].get_id() , self.atoms[numi].get_name(), numpy.array([new_x,new_y,new_z]), self.atoms[numi].get_occupancy(), self.atoms[numi].get_bfactor(), self.atoms[numi].get_element(),self.atoms[numi].get_charge(), self.atoms[numi].get_parent() )
|
|
310
|
+
AtomsOfTheFrame[numi] = currentatm
|
|
311
|
+
|
|
312
|
+
ModelsOfTheProtein.append( Model(j, AtomsOfTheFrame, None, None, None, None) )
|
|
313
|
+
Annotations = self.atoms[0].get_parent().get_parent().get_parent().get_parent().get_data()
|
|
314
|
+
prot = Protein(str(mode_number), ModelsOfTheProtein)
|
|
315
|
+
prot.set_data(Annotations)
|
|
316
|
+
prot.write_structure( str(mode_number)+'.'+ftype )
|
|
317
|
+
return True
|