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,112 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The gemotry objects host file.
|
|
3
|
+
|
|
4
|
+
This is file information, not the class information. This information is only for the API developers.
|
|
5
|
+
Please read the 'geometry' object documentation for details.
|
|
6
|
+
|
|
7
|
+
Example::
|
|
8
|
+
|
|
9
|
+
from packman import geometry
|
|
10
|
+
help( geometry )
|
|
11
|
+
|
|
12
|
+
Todo:
|
|
13
|
+
* Finish writing up the documentation.
|
|
14
|
+
* Finish error handling.
|
|
15
|
+
* Annotate 'error', 'cross'
|
|
16
|
+
* Finish optimizing the performance.
|
|
17
|
+
|
|
18
|
+
Authors:
|
|
19
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
20
|
+
"""
|
|
21
|
+
import numpy
|
|
22
|
+
|
|
23
|
+
from scipy.spatial import Delaunay
|
|
24
|
+
|
|
25
|
+
from networkx import Graph
|
|
26
|
+
|
|
27
|
+
def Circumsphere(Tetrahydron):
|
|
28
|
+
"""Get the Circumsphere of the set of four points.
|
|
29
|
+
|
|
30
|
+
Given any four three dimentional points, this function calculates the features of the circumsphere having the given four points on it's surface.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
Tetrahydron ([packman.molecule.Atom] or [[X,Y,Z]]): Either packman.molecule.Atom objects or 3D corrdinates.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
[Centre, Radius] (float): The 3D coordinates of the geometrical center of the given four points, Radius of the circumsphere made up of given four points in that order.
|
|
37
|
+
"""
|
|
38
|
+
alpha_mat, gamma_mat, Dx_mat, Dy_mat, Dz_mat=[], [], [], [], []
|
|
39
|
+
for i in Tetrahydron:
|
|
40
|
+
temp_coords = i.get_location()
|
|
41
|
+
alpha_mat.append( [temp_coords[0],temp_coords[1],temp_coords[2],1] )
|
|
42
|
+
gamma_mat.append( [temp_coords[0]**2+temp_coords[1]**2+temp_coords[2]**2,temp_coords[0],temp_coords[1],temp_coords[2]] )
|
|
43
|
+
Dx_mat.append( [temp_coords[0]**2+temp_coords[1]**2+temp_coords[2]**2,temp_coords[1],temp_coords[2],1] )
|
|
44
|
+
Dy_mat.append( [temp_coords[0]**2+temp_coords[1]**2+temp_coords[2]**2,temp_coords[0],temp_coords[2],1] )
|
|
45
|
+
Dz_mat.append( [temp_coords[0]**2+temp_coords[1]**2+temp_coords[2]**2,temp_coords[0],temp_coords[1],1] )
|
|
46
|
+
alpha = numpy.linalg.det(alpha_mat)
|
|
47
|
+
gamma = numpy.linalg.det(gamma_mat)
|
|
48
|
+
Dx = (+numpy.linalg.det(Dx_mat))
|
|
49
|
+
Dy = (-numpy.linalg.det(Dy_mat))
|
|
50
|
+
Dz = (+numpy.linalg.det(Dz_mat))
|
|
51
|
+
Centre = numpy.array([Dx/2*alpha,Dy/2*alpha,Dz/2*alpha])
|
|
52
|
+
Radius = numpy.sqrt(Dx**2 + Dy**2 + Dz**2 - 4*alpha*gamma)/(2*numpy.absolute(alpha))
|
|
53
|
+
return Centre, Radius
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def AlphaShape( atoms, alpha, get_graph=False, write_objfile=None ):
|
|
57
|
+
"""Get the Alpha Shape of the atoms.
|
|
58
|
+
|
|
59
|
+
Given set of atoms as 'Atom' (packman.molecule.Atom) object(s) and the alpha value, this class will calculate and return the alpha shape tessellations. It will also write the .obj file if the filename is provided as an input.
|
|
60
|
+
|
|
61
|
+
Notes:
|
|
62
|
+
* Tip: If you do not want to use the function multiple times to save computation, calculate it once with alpha = float('Inf') and then use the tessellations to calculate radius and save it as a dictionary to retrieve. Tessellations with any cutoff.
|
|
63
|
+
* For more information on the alpha shape, read the following paper:
|
|
64
|
+
EdelsbrunnerandE. P. M ̈ucke.Three-dimensional alpha shapes.
|
|
65
|
+
Manuscript UIUCDCS-R-92-1734, Dept.Comput.Sci. ,Univ.Illinois, Urbana-Champaign, IL, 1992.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
atoms (packman.molecule.Atom) :
|
|
69
|
+
alpha (float) :
|
|
70
|
+
get_graph (networkx.Graph) :
|
|
71
|
+
write_objfile (str) :
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
- Alpha Shape Tessellations ; if 'get_graph' = False
|
|
75
|
+
- Alpha Shape Tessellations, Protein Graph ; if 'get_graph' = True
|
|
76
|
+
"""
|
|
77
|
+
def calculate_alphafitness(alpha, circumradius):
|
|
78
|
+
"""Alpha Test as per the paper.
|
|
79
|
+
|
|
80
|
+
Notes:
|
|
81
|
+
* Resides inside 'get_alphashape' function.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
alpha (float) : Alpha. (Read parent method description)
|
|
85
|
+
circumradius ([float]) : Circumradius of the circumsphere. (Read parent method description)
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
bool: True if alpha test is passed. False otherwise.
|
|
89
|
+
"""
|
|
90
|
+
if( circumradius < alpha ):
|
|
91
|
+
return True
|
|
92
|
+
else:
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
#get_alphashape function commands.
|
|
96
|
+
DelaunayTesssellations = Delaunay( [i.get_location() for i in atoms] )
|
|
97
|
+
AlphaShape = []
|
|
98
|
+
ProteinGraph = Graph()
|
|
99
|
+
|
|
100
|
+
for a, b, c, d in DelaunayTesssellations.vertices:
|
|
101
|
+
Tetrahydron = [atoms[a],atoms[b],atoms[c],atoms[d]]
|
|
102
|
+
Centre, Radius = Circumsphere(Tetrahydron)
|
|
103
|
+
#Alpha Test
|
|
104
|
+
if( calculate_alphafitness(alpha,Radius) ):
|
|
105
|
+
ProteinGraph.add_nodes_from( [a,b,c,d] )
|
|
106
|
+
ProteinGraph.add_edges_from( [(a,b),(a,c),(a,d),(b,c),(b,d),(c,d)] )
|
|
107
|
+
AlphaShape.append( [atoms[a],atoms[b],atoms[c],atoms[d]] )
|
|
108
|
+
|
|
109
|
+
if(get_graph):
|
|
110
|
+
return AlphaShape, ProteinGraph
|
|
111
|
+
else:
|
|
112
|
+
return AlphaShape
|
|
@@ -0,0 +1,45 @@
|
|
|
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.molecule' module is used to read, write, manipulate and analyze the molecule.
|
|
6
|
+
|
|
7
|
+
This module is the base of the tool packman. It is used as a base module for all the packman utilities
|
|
8
|
+
such as HingePrediction, Compliance and Right Domain ANM. The molecule module can also be an API to utilize the objects such
|
|
9
|
+
as Atom, Residue, Chain, Model and Protein. Please read the documentation and tutorials for more details.
|
|
10
|
+
|
|
11
|
+
Citation:
|
|
12
|
+
Pranav M Khade, Robert L Jernigan, PACKMAN-Molecule: Python Toolbox for Structural Bioinformatics, Bioinformatics Advances, 2022;, vbac007, https://doi.org/10.1093/bioadv/vbac007
|
|
13
|
+
|
|
14
|
+
Notes:
|
|
15
|
+
* Tutorial link: https://py-packman.readthedocs.io/en/latest/tutorials/molecule.html#tutorials-molecule
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
To Load the molecule::
|
|
19
|
+
from packman import molecule
|
|
20
|
+
molecule.download_structure('1prw','1prw.pdb')
|
|
21
|
+
mol = molecule.load_structure('1prw.pdb')
|
|
22
|
+
|
|
23
|
+
Todo:
|
|
24
|
+
* Add new features
|
|
25
|
+
* Use ``sphinx.ext.todo`` extension
|
|
26
|
+
* Add Tutorial Link
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#Parser Functions
|
|
31
|
+
from .molecule import download_structure
|
|
32
|
+
from .molecule import load_structure
|
|
33
|
+
|
|
34
|
+
#Building Functions
|
|
35
|
+
from .protein import Protein
|
|
36
|
+
from .model import Model
|
|
37
|
+
|
|
38
|
+
from .chain import Chain
|
|
39
|
+
from .residue import Residue
|
|
40
|
+
from .atom import Atom
|
|
41
|
+
from .bond import Bond
|
|
42
|
+
|
|
43
|
+
from .hetmol import HetMol
|
|
44
|
+
|
|
45
|
+
from .annotations import Hinge
|
|
Binary file
|
Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/annotations.cpython-39.pyc
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The various annotation objects host file.
|
|
3
|
+
|
|
4
|
+
This is file information, not the class information. This information is only for the API developers.
|
|
5
|
+
Please read the corrosponding 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 Hinge
|
|
13
|
+
help( Hinge )
|
|
14
|
+
|
|
15
|
+
Todo:
|
|
16
|
+
* Finish writing up the documentation.
|
|
17
|
+
* Finish error handling.
|
|
18
|
+
* Finish optimizing the performance.
|
|
19
|
+
|
|
20
|
+
Authors:
|
|
21
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
'''
|
|
26
|
+
##################################################################################################
|
|
27
|
+
# Structural Super Elements #
|
|
28
|
+
##################################################################################################
|
|
29
|
+
'''
|
|
30
|
+
|
|
31
|
+
class Hinge():
|
|
32
|
+
"""This class contains the information about the 'Hinge' object (packman.molecule.Hinge).
|
|
33
|
+
|
|
34
|
+
This class contains all the information available about the Hinge. The Hinge class is the not in the hierarchy of the 'molecule' API classes.
|
|
35
|
+
However, it resides in the packman.molecule.Chain object because there are unique hinges per chain.
|
|
36
|
+
the order of hierarchy of Chain being being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
|
|
37
|
+
Please read the Tutorials and Documentation for more details.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
hid (int) : Unique Hinge ID
|
|
41
|
+
alpha_value (float) : The hinge prediction algorithm parameter (Alpha Value) of the Hinge.
|
|
42
|
+
elements (packman.molecule.Residue): The elements defining the current hinge (Currently residue objects)
|
|
43
|
+
stats ([float]) : Everything about the statistics (mean/median/mode of B-factors)
|
|
44
|
+
p (float) : p-value obtained from the permutation test (Please read the paper for more details)
|
|
45
|
+
"""
|
|
46
|
+
def __init__(self,hid,alpha_value,elements,stats,p):
|
|
47
|
+
self.__id=hid
|
|
48
|
+
self.__alpha_value=alpha_value
|
|
49
|
+
self.__elements=elements
|
|
50
|
+
self.__stats=stats
|
|
51
|
+
self.__p=p
|
|
52
|
+
|
|
53
|
+
#Get functions
|
|
54
|
+
def get_id(self):
|
|
55
|
+
"""Get the ID of the 'Hinge'
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
int if successful, None otherwise.
|
|
59
|
+
"""
|
|
60
|
+
return self.__id
|
|
61
|
+
|
|
62
|
+
def get_alpha_value(self):
|
|
63
|
+
"""Get the hinge prediction algorithm parameter (Alpha Value) of the 'Hinge'.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
float if successful, None otherwise
|
|
67
|
+
"""
|
|
68
|
+
return self.__alpha_value
|
|
69
|
+
|
|
70
|
+
def get_elements(self):
|
|
71
|
+
"""Get the elements (Currently residue objects) of the 'Hinge'
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
list of elements (Currently residue objects) if successful, None otherwise.
|
|
75
|
+
"""
|
|
76
|
+
return self.__elements
|
|
77
|
+
|
|
78
|
+
def get_stats(self):
|
|
79
|
+
"""Get the statistics of the 'Hinge'
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Statistics of the Hinge such as mean/median/mode of B-factors if successful, None otherwise.
|
|
83
|
+
"""
|
|
84
|
+
return self.__stats
|
|
85
|
+
|
|
86
|
+
def get_pvalue(self):
|
|
87
|
+
"""Get the statistics of the 'Hinge'
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
p-value (float) : p-value obtained from the permutation test (Please read the paper for more details)
|
|
91
|
+
"""
|
|
92
|
+
return self.__p
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The 'Atom' 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 'Atom' 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 Atom
|
|
13
|
+
help( Atom )
|
|
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
|
+
|
|
25
|
+
import numpy
|
|
26
|
+
|
|
27
|
+
import logging
|
|
28
|
+
|
|
29
|
+
from packman import molecule
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Atom():
|
|
33
|
+
"""This class contains the information about the 'Atom' object (packman.molecule.Atom).
|
|
34
|
+
|
|
35
|
+
This class contains all the information available about the Atom. The Atom class is the lowest in the hierarchy of the 'molecule' API classes.
|
|
36
|
+
the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
|
|
37
|
+
Please read the Tutorials and Documentation for more details.
|
|
38
|
+
|
|
39
|
+
Note:
|
|
40
|
+
- Most essential class of all as it stores the actual data of the atoms.
|
|
41
|
+
- Please refer to the [https://web.archive.org/web/20080905024351/http://www.wwpdb.org/docs.html] for the description of the arguments.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
id (int): Atom ID from the PDB file as it is. Each Atom in a PDB file Model/Frame has unique ID. (essential)
|
|
45
|
+
AtomName (str): Atom Name from the PDB file as it is.
|
|
46
|
+
Coordinates (numpy.array): The 3*1 array of coordinates/location of the atoms. (essential)
|
|
47
|
+
Occupancy (float): The value of the occupancy.
|
|
48
|
+
bfactor (float): The B-factor/Temperature Factor/ Debye Waller Factor of the atom. (For NMR structures, it is RMSF accross the frames)
|
|
49
|
+
Element (str): Element information of the given 'Atom' object. (Element from the Periodic Table)
|
|
50
|
+
Charge (float): Charnge of the given 'Atom' object.
|
|
51
|
+
parent (packman.molecule.Residue): The Residue Object (parent) this atom belongs to.
|
|
52
|
+
AlternateLocationIndicator (bool): If the alternate location available for the atom (To be removed in future)
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
def __init__(self,id,AtomName,Coordinates,Occupancy,bfactor,Element,Charge,parent):
|
|
56
|
+
self.__id=id
|
|
57
|
+
self.__AtomName=AtomName
|
|
58
|
+
self.__AlternateLocationIndicator=None #remove it later
|
|
59
|
+
self.__parent=parent
|
|
60
|
+
self.__Coordinates=Coordinates
|
|
61
|
+
self.__Occupancy=Occupancy
|
|
62
|
+
self.__bfactor=bfactor
|
|
63
|
+
self.__SegmentIdentifier=None
|
|
64
|
+
self.__Element=Element
|
|
65
|
+
self.__Charge=Charge
|
|
66
|
+
|
|
67
|
+
#Properties are the entities that are not included in the PDB files and are obtained by calculations
|
|
68
|
+
self.__properties = {}
|
|
69
|
+
self.__Bonds = []
|
|
70
|
+
|
|
71
|
+
#Get Functions
|
|
72
|
+
def get_id(self):
|
|
73
|
+
"""Get the ID of the 'Atom'
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
int if successful, None otherwise.
|
|
77
|
+
"""
|
|
78
|
+
return self.__id
|
|
79
|
+
|
|
80
|
+
def get_name(self):
|
|
81
|
+
"""Get the Name of the 'Atom'
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
str if successful, None otherwise.
|
|
85
|
+
"""
|
|
86
|
+
return self.__AtomName
|
|
87
|
+
|
|
88
|
+
def get_alternatelocationindicator(self):
|
|
89
|
+
"""Know if the given 'Atom' has Alternate Location Information
|
|
90
|
+
|
|
91
|
+
Note:
|
|
92
|
+
This feature might be removed in the future.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
True if successful, False otherwise.
|
|
96
|
+
"""
|
|
97
|
+
return self.__AlternateLocationIndicator
|
|
98
|
+
|
|
99
|
+
def get_parent(self):
|
|
100
|
+
"""Get the 'Residue' the given 'Atom' belongs to.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
packman.molecule.Residue if successful, None otherwise.
|
|
104
|
+
"""
|
|
105
|
+
return self.__parent
|
|
106
|
+
|
|
107
|
+
def get_location(self):
|
|
108
|
+
"""Get the Coordinates/Location of the given 'Atom'
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
numpy.array if successful, None otherwise.
|
|
112
|
+
"""
|
|
113
|
+
return self.__Coordinates
|
|
114
|
+
|
|
115
|
+
def get_occupancy(self):
|
|
116
|
+
"""Get the Occupancy of the given 'Atom'
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
float if successful, None otherwise.
|
|
120
|
+
"""
|
|
121
|
+
return self.__Occupancy
|
|
122
|
+
|
|
123
|
+
def get_bfactor(self):
|
|
124
|
+
"""Get the B-factor/Temperature Factor/ Debye Waller Factor of the given 'Atom'
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
float if successful, None otherwise.
|
|
128
|
+
"""
|
|
129
|
+
return self.__bfactor
|
|
130
|
+
|
|
131
|
+
def get_segmentidentifier(self):
|
|
132
|
+
"""Get the Segment Identifier of the given 'Atom'
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
str if successful, None otherwise.
|
|
136
|
+
"""
|
|
137
|
+
return self.__SegmentIdentifier
|
|
138
|
+
|
|
139
|
+
def get_element(self):
|
|
140
|
+
"""Get the Element of the given 'Atom'
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
str if successful, None otherwise.
|
|
144
|
+
"""
|
|
145
|
+
return self.__Element
|
|
146
|
+
|
|
147
|
+
def get_charge(self):
|
|
148
|
+
"""Get the Charge of the given 'Atom'
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
str if successful, None otherwise.
|
|
152
|
+
"""
|
|
153
|
+
return self.__Charge
|
|
154
|
+
|
|
155
|
+
def get_domain_id(self):
|
|
156
|
+
"""Get the Domain Identifier of the given 'Atom'. Hinge Prediction is Necessary for this option.
|
|
157
|
+
|
|
158
|
+
Note:
|
|
159
|
+
Domain Identifiers (Obtained after running PACKMAN):
|
|
160
|
+
'FL': Flexible Linkers (Hinges); Followed by the domain number
|
|
161
|
+
'DM': Domain; Followed by the domain number
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
str if successful, None otherwise.
|
|
165
|
+
"""
|
|
166
|
+
return self.get_parent().get_domain_id()
|
|
167
|
+
|
|
168
|
+
def get_property(self,property_name):
|
|
169
|
+
"""Get the Property of the given 'Atom'.
|
|
170
|
+
|
|
171
|
+
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.
|
|
172
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
176
|
+
|
|
177
|
+
Note:
|
|
178
|
+
- Users can add custom annotations; for example: If particular chain becomes disordered, it can be annotated with this feature.
|
|
179
|
+
"""
|
|
180
|
+
try:
|
|
181
|
+
return self.__properties[property_name]
|
|
182
|
+
except:
|
|
183
|
+
logging.warning('The Property Name provided is not assigned.')
|
|
184
|
+
|
|
185
|
+
def get_bonds(self):
|
|
186
|
+
"""Get the bonds for the given 'Atom'
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
list of packman.molecule.Bond if successful; [] otherwise.
|
|
190
|
+
"""
|
|
191
|
+
return self.__Bonds
|
|
192
|
+
|
|
193
|
+
def get_bond(self,atom2):
|
|
194
|
+
"""Get the specific bond with the specific atom.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
atom2 (packman.molecule.Atom/ int) : 'Atom' object or the atom id.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
Bond (packman.molecule.Bond) if successful, None if bond does not exist.
|
|
201
|
+
"""
|
|
202
|
+
if(type(atom2) == type(self)):
|
|
203
|
+
None
|
|
204
|
+
elif(type(atom2) ==int):
|
|
205
|
+
Model = self.get_parent().get_parent().get_parent()
|
|
206
|
+
atom2 = Model.get_atom(atom2)
|
|
207
|
+
else:
|
|
208
|
+
logging.warning('The atom2 parameter should either be an integer (atom id) or a packman.molecule.Atom object.')
|
|
209
|
+
|
|
210
|
+
return list(set(self.get_bonds()).intersection( atom2.get_bonds() ))[0]
|
|
211
|
+
|
|
212
|
+
#Set Functions
|
|
213
|
+
def set_id(self,new_id):
|
|
214
|
+
"""Set the ID of the given 'Atom'
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
new_id (int): The ID User wishes to assign to the given 'Atom'
|
|
218
|
+
"""
|
|
219
|
+
self.__id=new_id
|
|
220
|
+
|
|
221
|
+
def set_name(self,new_name):
|
|
222
|
+
"""Set the Name of the given 'Atom'
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
new_name (str): The Name User wishes to assign to the given 'Atom'
|
|
226
|
+
"""
|
|
227
|
+
self.__AtomName=new_name
|
|
228
|
+
|
|
229
|
+
def set_alternatelocationindicator(self,new_alternatelocationindicator):
|
|
230
|
+
"""Set the Alternate Location Indicator of the given 'Atom'
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
new_alternatelocationindicator: The Alternate Location Indicator User wishes to assign to the given 'Atom'
|
|
234
|
+
"""
|
|
235
|
+
self.__AlternateLocationIndicator=new_alternatelocationindicator
|
|
236
|
+
|
|
237
|
+
def set_parent(self,new_parent):
|
|
238
|
+
"""Set the Parent 'Residue' of the given 'Atom'
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
new_parent (packman.molecule.residue.Residue): The parent 'Residue' User wishes to assign to the given 'Atom'
|
|
242
|
+
"""
|
|
243
|
+
self.__parent=new_parent
|
|
244
|
+
|
|
245
|
+
def set_location(self,new_location):
|
|
246
|
+
"""Set the Coordinates/Location of the given 'Atom'
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
new_location (numpy.array): The Coordinates/Location User wishes to assign to the given 'Atom'
|
|
250
|
+
"""
|
|
251
|
+
self.__Coordinates=new_location
|
|
252
|
+
|
|
253
|
+
def set_occupancy(self,new_occupancy):
|
|
254
|
+
"""Set the Occupancy of the given 'Atom'
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
new_occupancy: The Occupancy User wishes to assign to the given 'Atom'
|
|
258
|
+
"""
|
|
259
|
+
self.__Occupancy=new_occupancy
|
|
260
|
+
|
|
261
|
+
def set_bfactor(self,new_bfactor):
|
|
262
|
+
"""Set the B-factor/Temperature Factor/ Debye Waller Factor of the given 'Atom'
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
new_bfactor (float): The B-factor/Temperature Factor/ Debye Waller Factor User wishes to assign to the given 'Atom'
|
|
266
|
+
"""
|
|
267
|
+
self.__bfactor=new_bfactor
|
|
268
|
+
|
|
269
|
+
def set_segmentidentifier(self,new_segmentidentifier):
|
|
270
|
+
"""Set the Segment Identifier of the given 'Atom'
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
new_segmentidentifier (str): The Segment Identifier User wishes to assign to the given 'Atom'
|
|
274
|
+
"""
|
|
275
|
+
self.__SegmentIdentifier=new_segmentidentifier
|
|
276
|
+
|
|
277
|
+
def set_elment(self,new_element):
|
|
278
|
+
"""Set the Element of the given 'Atom'
|
|
279
|
+
|
|
280
|
+
Args:
|
|
281
|
+
new_element (str): The Element User wishes to assign to the given 'Atom'
|
|
282
|
+
"""
|
|
283
|
+
self.__Element=new_element
|
|
284
|
+
|
|
285
|
+
def set_charge(self,new_charge):
|
|
286
|
+
"""Set the Charge of the given 'Atom'
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
new_charge (str): The Charge User wishes to assign to the given 'Atom'
|
|
290
|
+
"""
|
|
291
|
+
self.__Charge=new_charge
|
|
292
|
+
|
|
293
|
+
def set_property(self,property_name,value):
|
|
294
|
+
"""Set the Property of the given 'Atom'.
|
|
295
|
+
|
|
296
|
+
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.
|
|
297
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
298
|
+
|
|
299
|
+
Args:
|
|
300
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
301
|
+
value (object): The value the user wants to assign to the property
|
|
302
|
+
|
|
303
|
+
Note:
|
|
304
|
+
- Users can add custom annotations; for example: If particular amino acid becomes disordered, it can be annotated with this feature.
|
|
305
|
+
"""
|
|
306
|
+
try:
|
|
307
|
+
self.__properties[property_name] = value
|
|
308
|
+
except:
|
|
309
|
+
logging.warning('Please check the property name. Check the allowed Python dictionary key types for more details.')
|
|
310
|
+
|
|
311
|
+
def set_bond(self,new_bond):
|
|
312
|
+
"""Set the atom to the given 'Atom'
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
new_bond (packman.molecule.Bond) : Add new bond to the given 'Atom'
|
|
316
|
+
|
|
317
|
+
Note:
|
|
318
|
+
- Yet to add the functionality to delete the specific bonds.
|
|
319
|
+
"""
|
|
320
|
+
self.__Bonds.append(new_bond)
|
|
321
|
+
|
|
322
|
+
#Calculation Functions
|
|
323
|
+
def calculate_distance(self,another_atom):
|
|
324
|
+
"""Calculate the Distance between the given 'Atom' and another 'Atom'
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
another_atom (packman.molecule.atom.Atom): The 'Atom' User wishes to calculate distance from.
|
|
328
|
+
|
|
329
|
+
Returns:
|
|
330
|
+
float if successful, None otherwise.
|
|
331
|
+
"""
|
|
332
|
+
return numpy.linalg.norm(self.__Coordinates-another_atom.get_location())
|