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,186 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The 'Bond' 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 'Bond' object documentation for details.
|
|
6
|
+
|
|
7
|
+
Citation:
|
|
8
|
+
Pranav M Khade, Robert L Jernigan, PACKMAN-Molecule: Python Toolbox for Structural Bioinformatics, Bioinformatics Advances, 2022;, vbac007, https://doi.org/10.1093/bioadv/vbac007
|
|
9
|
+
|
|
10
|
+
Example::
|
|
11
|
+
|
|
12
|
+
from packman.molecule import Bond
|
|
13
|
+
help( Bond )
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Todo:
|
|
17
|
+
* Finish writing up the documentation.
|
|
18
|
+
* Finish error handling.
|
|
19
|
+
* Finish optimizing the performance.
|
|
20
|
+
|
|
21
|
+
Authors:
|
|
22
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
23
|
+
"""
|
|
24
|
+
import logging
|
|
25
|
+
|
|
26
|
+
class Bond():
|
|
27
|
+
"""This class contains the information about the 'Bond' object (packman.molecule.Bond).
|
|
28
|
+
|
|
29
|
+
This class contains all the information available about the Bond. The Bond class is the connection between the lowest in the hierarchy of the 'molecule' API classes (Atom).
|
|
30
|
+
the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
|
|
31
|
+
Please read the Tutorials and Documentation for more details.
|
|
32
|
+
|
|
33
|
+
Note:
|
|
34
|
+
- Since this is an object file, user is allowed to bond any two atoms in the structure. However, it is recommended to use caution and stick to the conventions when bonding two atoms.
|
|
35
|
+
- The bonds that are not in the CONNECT records of the structure file are calculated using the following algorithm:
|
|
36
|
+
Zhang, Q., Zhang, W., Li, Y. et al. A rule-based algorithm for automatic bond type perception. J Cheminform 4, 26 (2012). https://doi.org/10.1186/1758-2946-4-26
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
id (int) : ID of the bond.
|
|
40
|
+
atom1 (packman.molecule.Atom) : The first atom connected by the bond. (order is not important)
|
|
41
|
+
atom2 (packman.molecule.Atom) : The second atom connected by the bond. (order is not important)
|
|
42
|
+
source (str) : Source of information for the given bond.
|
|
43
|
+
type (str) : Bond can be either of the following type: (covalent, ionic, hydrogen or other)
|
|
44
|
+
electrons (tuple) : A python tuple containing information about shared electrons (eg.... (1,1) means the electrons shared between a single hydrocarbon bond if the atom1 is carbon and atom2 is hydrogen touple order here is (atom1, atom2).
|
|
45
|
+
"""
|
|
46
|
+
def __init__(self, id, atom1, atom2, type, source=None):
|
|
47
|
+
self.__id = id
|
|
48
|
+
self.__allowed_bond_types = ['non-covalent', 'covalent', 'covalent-single', 'covalent-double', 'covalent-triple' , 'ionic', 'hydrogen', 'salt-bridge', 'other']
|
|
49
|
+
self.__atom1 = atom1
|
|
50
|
+
self.__atom2 = atom2
|
|
51
|
+
self.__type = type
|
|
52
|
+
self.__source = source
|
|
53
|
+
|
|
54
|
+
#Properties are the entities that are not included in the PDB files and are obtained by calculations
|
|
55
|
+
self.__properties = {}
|
|
56
|
+
|
|
57
|
+
#Get Functions
|
|
58
|
+
def get_id(self):
|
|
59
|
+
"""Get the ID of the 'Bond'
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
id (int) : ID of the bond.
|
|
63
|
+
"""
|
|
64
|
+
return self.__id
|
|
65
|
+
|
|
66
|
+
def get_atoms(self):
|
|
67
|
+
"""Get the atoms involved in the bond.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
(atom1, atom2) if successful; None otherwise
|
|
71
|
+
"""
|
|
72
|
+
return ( self.__atom1, self.__atom2 )
|
|
73
|
+
|
|
74
|
+
def get_type(self):
|
|
75
|
+
"""Get the type of the bond
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
type of the bond (str) if successful; None otherwise
|
|
79
|
+
"""
|
|
80
|
+
return self.__type
|
|
81
|
+
|
|
82
|
+
def get_source(self):
|
|
83
|
+
"""Get the source of the information of the created bond.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
source (str): Source of information for the given bond.
|
|
87
|
+
"""
|
|
88
|
+
return self.__source
|
|
89
|
+
|
|
90
|
+
def get_property(self,property_name):
|
|
91
|
+
"""Get the Property of the given 'Bond'.
|
|
92
|
+
|
|
93
|
+
Property is any key and value combination that can be assigned to this object. This (along with the set_property) feature is mainly useful for the user customization.
|
|
94
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
98
|
+
|
|
99
|
+
Note:
|
|
100
|
+
- Users can add custom annotations; for example: If particular chain becomes disordered, it can be annotated with this feature.
|
|
101
|
+
"""
|
|
102
|
+
try:
|
|
103
|
+
return self.__properties[property_name]
|
|
104
|
+
except:
|
|
105
|
+
logging.warning('The Property Name provided is not assigned.')
|
|
106
|
+
|
|
107
|
+
def get_torsion(self, neighbor1=None, neighbor2=None, radians=True):
|
|
108
|
+
"""Calculate the torsion angle of the given covalent bond with the corresponding selected neighbors.
|
|
109
|
+
|
|
110
|
+
Note:
|
|
111
|
+
At least four atoms are needed to form two planes that can measure the torsional angles; therefore, along with the two bond atoms, the user needs to provide the additional two atoms that are ideally non-mutual neighbors of the atoms in the bond.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom1 as an 'Atom' object or Atom ID.
|
|
115
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom2 as an 'Atom' object or Atom ID.
|
|
116
|
+
radians (True/False) : Return value of the angle in radians (returns value in degrees if False; Default : True)
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
The torsion angle in radians/degrees if sucessful, None otherwise.
|
|
120
|
+
"""
|
|
121
|
+
Model = self.__atom1.get_parent().get_parent().get_parent()
|
|
122
|
+
return Model.get_torsion(self, neighbor1=neighbor1, neighbor2=neighbor2, radians=radians)
|
|
123
|
+
|
|
124
|
+
#Set Functions
|
|
125
|
+
def set_atoms(self, new_pair):
|
|
126
|
+
"""Set the atoms involved in the bond.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
atom_pair (tuple): Tuple of :ref:`packman.molecule.Atom` objects.
|
|
130
|
+
"""
|
|
131
|
+
if(len(new_pair)!=2):
|
|
132
|
+
logging.warning('The input provided for Bond.set_atoms() does not have valid length. Please make sure that exactly two atoms are provided. eg.. (Atom1, Atom2)')
|
|
133
|
+
else:
|
|
134
|
+
self.__atom1 = new_pair[0]
|
|
135
|
+
self.__atom2 = new_pair[1]
|
|
136
|
+
|
|
137
|
+
def set_type(self,new_type):
|
|
138
|
+
"""Set the bond type.
|
|
139
|
+
|
|
140
|
+
Bond can be either of the following type: (covalent, ionic, hydrogen or other)
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
new_type (str):
|
|
144
|
+
"""
|
|
145
|
+
if(new_type in self.__allowed_bond_types):
|
|
146
|
+
self.__type = new_type
|
|
147
|
+
else:
|
|
148
|
+
logging.warning( 'Invalid bond type. Allowed types: '+', '.join(self.__allowed_bond_types) )
|
|
149
|
+
|
|
150
|
+
def set_property(self,property_name,value):
|
|
151
|
+
"""Set the Property of the given 'Bond'.
|
|
152
|
+
|
|
153
|
+
Property is any key and value combination that can be assigned to this object. This (along with the get_property) feature is mainly useful for the user customization.
|
|
154
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
158
|
+
value (object): The value the user wants to assign to the property
|
|
159
|
+
|
|
160
|
+
Note:
|
|
161
|
+
- Users can add custom annotations; for example: If particular amino acid becomes disordered, it can be annotated with this feature.
|
|
162
|
+
"""
|
|
163
|
+
try:
|
|
164
|
+
self.__properties[property_name] = value
|
|
165
|
+
except:
|
|
166
|
+
logging.warning('Please check the property name. Check the allowed Python dictionary key types for more details.')
|
|
167
|
+
|
|
168
|
+
def set_torsion(self, theta, neighbor1=None, neighbor2=None, radians=True):
|
|
169
|
+
"""Set the torsion for the given covalent bond with the corresponding selected neighbors.
|
|
170
|
+
|
|
171
|
+
Note:
|
|
172
|
+
At least four atoms are needed to form two planes that change the torsional angles; therefore, along with the two bond atoms, the user needs to provide the additional two atoms that are ideally non-mutual neighbors of the atoms in the bond.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
theta (int) : Set the torsional angle (see the 'radians' parameter description)
|
|
176
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom1 as an 'Atom' object or Atom ID.
|
|
177
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom2 as an 'Atom' object or Atom ID.
|
|
178
|
+
radians (True/False) : Parameter 'theta' will be assuned to be in Radians if True, Degrees will be assumed when False. ( Default : True)
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
True if successful, None otherwise
|
|
182
|
+
"""
|
|
183
|
+
Model = self.__atom1.get_parent().get_parent().get_parent()
|
|
184
|
+
return Model.set_torsion(self, theta, neighbor1=neighbor1, neighbor2=neighbor2, radians=radians)
|
|
185
|
+
|
|
186
|
+
#Calculate Functions
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The 'Chain' 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 'Chain' object documentation for details.
|
|
6
|
+
|
|
7
|
+
Citation:
|
|
8
|
+
Pranav M Khade, Robert L Jernigan, PACKMAN-Molecule: Python Toolbox for Structural Bioinformatics, Bioinformatics Advances, 2022;, vbac007, https://doi.org/10.1093/bioadv/vbac007
|
|
9
|
+
|
|
10
|
+
Example::
|
|
11
|
+
|
|
12
|
+
from packman.molecule import Chain
|
|
13
|
+
help( Chain )
|
|
14
|
+
|
|
15
|
+
Note:
|
|
16
|
+
* Iterating over chain only fetches the residues not the hetero atoms
|
|
17
|
+
* The object fetches the atoms and residues which are not in order as they appear in the PDB. Find a way to fix this
|
|
18
|
+
|
|
19
|
+
Todo:
|
|
20
|
+
* Finish writing up the documentation.
|
|
21
|
+
* Finish error handling.
|
|
22
|
+
* Finish optimizing the performance.
|
|
23
|
+
|
|
24
|
+
Authors:
|
|
25
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
import numpy
|
|
29
|
+
import logging
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Chain():
|
|
34
|
+
"""This class contains the information about the 'Chain' object (packman.molecule.Chain).
|
|
35
|
+
|
|
36
|
+
This class contains all the information available about the Chain and stores the corresponding 'Residue' and 'Hetmol' objects in itself. The Chain class is the third lowest in the hierarchy of the 'molecule' API classes.
|
|
37
|
+
the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
|
|
38
|
+
Please read the Tutorials and Documentation for more details.
|
|
39
|
+
|
|
40
|
+
Note:
|
|
41
|
+
* Please refer to the [https://web.archive.org/web/20080905024351/http://www.wwpdb.org/docs.html] for the description of the arguments.
|
|
42
|
+
* Add get_atoms()
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
id (str): Chain ID from the PDB file as it is. Each Chain in a PDB file Model/Frame has unique ID. (essential)
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def __init__(self,id):
|
|
50
|
+
self.__id = id
|
|
51
|
+
self.__Residues = {}
|
|
52
|
+
self.__HetMols = {}
|
|
53
|
+
self.__parent = None
|
|
54
|
+
#More Features
|
|
55
|
+
self.__Hinges = []
|
|
56
|
+
|
|
57
|
+
#Properties are the entities that are not included in the PDB files and are obtained by calculations
|
|
58
|
+
self.__properties = {}
|
|
59
|
+
|
|
60
|
+
def __setitem__(self,Number,Entity,Type):
|
|
61
|
+
if(Type=='Residue'):
|
|
62
|
+
try:
|
|
63
|
+
self.__Residues[Number]=Entity
|
|
64
|
+
except:
|
|
65
|
+
self.__Residues[Number]=Entity
|
|
66
|
+
elif(Type=='HetMol'):
|
|
67
|
+
try:
|
|
68
|
+
self.__HetMols[Number]=Entity
|
|
69
|
+
except:
|
|
70
|
+
self.__HetMols[Number]=Entity
|
|
71
|
+
|
|
72
|
+
def __getitem__(self,Number,Type=None):
|
|
73
|
+
try:
|
|
74
|
+
return self.__Residues[Number]
|
|
75
|
+
except:
|
|
76
|
+
return self.__HetMols[Number]
|
|
77
|
+
|
|
78
|
+
#Get Functions
|
|
79
|
+
def get_id(self):
|
|
80
|
+
"""Get the ID of the 'Residue'
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
str if successful, None otherwise.
|
|
84
|
+
"""
|
|
85
|
+
return self.__id
|
|
86
|
+
|
|
87
|
+
def get_parent(self):
|
|
88
|
+
"""Get the 'Model' the given 'Chain' belongs to.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
packman.molecule.Model if successful, None otherwise.
|
|
92
|
+
"""
|
|
93
|
+
return self.__parent
|
|
94
|
+
|
|
95
|
+
def get_hinges(self):
|
|
96
|
+
"""Get the hinges in the chain as a dictionary of 'Hinge' objects.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
packman.molecule.annotations.Hinge if successful, None otherwise.
|
|
100
|
+
"""
|
|
101
|
+
return self.__Hinges
|
|
102
|
+
|
|
103
|
+
def get_entropy(self,entropy_type):
|
|
104
|
+
"""Get the Packing Entropy of the given 'Chain'.
|
|
105
|
+
|
|
106
|
+
Please note that if the Entropy is calculated using specific atoms, this option might not give results for the amino acids that are not included because of the specific selection. Use the get_total_chain_entropy() function. Please see the documentation for more details.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
type (str): Type of entropy (Allowed Values: 1. PackingEntropy)
|
|
110
|
+
|
|
111
|
+
Note:
|
|
112
|
+
- More type of Entropies might be added in the future.
|
|
113
|
+
"""
|
|
114
|
+
EntropyTypes = ['PackingEntropy']
|
|
115
|
+
try:
|
|
116
|
+
return numpy.sum( [self.__Residues[i].get_entropy(entropy_type) for i in self.__Residues] )
|
|
117
|
+
except:
|
|
118
|
+
if(entropy_type in EntropyTypes):
|
|
119
|
+
logging.warning('This Entropy type is not yet calculated for parameters provided. Please check the "calculate_entropy" function in the documentation for the details.')
|
|
120
|
+
else:
|
|
121
|
+
logging.warning('The Entropy type provided is invalid. Please check the documentation for the details.')
|
|
122
|
+
|
|
123
|
+
def get_property(self,property_name):
|
|
124
|
+
"""Get the Property of the given 'Chain'.
|
|
125
|
+
|
|
126
|
+
Property is any key and value combination that can be assigned to this object. This (along with the set_property) feature is mainly useful for the user customization.
|
|
127
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
131
|
+
|
|
132
|
+
Note:
|
|
133
|
+
- Users can add custom annotations; for example: If particular chain becomes disordered, it can be annotated with this feature.
|
|
134
|
+
"""
|
|
135
|
+
try:
|
|
136
|
+
return self.__properties[property_name]
|
|
137
|
+
except:
|
|
138
|
+
logging.warning('The Property Name provided is not assigned.')
|
|
139
|
+
|
|
140
|
+
def get_bonds(self):
|
|
141
|
+
"""Get the Bonds in the given 'Chain'
|
|
142
|
+
|
|
143
|
+
Please check out calculate_bonds() for more information on the bond calculations.
|
|
144
|
+
"""
|
|
145
|
+
try:
|
|
146
|
+
yield self.__AllBonds
|
|
147
|
+
except:
|
|
148
|
+
logging.warn('Bonds are not calculated yet. Use calculate_bond()')
|
|
149
|
+
|
|
150
|
+
#Set Functions
|
|
151
|
+
def set_id(self,new_id):
|
|
152
|
+
"""Set the ID of the given 'Chain'
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
new_id (str): The ID User wishes to assign to the given 'Chain'
|
|
156
|
+
"""
|
|
157
|
+
self.__id=new_id
|
|
158
|
+
|
|
159
|
+
def set_parent(self,parent):
|
|
160
|
+
"""Set the Parent of the given 'Residue'
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
new_parent (packman.molecule.Chain): The parent 'Chain' User wishes to assign to the given 'Residue'
|
|
164
|
+
"""
|
|
165
|
+
self.__parent=parent
|
|
166
|
+
|
|
167
|
+
def set_hinges(self,new_hinges):
|
|
168
|
+
"""Set/Add hinge to the 'Chain' object
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
new_hinges (packman.molecule.annotations.Hinge): The 'Hinge' User wishes to assign/add to the given 'Chain'
|
|
172
|
+
"""
|
|
173
|
+
self.__Hinges=self.__Hinges+new_hinges
|
|
174
|
+
|
|
175
|
+
def set_property(self,property_name,value):
|
|
176
|
+
"""Set the Property of the given 'Chain'.
|
|
177
|
+
|
|
178
|
+
Property is any key and value combination that can be assigned to this object. This (along with the get_property) feature is mainly useful for the user customization.
|
|
179
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
183
|
+
value (object): The value the user wants to assign to the property
|
|
184
|
+
|
|
185
|
+
Note:
|
|
186
|
+
- Users can add custom annotations; for example: If particular amino acid becomes disordered, it can be annotated with this feature.
|
|
187
|
+
"""
|
|
188
|
+
try:
|
|
189
|
+
self.__properties[property_name] = value
|
|
190
|
+
except:
|
|
191
|
+
logging.warning('Please check the property name. Check the allowed Python dictionary key types for more details.')
|
|
192
|
+
|
|
193
|
+
#Calculation Functions
|
|
194
|
+
def get_atoms(self):
|
|
195
|
+
"""Get the generator of corresponding 'atom' objects of the residues of the 'Chain'
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
generator of 'atom' objects if successful, None otherwise.
|
|
199
|
+
"""
|
|
200
|
+
for i in sorted(self.__Residues.keys()):
|
|
201
|
+
for j in self.__Residues[i].get_atoms():
|
|
202
|
+
yield j
|
|
203
|
+
|
|
204
|
+
def get_hetatoms(self):
|
|
205
|
+
"""Get the generator of corresponding 'atom' objects of the hetmols of the 'Chain'
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
generator of 'atom' objects if successful, None otherwise.
|
|
209
|
+
"""
|
|
210
|
+
for i in sorted(self.__HetMols.keys()):
|
|
211
|
+
for j in self.__HetMols[i].get_atoms():
|
|
212
|
+
yield j
|
|
213
|
+
|
|
214
|
+
def get_atom(self, idx):
|
|
215
|
+
"""Get the atom of the given ID.
|
|
216
|
+
|
|
217
|
+
Note: - This function is different from :py:func:`packman.molecule.chain.get_atoms` and also :py:func:`packman.molecule.residue.get_atom`
|
|
218
|
+
- If the PDB file is constructed manually/ has multiple atoms of the same ID, the first instance of the atom with that id is returned. Please avoid saving two atoms with same ID in a same structure file in a given frame/model.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
idx (int): Get atom by the id
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
atom (:py:class:`packman.molecule.Atom`): Atom of the given ID if successful; None otherwise.
|
|
225
|
+
"""
|
|
226
|
+
the_atom = None
|
|
227
|
+
for i in self.__Residues:
|
|
228
|
+
the_atom = self.__Residues[i].get_atom(idx)
|
|
229
|
+
if(the_atom!=None):
|
|
230
|
+
break
|
|
231
|
+
|
|
232
|
+
if(the_atom==None):
|
|
233
|
+
for i in self.__HetMols:
|
|
234
|
+
the_atom = self.__HetMols[i].get_atom(idx)
|
|
235
|
+
if(the_atom!=None):
|
|
236
|
+
break
|
|
237
|
+
if(the_atom!=None):
|
|
238
|
+
return the_atom
|
|
239
|
+
else:
|
|
240
|
+
logging.info('The atom with the given ID is not found in the Residues/HetMols')
|
|
241
|
+
return None
|
|
242
|
+
|
|
243
|
+
def get_residue(self,idx):
|
|
244
|
+
"""Get the residue of the given ID.
|
|
245
|
+
|
|
246
|
+
Note: - This function is different from :py:func:`packman.molecule.chain.get_residues`
|
|
247
|
+
- If the PDB file is constructed manually/ has multiple residues of the same ID, the first instance of the residue with that id is returned. Please avoid saving two residues with same ID in a same structure file in a given frame/model.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
idx (int): Get residue by the id
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
residue (:py:class:`packman.molecule.Residue`): Residue of the given ID if successful; None otherwise.
|
|
254
|
+
"""
|
|
255
|
+
for i in self.get_residues():
|
|
256
|
+
if(i.get_id() == idx):
|
|
257
|
+
return i
|
|
258
|
+
break
|
|
259
|
+
|
|
260
|
+
def get_hetmol(self,idx):
|
|
261
|
+
"""Get the hetmol of the given ID.
|
|
262
|
+
|
|
263
|
+
Note: - This function is different from :py:func:`packman.molecule.chain.get_hetmols`
|
|
264
|
+
- If the PDB file is constructed manually/ has multiple hetmol of the same ID, the first instance of the hetmol with that id is returned. Please avoid saving two hetmol with same ID in a same structure file in a given frame/model.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
idx (int): Get hetmol by the id
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
residue (:py:class:`packman.molecule.HetMol`): HetMol of the given ID if successful; None otherwise.
|
|
271
|
+
"""
|
|
272
|
+
for i in self.get_hetmols():
|
|
273
|
+
if(i.get_id() == idx):
|
|
274
|
+
return i
|
|
275
|
+
break
|
|
276
|
+
|
|
277
|
+
def get_residues(self):
|
|
278
|
+
"""Get the generator of corresponding 'Residue' objects of the 'Chain'
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
generator of 'Residue' objects if successful, None otherwise.
|
|
282
|
+
"""
|
|
283
|
+
for i in sorted(self.__Residues.keys()):yield self.__Residues[i]
|
|
284
|
+
|
|
285
|
+
def get_calpha(self):
|
|
286
|
+
"""Get the C-Alpha atoms of the 'Chain' as an 'Atom' object.
|
|
287
|
+
|
|
288
|
+
Returns:
|
|
289
|
+
generator of packman.molecule.Atom objects if successful, None otherwise.
|
|
290
|
+
"""
|
|
291
|
+
for i in self.get_residues():yield i.get_calpha()
|
|
292
|
+
|
|
293
|
+
def get_hetmols(self):
|
|
294
|
+
"""Get the generator of corresponding 'HetMol' objects of the 'Chain'
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
generator of 'HetAtom' objects if successful, None otherwise.
|
|
298
|
+
"""
|
|
299
|
+
for i in sorted(self.__HetMols.keys()):yield self.__HetMols[i]
|
|
300
|
+
|
|
301
|
+
def get_backbone(self):
|
|
302
|
+
"""Get the Backbone atoms of the given 'Chain' as a list of 'Atom' object
|
|
303
|
+
|
|
304
|
+
Note:
|
|
305
|
+
* Backbone Atoms: CA, O, N, C
|
|
306
|
+
|
|
307
|
+
Returns:
|
|
308
|
+
list of packman.molecule.Atom if successful, None otherwise.
|
|
309
|
+
"""
|
|
310
|
+
return [i.get_backbone() for i in self.get_residues()]
|
|
311
|
+
|
|
312
|
+
def calculate_entropy(self,entropy_type,chains=None, probe_size=1.4, onspherepoints=30):
|
|
313
|
+
"""Calculate the entropy for the each amino acid will be returned.
|
|
314
|
+
|
|
315
|
+
The 'chains' argument should be used when the user wants to restrict the analysis to a chain or group of chains rather than the whole structure.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
entropy_type (str) : Type of entropy to be calculated (Options: PackingEntropy)
|
|
319
|
+
chains ([str]/str) : Chain IDs for the Entropy calculation (None means all the chains are included; single string means only one chain ID; multiple chains should be an array of strings).
|
|
320
|
+
probe_size (float) : Radius of the probe to generate the surface points (This value should not be less than 1;Read the Publication for more details)
|
|
321
|
+
onspherepoints (int) : Number of points to be generated around each point for the surface (Read the Publication for more details)
|
|
322
|
+
"""
|
|
323
|
+
self.get_parent().calculate_entropy(entropy_type,chains=chains, probe_size=probe_size, onspherepoints=onspherepoints)
|