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.
Files changed (90) hide show
  1. Program Files/Python39/Lib/site-packages/packman/__init__.py +18 -0
  2. Program Files/Python39/Lib/site-packages/packman/__main__.py +4 -0
  3. Program Files/Python39/Lib/site-packages/packman/__pycache__/__init__.cpython-39.pyc +0 -0
  4. Program Files/Python39/Lib/site-packages/packman/__pycache__/__main__.cpython-39.pyc +0 -0
  5. Program Files/Python39/Lib/site-packages/packman/anm/__init__.py +25 -0
  6. Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/__init__.cpython-39.pyc +0 -0
  7. Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/anm.cpython-39.pyc +0 -0
  8. Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/hd_anm.cpython-39.pyc +0 -0
  9. Program Files/Python39/Lib/site-packages/packman/anm/anm.py +317 -0
  10. Program Files/Python39/Lib/site-packages/packman/anm/hd_anm.py +656 -0
  11. Program Files/Python39/Lib/site-packages/packman/apps/__init__.py +25 -0
  12. Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/__init__.cpython-39.pyc +0 -0
  13. Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/calculate_entropy.cpython-39.pyc +0 -0
  14. Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/dci.cpython-39.pyc +0 -0
  15. Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/hdanm.cpython-39.pyc +0 -0
  16. Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/predict_hinge.cpython-39.pyc +0 -0
  17. Program Files/Python39/Lib/site-packages/packman/apps/calculate_entropy.py +60 -0
  18. Program Files/Python39/Lib/site-packages/packman/apps/dci.py +323 -0
  19. Program Files/Python39/Lib/site-packages/packman/apps/hdanm.py +47 -0
  20. Program Files/Python39/Lib/site-packages/packman/apps/predict_hinge.py +375 -0
  21. Program Files/Python39/Lib/site-packages/packman/bin/GUI.py +709 -0
  22. Program Files/Python39/Lib/site-packages/packman/bin/PACKMAN.py +154 -0
  23. Program Files/Python39/Lib/site-packages/packman/bin/__init__.py +27 -0
  24. Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/GUI.cpython-39.pyc +0 -0
  25. Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/PACKMAN.cpython-39.pyc +0 -0
  26. Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/__init__.cpython-39.pyc +0 -0
  27. Program Files/Python39/Lib/site-packages/packman/bin/logo.ico +0 -0
  28. Program Files/Python39/Lib/site-packages/packman/constants/Constants.py +236 -0
  29. Program Files/Python39/Lib/site-packages/packman/constants/__init__.py +3 -0
  30. Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/Constants.cpython-39.pyc +0 -0
  31. Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/__init__.cpython-39.pyc +0 -0
  32. Program Files/Python39/Lib/site-packages/packman/entropy/__init__.py +12 -0
  33. Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
  34. Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/entropy.cpython-39.pyc +0 -0
  35. Program Files/Python39/Lib/site-packages/packman/entropy/entropy.py +155 -0
  36. Program Files/Python39/Lib/site-packages/packman/geometry/__init__.py +17 -0
  37. Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/__init__.cpython-39.pyc +0 -0
  38. Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/geometry.cpython-39.pyc +0 -0
  39. Program Files/Python39/Lib/site-packages/packman/geometry/geometry.py +112 -0
  40. Program Files/Python39/Lib/site-packages/packman/molecule/__init__.py +45 -0
  41. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
  42. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/annotations.cpython-39.pyc +0 -0
  43. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/atom.cpython-39.pyc +0 -0
  44. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/bond.cpython-39.pyc +0 -0
  45. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/chain.cpython-39.pyc +0 -0
  46. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/hetmol.cpython-39.pyc +0 -0
  47. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/model.cpython-39.pyc +0 -0
  48. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/molecule.cpython-39.pyc +0 -0
  49. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/protein.cpython-39.pyc +0 -0
  50. Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/residue.cpython-39.pyc +0 -0
  51. Program Files/Python39/Lib/site-packages/packman/molecule/annotations.py +92 -0
  52. Program Files/Python39/Lib/site-packages/packman/molecule/atom.py +332 -0
  53. Program Files/Python39/Lib/site-packages/packman/molecule/bond.py +186 -0
  54. Program Files/Python39/Lib/site-packages/packman/molecule/chain.py +323 -0
  55. Program Files/Python39/Lib/site-packages/packman/molecule/hetmol.py +224 -0
  56. Program Files/Python39/Lib/site-packages/packman/molecule/model.py +703 -0
  57. Program Files/Python39/Lib/site-packages/packman/molecule/molecule.py +470 -0
  58. Program Files/Python39/Lib/site-packages/packman/molecule/protein.py +162 -0
  59. Program Files/Python39/Lib/site-packages/packman/molecule/residue.py +322 -0
  60. Program Files/Python39/Lib/site-packages/packman/tests/__init__.py +4 -0
  61. Program Files/Python39/Lib/site-packages/packman/tests/__pycache__/__init__.cpython-39.pyc +0 -0
  62. Program Files/Python39/Lib/site-packages/packman/tests/anm/__init__.py +0 -0
  63. Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/__init__.cpython-39.pyc +0 -0
  64. Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/test_anm.cpython-39.pyc +0 -0
  65. Program Files/Python39/Lib/site-packages/packman/tests/anm/test_anm.py +52 -0
  66. Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.hng +3 -0
  67. Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.pdb +1871 -0
  68. Program Files/Python39/Lib/site-packages/packman/tests/data/4hla.cif +5058 -0
  69. Program Files/Python39/Lib/site-packages/packman/tests/data/__init__.py +0 -0
  70. Program Files/Python39/Lib/site-packages/packman/tests/data/__pycache__/__init__.cpython-39.pyc +0 -0
  71. Program Files/Python39/Lib/site-packages/packman/tests/entropy/__init__.py +0 -0
  72. Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
  73. Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/test_entropy.cpython-39.pyc +0 -0
  74. Program Files/Python39/Lib/site-packages/packman/tests/entropy/test_entropy.py +30 -0
  75. Program Files/Python39/Lib/site-packages/packman/tests/molecule/__init__.py +0 -0
  76. Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
  77. Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/test_molecule.cpython-39.pyc +0 -0
  78. Program Files/Python39/Lib/site-packages/packman/tests/molecule/test_molecule.py +95 -0
  79. Program Files/Python39/Lib/site-packages/packman/utilities/__init__.py +1 -0
  80. Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/__init__.cpython-39.pyc +0 -0
  81. Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/utilities.cpython-39.pyc +0 -0
  82. Program Files/Python39/Lib/site-packages/packman/utilities/utilities.py +180 -0
  83. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/PKG-INFO +86 -0
  84. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/SOURCES.txt +51 -0
  85. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/dependency_links.txt +1 -0
  86. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/entry_points.txt +3 -0
  87. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/requires.txt +5 -0
  88. Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/top_level.txt +1 -0
  89. Program Files/Python39/Scripts/packman-script.py +33 -0
  90. Program Files/Python39/Scripts/packman.exe +0 -0
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env python
2
+ """The PACKMAN Command-line Interface (CLI)
3
+
4
+ How to use::
5
+ python -m packman gui #(For GUI)
6
+ python -m packman #(For CLI)
7
+
8
+ Authors:
9
+ * Pranav Khade(https://github.com/Pranavkhade)
10
+ """
11
+ import numpy
12
+
13
+ import traceback
14
+ import logging
15
+
16
+ from .. import molecule
17
+ from ..apps import hinge_cli, hdanm_cli, entropy_cli, dci_cli
18
+
19
+ import operator
20
+ import argparse
21
+ import os
22
+ import sys
23
+
24
+ '''
25
+ ##################################################################################################
26
+ # Interface #
27
+ ##################################################################################################
28
+ '''
29
+
30
+ def IO():
31
+ """User interface for the user to provide the parameters
32
+
33
+ Todo:
34
+ * Make sure iterative alpha shape search over the values are accomodated in this interface
35
+
36
+ Returns:
37
+ Namespace: Various arguments in various formats
38
+ """
39
+ parser=argparse.ArgumentParser(description='PACKMAN: PACKing and Motion ANalysis. (https://github.com/Pranavkhade/PACKMAN)\n\nFollowing Apps Available: \n1. hinge \n2. hdanm\n3. entropy\n4. dci\n\nHow to run an app: python -m packman <app name>\nExample: python -m packman hinge', formatter_class=argparse.RawTextHelpFormatter )
40
+ subparsers = parser.add_subparsers(dest='command')
41
+
42
+ #Hinge Prediction
43
+ hinge_app_io = subparsers.add_parser('hinge')
44
+ hinge_app_io.add_argument('-pdbid','--pdbid', metavar='PDB_ID', type=str, help='If provided, the PBD with this ID will be downloaded and saved to FILENAME.')
45
+ hinge_app_io.add_argument('alpha', metavar='AlphaValue', help='Recommended: 2.8 for closed; 4.5 for open form, Please refer to the paper for more details')
46
+ hinge_app_io.add_argument('filename', metavar='FILENAME', help='Path and filename of the PDB file.')
47
+ hinge_app_io.add_argument('--e_clusters',metavar='NumberOfEccentricityClusters',type=int,default=4,help='Recommended: 4, Please refer to the paper for more details')
48
+ hinge_app_io.add_argument('--minhnglen',metavar='MinimumHingeLength',type=int,default=5,help='Recommended: 5, Please refer to the paper for more details')
49
+ hinge_app_io.add_argument("--chain", help='Enter The Chain ID')
50
+ hinge_app_io.add_argument('--generateobj', type=argparse.FileType('wb', 0), help='Path and filename to save the .obj file at. Ignored unless --chain is provided.')
51
+
52
+ #hdanm
53
+ hd_anm_io = subparsers.add_parser('hdanm')
54
+ hd_anm_io.add_argument('-pdbid','--pdbid', metavar='PDB_ID', type=str, help='If provided, the PBD with this ID will be downloaded and saved to FILENAME.')
55
+ hd_anm_io.add_argument('filename', metavar='FILENAME', help='Path and filename of the PDB file.')
56
+ hd_anm_io.add_argument('hngfile', metavar='HNG', help='Path and filename of the corresponding HNG file.')
57
+ hd_anm_io.add_argument("--chain", help='Enter The Chain ID')
58
+ hd_anm_io.add_argument("--dr", type=float, default=15, help='Distance cutoff for the ANM.')
59
+ hd_anm_io.add_argument("--power", type=float, default=0, help='Power of the distance in non-parametric ANM.')
60
+ hd_anm_io.add_argument("--mass", default='residue', help='Mass of the residue; unit or molecular weight')
61
+ hd_anm_io.add_argument("--scale", type=int, default=2, help='movie scale')
62
+ hd_anm_io.add_argument("--frames", type=int, default=10, help='number of frames')
63
+ hd_anm_io.add_argument("--modes", type=int, default=10, help='how many modes')
64
+ hd_anm_io.add_argument("--make_tar", action='store_true', help='package output files into a tar.gz file')
65
+
66
+ #Entropy
67
+ entropy_app_io = subparsers.add_parser('entropy')
68
+ entropy_app_io.add_argument('-type','--type', metavar='entropy_type', type=str, help='Provide the Entropy type (Options: 1. PackingEntropy)')
69
+ entropy_app_io.add_argument('-pdbid','--pdbid', metavar='PDB_ID', type=str, help='If provided, the PBD with this ID will be downloaded and saved to FILENAME.')
70
+ entropy_app_io.add_argument('filename', metavar='FILENAME', help='Path and filename of the PDB file.')
71
+ entropy_app_io.add_argument('--chains',metavar='Chains to be used for the entropy calculation',type=str,default=None, help='Recommended: None. Chain IDs for the Entropy calculation (None means all the chains are included; single string means only one chain ID; multiple chains should be comma separated).')
72
+ entropy_app_io.add_argument('--probe_size',metavar='Size surface probe radius',type=float,default=1.4, help='Recommended: 1.4 (radius of a water molecule), Please refer to the paper for more details')
73
+ entropy_app_io.add_argument('--onspherepoints',metavar='Number of points on a sphere',type=int,default=30, help='Recommended: 30. Number of points to be generated around each point for the surface (Read the Publication for more details)')
74
+
75
+ #DCI
76
+ dci_app_io = subparsers.add_parser('dci')
77
+ dci_app_io.add_argument('-pdbid','--pdbid', metavar='PDB_ID', type=str, help='If provided, the PBD with this ID will be downloaded and saved to FILENAME.')
78
+ dci_app_io.add_argument('filename', metavar='FILENAME', help='Path and filename of the PDB file.')
79
+ dci_app_io.add_argument('-chain','--chain', help='Enter The Chain ID', default=None)
80
+ dci_app_io.add_argument('-cutoff','--cutoff', type=float, help='Enter the cutoff for DCI. (Read the Publication for more details)', default=7.0)
81
+ dci_app_io.add_argument('-n_com','--n_com', type=int, help='Enter the number of communities. (Read the Publication for more details)', default=None)
82
+
83
+ # web server parameters
84
+ web_server_group = parser.add_argument_group('Web server parameters', 'Used by the web form')
85
+ web_server_group.add_argument('--outputfile', type=argparse.FileType('w', 1), default=sys.stdout, help='Path and filename write output to')
86
+ web_server_group.add_argument('--logfile', type=argparse.FileType('w', 1), default=sys.stderr, help='Path and filename write log messages to')
87
+
88
+ args=parser.parse_args()
89
+ return args
90
+
91
+ '''
92
+ ##################################################################################################
93
+ # CLI #
94
+ ##################################################################################################
95
+ '''
96
+
97
+ def load_cli():
98
+ """Main Function for PACKMAN.
99
+
100
+ Kernel of the PACKMAN interface.
101
+
102
+ Todo:
103
+ * Change the main() to accomodate iterative alpha shape search
104
+
105
+ """
106
+ args=IO()
107
+
108
+ if(args.command==None):
109
+ logging.error('Please provide the appropriate input. Enter "python -m packman -h" for more details.')
110
+ exit()
111
+
112
+ logging.basicConfig(stream=args.logfile)
113
+
114
+ if(args.pdbid is not None):
115
+ molecule.download_structure(args.pdbid, save_name=args.filename.split('.')[0], ftype=args.filename.split('.')[1])
116
+
117
+ try:
118
+ extension = args.filename.split('.')[-1]
119
+ mol = molecule.load_structure(args.filename,ftype=extension)
120
+ except:
121
+ logging.warning("The filename provided does not appear to have a format extension.")
122
+ mol = molecule.load_structure(args.filename)
123
+
124
+ if(args.command == 'hinge'):
125
+ hinge_cli(args,mol)
126
+ elif(args.command == 'hdanm'):
127
+ hdanm_cli(args,mol)
128
+ elif(args.command == 'entropy'):
129
+ entropy_cli(args,mol)
130
+ elif(args.command == 'dci'):
131
+ dci_cli(args,mol)
132
+
133
+ return True
134
+
135
+
136
+ '''
137
+ ##################################################################################################
138
+ # Main #
139
+ ##################################################################################################
140
+ '''
141
+
142
+
143
+ def main():
144
+ """Gatewayto CLI and GUI
145
+ """
146
+ if(len(sys.argv) > 1 and sys.argv[1] == "gui"):
147
+ from .GUI import load_gui
148
+ load_gui()
149
+ else:
150
+ load_cli()
151
+
152
+
153
+ if(__name__ == '__main__'):
154
+ main()
@@ -0,0 +1,27 @@
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.bin' is a collection of binaries built on packman.molecule API.
6
+
7
+ Notes:
8
+ * Current binary list: - PACKMAN.py : A program to predict the hinge on the molecule given the atoms and relevent parameters
9
+
10
+ Example:
11
+
12
+ packman -h
13
+
14
+ OR
15
+
16
+ python3 -m packman -h
17
+
18
+ Todo:
19
+ * Add new features
20
+ * Use ``sphinx.ext.todo`` extension
21
+ * Clean the code
22
+ * Redesign print statements
23
+ * Add Tutorial Link
24
+
25
+ """
26
+
27
+ from .PACKMAN import main
@@ -0,0 +1,236 @@
1
+
2
+
3
+ #Amino Acid molecular weight
4
+ amino_acid_molecular_weight={
5
+ 'ALA':89.1,
6
+ 'ARG':174.2,
7
+ 'ASN':132.1,
8
+ 'ASP':133.1,
9
+ 'CYS':121.2,
10
+ 'GLU':147.1,
11
+ 'GLN':146.2,
12
+ 'GLY':75.1,
13
+ 'HIS':155.2,
14
+ 'ILE':131.2,
15
+ 'LEU':131.2,
16
+ 'LYS':146.2,
17
+ 'MET':149.2,
18
+ 'PHE':165.2,
19
+ 'PRO':115.1,
20
+ 'SER':105.1,
21
+ 'THR':119.1,
22
+ 'TRP':204.2,
23
+ 'TYR':181.2,
24
+ 'VAL':117.1
25
+ }
26
+
27
+ #Possibly will be replaced by periodic table library
28
+ atomic_weight={
29
+ 'H':1.00784,
30
+ 'He':4.002602,
31
+ 'Li':6.938,
32
+ 'Be':9.0121831,
33
+ 'B':10.806,
34
+ 'C':12.0096,
35
+ 'N':14.00643,
36
+ 'O':15.99903,
37
+ 'F':18.998403163,
38
+ 'Ne':20.1797,
39
+ 'Na':22.98976928,
40
+ 'Mg':24.304,
41
+ 'Al':26.9815384,
42
+ 'Si':28.084,
43
+ 'P':30.973761998,
44
+ 'S':32.059,
45
+ 'Cl':35.446,
46
+ 'Ar':39.792,
47
+ 'K':39.0983,
48
+ 'Ca':40.078,
49
+ 'Sc':44.955908,
50
+ 'Ti':47.867,
51
+ 'V':50.9415,
52
+ 'Cr':51.9961,
53
+ 'Mn':54.938043,
54
+ 'Fe':55.845,
55
+ 'Co':58.933194,
56
+ 'Ni':58.6934,
57
+ 'Cu':63.546,
58
+ 'Zn':65.38,
59
+ 'Ga':69.723,
60
+ 'Ge':72.630,
61
+ 'As':74.921595,
62
+ 'Se':78.971,
63
+ 'Br':79.901,
64
+ 'Kr':83.798,
65
+ 'Rb':85.4678,
66
+ 'Sr':87.62,
67
+ 'Y':88.90584,
68
+ 'Zr':91.224,
69
+ 'Nb':92.90637,
70
+ 'Mo':95.95,
71
+ 'Ru':101.07,
72
+ 'Rh':102.90549,
73
+ 'Pd':106.42,
74
+ 'Ag':107.8682,
75
+ 'Cd':112.414,
76
+ 'In':114.818,
77
+ 'Sn':118.710,
78
+ 'Sb':121.760,
79
+ 'Te':127.60,
80
+ 'I':126.90447,
81
+ 'Xe':131.293,
82
+ 'Cs':132.90545196,
83
+ 'Ba':137.327,
84
+ 'La':138.90547,
85
+ 'Ce':140.116,
86
+ 'Pr':140.90766,
87
+ 'Nd':144.242,
88
+ 'Sm':150.36,
89
+ 'Eu':151.964,
90
+ 'Gd':157.25,
91
+ 'Tb':158.925354,
92
+ 'Dy':162.500,
93
+ 'Ho':164.930328,
94
+ 'Er':167.259,
95
+ 'Tm':168.934218,
96
+ 'Yb':173.045,
97
+ 'Lu':174.9668,
98
+ 'Hf':178.486,
99
+ 'Ta':180.94788,
100
+ 'W':183.84,
101
+ 'Re':186.207,
102
+ 'Os':190.23,
103
+ 'Ir':192.217,
104
+ 'Pt':195.084,
105
+ 'Au':196.966570,
106
+ 'Hg':200.592,
107
+ 'Tl':204.382,
108
+ 'Pb':207.2,
109
+ 'Bi':208.98040,
110
+ 'Th':232.0377,
111
+ 'Pa':231.03588,
112
+ 'U':238.02891,
113
+ }
114
+
115
+
116
+ #van der Waals Volumes and Radii, A. Bondi, The Journal of Physical Chemistry 1964 68 (3), 441-451, DOI: 10.1021/j100785a001
117
+ vdw_surface_bondi={
118
+ 'H':1.2,
119
+ 'He':1.4,
120
+ 'Li':1.81,
121
+ 'Be':None,
122
+ 'B':None,
123
+ 'C':1.7,
124
+ 'N':1.55,
125
+ 'O':1.52,
126
+ 'F':1.47,
127
+ 'Ne':1.54,
128
+ 'Na':2.27,
129
+ 'Mg':1.73,
130
+ 'Al':None,
131
+ 'Si':2.1,
132
+ 'P':1.8,
133
+ 'S':1.8,
134
+ 'Cl':1.75,
135
+ 'Ar':1.88,
136
+ 'K':2.75,
137
+ 'Ca':None,
138
+ 'Sc':None,
139
+ 'Ti':None,
140
+ 'V':None,
141
+ 'Cr':None,
142
+ 'Mn':None,
143
+ 'Fe':None,
144
+ 'Co':None,
145
+ 'Ni':None,
146
+ 'Cu':None,
147
+ 'Zn':None,
148
+ 'Ga':1.87,
149
+ 'Ge':None,
150
+ 'As':1.85,
151
+ 'Se':1.9,
152
+ 'Br':1.83,
153
+ 'Kr':2.02,
154
+ 'Rb':None,
155
+ 'Sr':None,
156
+ 'Y':None,
157
+ 'Zr':None,
158
+ 'Nb':None,
159
+ 'Mo':None,
160
+ 'Tc':None,
161
+ 'Ru':None,
162
+ 'Rh':None,
163
+ 'Pd':None,
164
+ 'Ag':None,
165
+ 'Cd':None,
166
+ 'In':1.93,
167
+ 'Sn':2.17,
168
+ 'Sb':None,
169
+ 'Te':2.06,
170
+ 'I':1.98,
171
+ 'Xe':2.16,
172
+ 'Cs':None,
173
+ 'Ba':None,
174
+ 'La':None,
175
+ 'Ce':None,
176
+ 'Pr':None,
177
+ 'Nd':None,
178
+ 'Pm':None,
179
+ 'Sm':None,
180
+ 'Eu':None,
181
+ 'Gd':None,
182
+ 'Tb':None,
183
+ 'Dy':None,
184
+ 'Ho':None,
185
+ 'Er':None,
186
+ 'Tm':None,
187
+ 'Yb':None,
188
+ 'Lu':None,
189
+ 'Hf':None,
190
+ 'Ta':None,
191
+ 'W':None,
192
+ 'Re':None,
193
+ 'Os':None,
194
+ 'Ir':None,
195
+ 'Pt':None,
196
+ 'Au':None,
197
+ 'Hg':None,
198
+ 'Tl':1.96,
199
+ 'Pb':2.02,
200
+ 'Bi':None,
201
+ 'Po':None,
202
+ 'At':None,
203
+ 'Rn':None,
204
+ 'Fr':None,
205
+ 'Ra':None,
206
+ 'Ac':None,
207
+ 'Th':None,
208
+ 'Pa':None,
209
+ 'U':None,
210
+ 'Np':None,
211
+ 'Pu':None,
212
+ 'Am':None,
213
+ 'Cm':None,
214
+ 'Bk':None,
215
+ 'Cf':None,
216
+ 'Es':None,
217
+ 'Fm':None,
218
+ 'Md':None,
219
+ 'No':None,
220
+ 'Lr':None,
221
+ 'Rf':None,
222
+ 'Db':None,
223
+ 'Sg':None,
224
+ 'Bh':None,
225
+ 'Hs':None,
226
+ 'Mt':None,
227
+ 'Ds':None,
228
+ 'Rg':None,
229
+ 'Cn':None,
230
+ 'Nh':None,
231
+ 'Fl':None,
232
+ 'Mc':None,
233
+ 'Lv':None,
234
+ 'Ts':None,
235
+ 'Og':None
236
+ }
@@ -0,0 +1,3 @@
1
+ from .Constants import amino_acid_molecular_weight
2
+ from .Constants import atomic_weight
3
+ from .Constants import vdw_surface_bondi
@@ -0,0 +1,12 @@
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.entropy' module is a collection of entropy methods and applications built on packman.molecule API.
6
+
7
+ Notes:
8
+ * Current apps list: - packman.PackingEntropy
9
+ * Cite the following paper:
10
+
11
+ """
12
+ from .entropy import PackingEntropy
@@ -0,0 +1,155 @@
1
+ # -*- coding: utf-8 -*-
2
+ """The Entropy method(s) 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
+ Example::
8
+
9
+
10
+ Authors:
11
+ * Pranav Khade(https://github.com/Pranavkhade)
12
+ """
13
+ from .. import molecule
14
+ from ..constants import vdw_surface_bondi
15
+
16
+ import numpy
17
+
18
+ import logging
19
+
20
+ from scipy.spatial import Voronoi, ConvexHull, KDTree
21
+ from scipy.constants import R
22
+
23
+ from multiprocessing.dummy import Pool as ThreadPool
24
+
25
+ class PackingEntropy():
26
+ """This class contains all the methods required to obtain a protein complex's entropy.
27
+ Given a group of atoms in the :mod:'packman.molecule.Atom' objects, the entropy for the each amino acid will be returned.
28
+ 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.
29
+ Args:
30
+ atoms ([packman.molecule.Atom]) : The group of atoms user wisher to calculate Packing Entropy with.
31
+ 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).
32
+ 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)
33
+ onspherepoints (int) : Number of points to be generated around each point for the surface (Read the Publication for more details)
34
+ """
35
+ def __init__(self, atoms, chains=None, probe_size=1.4, onspherepoints=30):
36
+ if(chains==None):
37
+ self.atoms = [i for i in atoms]
38
+ else:
39
+ #Single or multiple chain IDs provided. If there are multiple chain ids, they should be in an array form.
40
+ try:
41
+ self.atoms = [i for i in atoms if i.get_parent().get_parent().get_id() in chains]
42
+ except:
43
+ self.atoms = [i for i in atoms if i.get_parent().get_parent().get_id() == chains]
44
+
45
+ self.coordinates=[i.get_location() for i in self.atoms]
46
+ self.probe_size = probe_size
47
+ self.kd_tree = KDTree(self.coordinates)
48
+ self.onspherepoints = onspherepoints
49
+
50
+ self.residues = list(set([i.get_parent() for i in self.atoms]))
51
+
52
+ #Need to be calculated
53
+ self.surface_points = None
54
+
55
+ #Generate Surface Points
56
+ self.calculate_surafacepoints()
57
+
58
+ #Initiate
59
+ self.calculate_entropy()
60
+
61
+ #Get functions
62
+ def get_total_packing_fraction(self):
63
+ """The sum of Packing Fraction for the Residues in the provided atoms.
64
+
65
+ Returns:
66
+ The sum of the Residue Packing Fraction (float)
67
+ """
68
+ return numpy.sum( [i.get_property('PackingFraction') for i in self.residues] )
69
+
70
+ def get_total_entropy(self):
71
+ """The sum of Packing Entropies for the Residues in the provided atoms.
72
+ Returns:
73
+ The sum of Residue Entropies (float)
74
+ """
75
+ return numpy.sum( [i.get_entropy('PackingEntropy') for i in self.residues] )
76
+
77
+ def get_total_chain_entropy(self,chain):
78
+ """The sum of Packing Entropies for the Residues in the provided atoms and chain.
79
+
80
+ Please note that the entropy for the chain you are selecting might not exist if you have not calculated it properly. Please make sure to run calculate_entropy() function properly.
81
+ Args:
82
+ chain (str) : chain ID of for the chain you wish to get the entropy.
83
+ """
84
+ return numpy.sum( [i.get_entropy('PackingEntropy') for i in self.residues if i.get_parent().get_id()==chain] )
85
+
86
+ def get_surafacepoints(self):
87
+ """Get the surface points around the given set of atoms in the protein.
88
+ Returns:
89
+ [[float]]: Array of 3D points around the given set of atoms in the protein.
90
+ """
91
+ return self.surface_points
92
+
93
+ #Calculate Functions
94
+ def calculate_spherepoints(self,atom):
95
+ """Given a single point, this function generates point cloud around the given points.
96
+ Args:
97
+ point ([float]) : 3D coordinate around which the sphere of point cloud to be generated.
98
+ """
99
+ point = atom.get_location()
100
+ indices = numpy.arange(0, self.onspherepoints, dtype=float) + 0.5
101
+ phi = numpy.arccos(1 - 2*indices/self.onspherepoints)
102
+ theta = numpy.pi * (1 + 5**0.5) * indices
103
+ x, y, z = numpy.cos(theta) * numpy.sin(phi), numpy.sin(theta) * numpy.sin(phi), numpy.cos(phi)
104
+ sphere_multiplier = ( self.probe_size + vdw_surface_bondi[atom.get_element()] ) * 2
105
+ x, y, z = sphere_multiplier*x, sphere_multiplier*y, sphere_multiplier*z
106
+ x=x+point[0]
107
+ y=y+point[1]
108
+ z=z+point[2]
109
+ data = zip(x.ravel(), y.ravel(), z.ravel())
110
+ selected=[]
111
+ for _ in data:
112
+ if(self.kd_tree.query(_,k=2)[0][1] > sphere_multiplier):
113
+ selected.append(_)
114
+ return selected
115
+
116
+ def calculate_surafacepoints(self):
117
+ """Calculate the surface points with the current setup.
118
+ """
119
+ pool = ThreadPool()
120
+ surface=pool.map( self.calculate_spherepoints, self.atoms )
121
+ surface=[item for sublist in surface for item in sublist]
122
+ self.surface_points = surface
123
+
124
+ def calculate_entropy(self):
125
+ """Calculate the Packing Entropy with the current setup.
126
+ """
127
+ logging.info("Packing Entropy calculation started.")
128
+
129
+ #All the points (surface+protein)
130
+ points=numpy.concatenate((self.surface_points,[i.get_location() for i in self.atoms]))
131
+ voronoi=Voronoi(points)
132
+
133
+ AvailableVolume = {j:[] for j in set([i.get_parent() for i in self.atoms])}
134
+ for numi, i in enumerate(self.atoms):
135
+ atom_cell=[]
136
+ for j in voronoi.regions[ voronoi.point_region[ numi+len(self.surface_points) ] ]:
137
+ atom_cell.append(voronoi.vertices[j])
138
+ AvailableVolume[i.get_parent()].extend(atom_cell)
139
+
140
+ #Each value= Total volume of voronoi cells of the atoms of the residue / Total volume of the residues (Both convex hull volumes)
141
+ PackingFraction={}
142
+ for i in AvailableVolume:
143
+ PackingFraction[i] = float(ConvexHull([j.get_location() for j in i.get_atoms()]).volume) / ConvexHull(AvailableVolume[i]).volume
144
+
145
+ #R = Gas constant
146
+ for i in PackingFraction:
147
+ #Old Model:
148
+ #ResiduePackingEntropy = R * -PackingFraction[i] * numpy.log2(PackingFraction[i])
149
+ #New Model:
150
+ ResiduePackingEntropy = - R * numpy.log10( PackingFraction[i] )
151
+
152
+ i.set_entropy('PackingEntropy', ResiduePackingEntropy)
153
+ i.set_property('PackingFraction',PackingFraction[i])
154
+
155
+ logging.info("Packing Entropy calculated and assigned to the respective 'Residues' successfully.")
@@ -0,0 +1,17 @@
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.geometry' module is a collection of geometry objects built on packman.molecule API.
6
+
7
+ Tutorials:
8
+
9
+
10
+ Todo:
11
+ * Add new features
12
+ * Use ``sphinx.ext.todo`` extension
13
+ * Add Tutorial Link
14
+ """
15
+
16
+ from .geometry import Circumsphere
17
+ from .geometry import AlphaShape