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,703 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""The 'Model' 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 'Model' 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 Model
|
|
13
|
+
help( Model )
|
|
14
|
+
|
|
15
|
+
Note:
|
|
16
|
+
* The models are nothing but frames of the PDB file.
|
|
17
|
+
|
|
18
|
+
Todo:
|
|
19
|
+
* Finish writing up the documentation.
|
|
20
|
+
* Finish error handling.
|
|
21
|
+
* Finish optimizing the performance.
|
|
22
|
+
|
|
23
|
+
Authors:
|
|
24
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
25
|
+
"""
|
|
26
|
+
#Bond information
|
|
27
|
+
aa_connectivity= {
|
|
28
|
+
'ALA': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'HB1', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
29
|
+
'ARG': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('CD', 'NE', 'SING'), ('CD', 'HD2', 'SING'), ('CD', 'HD3', 'SING'), ('NE', 'CZ', 'SING'), ('NE', 'HE', 'SING'), ('CZ', 'NH1', 'SING'), ('CZ', 'NH2', 'DOUB'), ('NH1', 'HH11', 'SING'), ('NH1', 'HH12', 'SING'), ('NH2', 'HH21', 'SING'), ('NH2', 'HH22', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
30
|
+
'ASN': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'OD1', 'DOUB'), ('CG', 'ND2', 'SING'), ('ND2', 'HD21', 'SING'), ('ND2', 'HD22', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
31
|
+
'ASP': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'OD1', 'DOUB'), ('CG', 'OD2', 'SING'), ('OD2', 'HD2', 'SING'), ('OXT', 'HXT', 'SING'), ('"SYSTEMATIC', 'NAME"', 'ACDLabs')],
|
|
32
|
+
'CYS': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'SG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('SG', 'HG', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
33
|
+
'GLN': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('CD', 'OE1', 'DOUB'), ('CD', 'NE2', 'SING'), ('NE2', 'HE21', 'SING'), ('NE2', 'HE22', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
34
|
+
'GLU': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('CD', 'OE1', 'DOUB'), ('CD', 'OE2', 'SING'), ('OE2', 'HE2', 'SING'), ('OXT', 'HXT', 'SING'), ('"SYSTEMATIC', 'NAME"', 'ACDLabs')],
|
|
35
|
+
'GLY': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'HA2', 'SING'), ('CA', 'HA3', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
36
|
+
'HIS': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'ND1', 'SING'), ('CG', 'CD2', 'DOUB'), ('ND1', 'CE1', 'DOUB'), ('ND1', 'HD1', 'SING'), ('CD2', 'NE2', 'SING'), ('CD2', 'HD2', 'SING'), ('CE1', 'NE2', 'SING'), ('CE1', 'HE1', 'SING'), ('NE2', 'HE2', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
37
|
+
'ILE': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG1', 'SING'), ('CB', 'CG2', 'SING'), ('CB', 'HB', 'SING'), ('CG1', 'CD1', 'SING'), ('CG1', 'HG12', 'SING'), ('CG1', 'HG13', 'SING'), ('CG2', 'HG21', 'SING'), ('CG2', 'HG22', 'SING'), ('CG2', 'HG23', 'SING'), ('CD1', 'HD11', 'SING'), ('CD1', 'HD12', 'SING'), ('CD1', 'HD13', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
38
|
+
'LEU': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD1', 'SING'), ('CG', 'CD2', 'SING'), ('CG', 'HG', 'SING'), ('CD1', 'HD11', 'SING'), ('CD1', 'HD12', 'SING'), ('CD1', 'HD13', 'SING'), ('CD2', 'HD21', 'SING'), ('CD2', 'HD22', 'SING'), ('CD2', 'HD23', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
39
|
+
'LYS': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('CD', 'CE', 'SING'), ('CD', 'HD2', 'SING'), ('CD', 'HD3', 'SING'), ('CE', 'NZ', 'SING'), ('CE', 'HE2', 'SING'), ('CE', 'HE3', 'SING'), ('NZ', 'HZ1', 'SING'), ('NZ', 'HZ2', 'SING'), ('NZ', 'HZ3', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
40
|
+
'MET': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'SD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('SD', 'CE', 'SING'), ('CE', 'HE1', 'SING'), ('CE', 'HE2', 'SING'), ('CE', 'HE3', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
41
|
+
'PHE': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD1', 'DOUB'), ('CG', 'CD2', 'SING'), ('CD1', 'CE1', 'SING'), ('CD1', 'HD1', 'SING'), ('CD2', 'CE2', 'DOUB'), ('CD2', 'HD2', 'SING'), ('CE1', 'CZ', 'DOUB'), ('CE1', 'HE1', 'SING'), ('CE2', 'CZ', 'SING'), ('CE2', 'HE2', 'SING'), ('CZ', 'HZ', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
42
|
+
'PRO': [('N', 'CA', 'SING'), ('N', 'CD', 'SING'), ('N', 'H', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD', 'SING'), ('CG', 'HG2', 'SING'), ('CG', 'HG3', 'SING'), ('CD', 'HD2', 'SING'), ('CD', 'HD3', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
43
|
+
'SER': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'OG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('OG', 'HG', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
44
|
+
'THR': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'OG1', 'SING'), ('CB', 'CG2', 'SING'), ('CB', 'HB', 'SING'), ('OG1', 'HG1', 'SING'), ('CG2', 'HG21', 'SING'), ('CG2', 'HG22', 'SING'), ('CG2', 'HG23', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
45
|
+
'TRP': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD1', 'DOUB'), ('CG', 'CD2', 'SING'), ('CD1', 'NE1', 'SING'), ('CD1', 'HD1', 'SING'), ('CD2', 'CE2', 'DOUB'), ('CD2', 'CE3', 'SING'), ('NE1', 'CE2', 'SING'), ('NE1', 'HE1', 'SING'), ('CE2', 'CZ2', 'SING'), ('CE3', 'CZ3', 'DOUB'), ('CE3', 'HE3', 'SING'), ('CZ2', 'CH2', 'DOUB'), ('CZ2', 'HZ2', 'SING'), ('CZ3', 'CH2', 'SING'), ('CZ3', 'HZ3', 'SING'), ('CH2', 'HH2', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
46
|
+
'TYR': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG', 'SING'), ('CB', 'HB2', 'SING'), ('CB', 'HB3', 'SING'), ('CG', 'CD1', 'DOUB'), ('CG', 'CD2', 'SING'), ('CD1', 'CE1', 'SING'), ('CD1', 'HD1', 'SING'), ('CD2', 'CE2', 'DOUB'), ('CD2', 'HD2', 'SING'), ('CE1', 'CZ', 'DOUB'), ('CE1', 'HE1', 'SING'), ('CE2', 'CZ', 'SING'), ('CE2', 'HE2', 'SING'), ('CZ', 'OH', 'SING'), ('OH', 'HH', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
47
|
+
'VAL': [('N', 'CA', 'SING'), ('N', 'H', 'SING'), ('N', 'H2', 'SING'), ('CA', 'C', 'SING'), ('CA', 'CB', 'SING'), ('CA', 'HA', 'SING'), ('C', 'O', 'DOUB'), ('C', 'OXT', 'SING'), ('CB', 'CG1', 'SING'), ('CB', 'CG2', 'SING'), ('CB', 'HB', 'SING'), ('CG1', 'HG11', 'SING'), ('CG1', 'HG12', 'SING'), ('CG1', 'HG13', 'SING'), ('CG2', 'HG21', 'SING'), ('CG2', 'HG22', 'SING'), ('CG2', 'HG23', 'SING'), ('OXT', 'HXT', 'SING')],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
from ..entropy import PackingEntropy
|
|
51
|
+
from .bond import Bond
|
|
52
|
+
|
|
53
|
+
import numpy
|
|
54
|
+
import logging
|
|
55
|
+
|
|
56
|
+
#Think how the graph can be improved
|
|
57
|
+
from networkx import Graph, bridges, draw, connected_components
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class Model():
|
|
61
|
+
"""This class contains the information about the 'Chain' object (packman.molecule.Chain).
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the 'molecule' module API.
|
|
65
|
+
Please read the Tutorials and Documentation for more details.
|
|
66
|
+
|
|
67
|
+
Notes:
|
|
68
|
+
* Please refer to the [https://web.archive.org/web/20080905024351/http://www.wwpdb.org/docs.html] for the description of the arguments.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
id (int) : Model ID from the PDB file ordered from first to the last. Each Model in a PDB file has unique ID. (essential)
|
|
72
|
+
AllAtoms ({packman.molecule.Atom}) : Dictionary of all the 'Atom' in the given model.
|
|
73
|
+
AllResidues ({packman.molecule.Residue}): Dictionary of all the 'Residue' in the given model.
|
|
74
|
+
AllChains ({packman.molecule.Chain}) : Dictionary of all the 'Chain' in the given model.
|
|
75
|
+
AllHetAtoms ({packman.molecule.HetAtom}): Dictionary of all the 'HetAtom' in the given model.
|
|
76
|
+
AllHetMols ({packman.molecule.HetMol}) : Dictionary of all the 'HetMol' in the given model.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def __init__(self,id,AllAtoms,AllResidues,AllChains,AllHetAtoms,AllHetMols):
|
|
81
|
+
self.__id=id
|
|
82
|
+
self.__AllAtoms=AllAtoms
|
|
83
|
+
self.__AllResidues=AllResidues
|
|
84
|
+
self.__AllChains=AllChains
|
|
85
|
+
self.__AllHetAtoms=AllHetAtoms
|
|
86
|
+
self.__AllHetMols=AllHetMols
|
|
87
|
+
self.__parent = None
|
|
88
|
+
|
|
89
|
+
#Properties are the entities that are not included in the PDB files and are obtained by calculations
|
|
90
|
+
self.__properties = {}
|
|
91
|
+
|
|
92
|
+
def __getitem__(self,ChainID):
|
|
93
|
+
return self.__AllChains[ChainID]
|
|
94
|
+
|
|
95
|
+
#Get Functions
|
|
96
|
+
def get_id(self):
|
|
97
|
+
"""Get the ID of the 'Model'
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
int if successful, None otherwise.
|
|
101
|
+
"""
|
|
102
|
+
return self.__id
|
|
103
|
+
|
|
104
|
+
def get_chains(self):
|
|
105
|
+
"""Get the list of corresponding 'Chain' objects of the 'Model'
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
[packman.molecule.Chain] if successful, None otherwise.
|
|
109
|
+
"""
|
|
110
|
+
for i in sorted(self.__AllChains.keys()):yield self.__AllChains[i]
|
|
111
|
+
|
|
112
|
+
def get_residues(self):
|
|
113
|
+
"""Get the generator of corresponding 'Residue' objects of the 'Model'
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
array of 'Residue' objects if successful, None otherwise.
|
|
117
|
+
"""
|
|
118
|
+
#return [j for i in self.__AllChains.keys() for j in self.__AllChains[i].get_residues()]
|
|
119
|
+
residues = []
|
|
120
|
+
for i in self.__AllChains.keys():
|
|
121
|
+
try:
|
|
122
|
+
residues.extend( self.__AllChains[i].get_residues() )
|
|
123
|
+
except:
|
|
124
|
+
logging.warning("Chain "+str(i)+" either doesn't have residues or an error occurred; Model.get_residues() may have loaded other chains.")
|
|
125
|
+
return residues
|
|
126
|
+
|
|
127
|
+
def get_atoms(self):
|
|
128
|
+
"""Get the generator of corresponding 'Atom' objects of the 'Model'
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
generator of 'Atom' objects if successful, None otherwise.
|
|
132
|
+
"""
|
|
133
|
+
for i in sorted(self.__AllAtoms.keys()):yield self.__AllAtoms[i]
|
|
134
|
+
|
|
135
|
+
def get_atom(self, idx):
|
|
136
|
+
"""Get the atom of the given ID.
|
|
137
|
+
|
|
138
|
+
Note: - This function is different from :py:func:`packman.molecule.chain.get_atoms` and also :py:func:`packman.molecule.residue.get_atom`
|
|
139
|
+
- 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.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
idx (int): Get atom by the id
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
atom (:py:class:`packman.molecule.Atom`): Atom of the given ID if successful; None otherwise.
|
|
146
|
+
"""
|
|
147
|
+
the_atom = None
|
|
148
|
+
for i in self.__AllResidues:
|
|
149
|
+
the_atom = self.__AllResidues[i].get_atom(idx)
|
|
150
|
+
if(the_atom!=None):
|
|
151
|
+
break
|
|
152
|
+
|
|
153
|
+
if(the_atom==None):
|
|
154
|
+
for i in self.__AllHetMols:
|
|
155
|
+
the_atom = self.__AllHetMols[i].get_atom(idx)
|
|
156
|
+
if(the_atom!=None):
|
|
157
|
+
break
|
|
158
|
+
if(the_atom!=None):
|
|
159
|
+
return the_atom
|
|
160
|
+
else:
|
|
161
|
+
logging.info('The atom with the given ID is not found in this Model')
|
|
162
|
+
return None
|
|
163
|
+
|
|
164
|
+
def get_chain(self,ChainID):
|
|
165
|
+
"""Get the corresponding 'Chain' object
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
'Chain' object if successful, None otherwise.
|
|
169
|
+
"""
|
|
170
|
+
return self.__AllChains[ChainID]
|
|
171
|
+
|
|
172
|
+
def get_atom_byid(self,query_atom_id):
|
|
173
|
+
"""Get the 'Atom' with corresponding 'Atom' ID
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
'packman.molecule.Atom' object if successful, None otherwise.
|
|
177
|
+
"""
|
|
178
|
+
return self.__AllAtoms[query_atom_id]
|
|
179
|
+
|
|
180
|
+
def get_hetmols(self):
|
|
181
|
+
"""Get the generator of corresponding 'HetMol' objects of the 'Model'
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
generator of 'packman.molecule.HetMol' objects if successful, None otherwise.
|
|
185
|
+
"""
|
|
186
|
+
for i in sorted(self.__AllHetMols.keys()):yield self.__AllHetMols[i]
|
|
187
|
+
|
|
188
|
+
def get_hetatoms(self):
|
|
189
|
+
"""Get the generator of corresponding 'HetAtom' objects of the 'Model'
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
generator of 'packman.molecule.HetAtom' objects if successful, None otherwise.
|
|
193
|
+
"""
|
|
194
|
+
for i in sorted(self.__AllHetAtoms.keys()):yield self.__AllHetAtoms[i]
|
|
195
|
+
|
|
196
|
+
def get_parent(self):
|
|
197
|
+
"""Get the 'Protein' parent of the 'Model' object.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
'packman.molecule.Protein' object if successful, None otherwise.
|
|
201
|
+
"""
|
|
202
|
+
return self.__parent
|
|
203
|
+
|
|
204
|
+
def get_entropy(self,entropy_type):
|
|
205
|
+
"""Get the Packing Entropy of the given 'Chain'.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
type (str): Type of entropy (Allowed Values: 1. PackingEntropy)
|
|
209
|
+
|
|
210
|
+
Note:
|
|
211
|
+
- More type of Entropies might be added in the future.
|
|
212
|
+
"""
|
|
213
|
+
EntropyTypes = ['PackingEntropy']
|
|
214
|
+
try:
|
|
215
|
+
return numpy.sum( [self.__AllResidues[i].get_entropy(entropy_type) for i in self.__AllResidues] )
|
|
216
|
+
except:
|
|
217
|
+
if(entropy_type in EntropyTypes):
|
|
218
|
+
logging.warning('This Entropy type might not be calculated for all the chains/residues. Please check the "calculate_entropy" function in the documentation for the details.')
|
|
219
|
+
else:
|
|
220
|
+
logging.warning('The Entropy type provided is invalid. Please check the documentation for the details.')
|
|
221
|
+
|
|
222
|
+
def get_property(self,property_name):
|
|
223
|
+
"""Get the Property of the given 'Chain'.
|
|
224
|
+
|
|
225
|
+
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.
|
|
226
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
230
|
+
|
|
231
|
+
Note:
|
|
232
|
+
- Users can add custom annotations; for example: If particular chain becomes disordered, it can be annotated with this feature.
|
|
233
|
+
"""
|
|
234
|
+
try:
|
|
235
|
+
return self.__properties[property_name]
|
|
236
|
+
except:
|
|
237
|
+
logging.warning('The Property Name provided is not assigned.')
|
|
238
|
+
|
|
239
|
+
def get_bonds(self):
|
|
240
|
+
"""Return all the bonds in the given 'Model'.
|
|
241
|
+
|
|
242
|
+
Returns:
|
|
243
|
+
generator of packman.molecule.Bond objects if successful, None otherwise.
|
|
244
|
+
"""
|
|
245
|
+
try:
|
|
246
|
+
for i in self.__AllBonds: yield self.__AllBonds[i]
|
|
247
|
+
except:
|
|
248
|
+
logging.warning('Failed to return the bonds.')
|
|
249
|
+
|
|
250
|
+
def get_bond(self,idx):
|
|
251
|
+
"""Return the specific bond with specific ID.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
idx (int): Get the 'Bond' by the id
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
packman.molecule.Bond object if successful, None otherwise.
|
|
258
|
+
"""
|
|
259
|
+
try:
|
|
260
|
+
return self.__AllBonds[idx]
|
|
261
|
+
except:
|
|
262
|
+
logging.warning('Failed to return the bond. Please check the ID.')
|
|
263
|
+
|
|
264
|
+
#Compute Functions
|
|
265
|
+
def get_calpha(self):
|
|
266
|
+
"""Get the C-Alpha atom of the 'Model' as an 'Atom' object.
|
|
267
|
+
|
|
268
|
+
Returns:
|
|
269
|
+
list of packman.molecule.Atom if successful, None otherwise.
|
|
270
|
+
"""
|
|
271
|
+
return [i.get_calpha() for i in self.get_residues()]
|
|
272
|
+
|
|
273
|
+
def get_backbone(self):
|
|
274
|
+
"""Get the Backbone atoms of the given 'Model' as a list of 'Atom' object
|
|
275
|
+
|
|
276
|
+
Note:
|
|
277
|
+
* Backbone Atoms: CA, O, N, C
|
|
278
|
+
|
|
279
|
+
Returns:
|
|
280
|
+
list of packman.molecule.Atom if successful, None otherwise.
|
|
281
|
+
"""
|
|
282
|
+
return [i.get_backbone() for i in self.get_residues()]
|
|
283
|
+
|
|
284
|
+
def get_torsion(self, bond, neighbor1=None, neighbor2=None, radians=True):
|
|
285
|
+
"""Calculate the torsion angle of the given covalent bond with the corresponding selected neighbors.
|
|
286
|
+
|
|
287
|
+
Note:
|
|
288
|
+
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.
|
|
289
|
+
|
|
290
|
+
Args:
|
|
291
|
+
bond (packman.molecule.Bond) : The bond user wishes to calculate torsion angle to.
|
|
292
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom1 as an 'Atom' object or Atom ID.
|
|
293
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom2 as an 'Atom' object or Atom ID.
|
|
294
|
+
radians (True/False) : Return value of the angle in radians (returns value in degrees if False; Default : True)
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
The torsion angle in radians/degrees if sucessful, None otherwise.
|
|
298
|
+
"""
|
|
299
|
+
assert type(bond) == Bond, 'The bond varible should be a packman.molecule.Bond object'
|
|
300
|
+
|
|
301
|
+
try:
|
|
302
|
+
if(self.__AllBonds=={}):
|
|
303
|
+
logging.warning('Please check if the Model.calculate_bonds() was executed successfully.')
|
|
304
|
+
return None
|
|
305
|
+
except:
|
|
306
|
+
logging.warning('Please check if the Model.calculate_bonds() was executed successfully.')
|
|
307
|
+
return None
|
|
308
|
+
|
|
309
|
+
atom1, atom2 = bond.get_atoms()
|
|
310
|
+
|
|
311
|
+
if( neighbor1 == None ):
|
|
312
|
+
logging.error('neighbour1 not selected. Options available for neighbour1: ' + ', '.join( [str(i) for i in self.__ModelGraph[atom1.get_id()] if i != atom2.get_id() ] ) )
|
|
313
|
+
return None
|
|
314
|
+
|
|
315
|
+
if( neighbor2 == None ):
|
|
316
|
+
logging.error('neighbour2 not selected. Options available for neighbour2: ' + ', '.join( [str(i) for i in self.__ModelGraph[atom2.get_id()] if i != atom1.get_id() ] ) )
|
|
317
|
+
return None
|
|
318
|
+
|
|
319
|
+
if(type(neighbor1)==int):
|
|
320
|
+
neighbor1 = self.__AllAtoms[neighbor1]
|
|
321
|
+
elif(type(neighbor1)==type(atom1)):
|
|
322
|
+
None
|
|
323
|
+
else:
|
|
324
|
+
logging.error('neighbour1 should either be an integer or a packman.molecule.Atom object.')
|
|
325
|
+
return None
|
|
326
|
+
|
|
327
|
+
if(type(neighbor2)==int):
|
|
328
|
+
neighbor2 = self.__AllAtoms[neighbor2]
|
|
329
|
+
elif(type(neighbor2)==type(atom2)):
|
|
330
|
+
None
|
|
331
|
+
else:
|
|
332
|
+
logging.error('neighbour2 should either be an integer or a packman.molecule.Atom object.')
|
|
333
|
+
return None
|
|
334
|
+
|
|
335
|
+
#Actual code
|
|
336
|
+
b0 = -1.0*(atom1.get_location() - neighbor1.get_location())
|
|
337
|
+
b1 = atom2.get_location() - atom1.get_location()
|
|
338
|
+
b2 = neighbor2.get_location() - atom2.get_location()
|
|
339
|
+
b1 /= numpy.linalg.norm(b1)
|
|
340
|
+
v = b0 - numpy.dot(b0, b1)*b1
|
|
341
|
+
w = b2 - numpy.dot(b2, b1)*b1
|
|
342
|
+
x = numpy.dot(v, w)
|
|
343
|
+
y = numpy.dot(numpy.cross(b1, v), w)
|
|
344
|
+
radang=numpy.arctan2(y, x)
|
|
345
|
+
|
|
346
|
+
if(radians):
|
|
347
|
+
return radang
|
|
348
|
+
else:
|
|
349
|
+
return numpy.rad2deg(radang)
|
|
350
|
+
|
|
351
|
+
#Set Functions
|
|
352
|
+
def set_id(self,new_id):
|
|
353
|
+
"""Set the ID of the given 'Model'
|
|
354
|
+
|
|
355
|
+
Args:
|
|
356
|
+
new_id (int): The ID User wishes to assign to the given 'Model'
|
|
357
|
+
"""
|
|
358
|
+
self.__id=new_id
|
|
359
|
+
|
|
360
|
+
def set_parent(self, new_parent):
|
|
361
|
+
"""Set the 'Protein' object as a parent to the 'Model' object.
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
new_parent (packman.molecule.Protein): The 'Protein' object as a parent to the given 'Model'
|
|
365
|
+
"""
|
|
366
|
+
self.__parent = new_parent
|
|
367
|
+
|
|
368
|
+
def set_property(self,property_name,value):
|
|
369
|
+
"""Set the Property of the given 'Model'.
|
|
370
|
+
|
|
371
|
+
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.
|
|
372
|
+
Properties are like pinboards. You can pin anything to the object with a key as a pin.
|
|
373
|
+
|
|
374
|
+
Args:
|
|
375
|
+
property_name (object): The 'Key' or a name the user wants to assign to to the property
|
|
376
|
+
value (object): The value the user wants to assign to the property
|
|
377
|
+
|
|
378
|
+
Note:
|
|
379
|
+
- Users can add custom annotations; for example: If particular amino acid becomes disordered, it can be annotated with this feature.
|
|
380
|
+
"""
|
|
381
|
+
try:
|
|
382
|
+
self.__properties[property_name] = value
|
|
383
|
+
except:
|
|
384
|
+
logging.warning('Please check the property name. Check the allowed Python dictionary key types for more details.')
|
|
385
|
+
|
|
386
|
+
#Calculate Functions
|
|
387
|
+
def calculate_entropy(self,entropy_type,chains=None, probe_size=1.4, onspherepoints=30):
|
|
388
|
+
"""Calculate the entropy for the each amino acid will be returned.
|
|
389
|
+
|
|
390
|
+
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.
|
|
391
|
+
|
|
392
|
+
Args:
|
|
393
|
+
entropy_type (str) : Type of entropy to be calculated (Options: PackingEntropy)
|
|
394
|
+
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).
|
|
395
|
+
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)
|
|
396
|
+
onspherepoints (int) : Number of points to be generated around each point for the surface (Read the Publication for more details)
|
|
397
|
+
"""
|
|
398
|
+
if(entropy_type=='PackingEntropy'):
|
|
399
|
+
PackingEntropy(self.get_atoms(), chains=chains, probe_size=probe_size, onspherepoints=onspherepoints)
|
|
400
|
+
else:
|
|
401
|
+
logging.warning("Please provide the valid type for the Entropy Calculation.")
|
|
402
|
+
|
|
403
|
+
def set_torsion(self, bond, theta, neighbor1=None, neighbor2=None, radians=True):
|
|
404
|
+
"""Set the torsion for the given covalent bond with the corresponding selected neighbors.
|
|
405
|
+
|
|
406
|
+
Note:
|
|
407
|
+
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.
|
|
408
|
+
|
|
409
|
+
Args:
|
|
410
|
+
bond (packman.molecule.Bond) : The bond user wishes to rotate.
|
|
411
|
+
theta (int) : Set the torsional angle (see the 'radians' parameter description)
|
|
412
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom1 as an 'Atom' object or Atom ID.
|
|
413
|
+
neighbor1 (int/packman.molecule.Atom) : Neighbour of the Atom2 as an 'Atom' object or Atom ID.
|
|
414
|
+
radians (True/False) : Parameter 'theta' will be assuned to be in Radians if True, Degrees will be assumed when False. ( Default : True)
|
|
415
|
+
|
|
416
|
+
Returns:
|
|
417
|
+
True if successfulm None otherwise
|
|
418
|
+
"""
|
|
419
|
+
assert type(bond) == Bond, 'The bond varible should be a packman.molecule.Bond object'
|
|
420
|
+
|
|
421
|
+
try:
|
|
422
|
+
if(self.__AllBonds=={}):
|
|
423
|
+
logging.warning('Please check if the Model.calculate_bonds() was executed successfully.')
|
|
424
|
+
return None
|
|
425
|
+
except:
|
|
426
|
+
logging.warning('Please check if the Model.calculate_bonds() was executed successfully.')
|
|
427
|
+
return None
|
|
428
|
+
|
|
429
|
+
atom1, atom2 = bond.get_atoms()
|
|
430
|
+
|
|
431
|
+
if( neighbor1 == None ):
|
|
432
|
+
logging.error('neighbour1 not selected. Options available for neighbour1: ' + ', '.join( [str(i) for i in self.__ModelGraph[atom1.get_id()] if i != atom2.get_id() ] ) )
|
|
433
|
+
return None
|
|
434
|
+
|
|
435
|
+
if( neighbor2 == None ):
|
|
436
|
+
logging.error('neighbour2 not selected. Options available for neighbour2: ' + ', '.join( [str(i) for i in self.__ModelGraph[atom2.get_id()] if i != atom1.get_id() ] ) )
|
|
437
|
+
return None
|
|
438
|
+
|
|
439
|
+
if(type(neighbor1)==int):
|
|
440
|
+
neighbor1 = self.__AllAtoms[neighbor1]
|
|
441
|
+
elif(type(neighbor1)==type(atom1)):
|
|
442
|
+
None
|
|
443
|
+
else:
|
|
444
|
+
logging.error('neighbour1 should either be an integer or a packman.molecule.Atom object.')
|
|
445
|
+
return None
|
|
446
|
+
|
|
447
|
+
if(type(neighbor2)==int):
|
|
448
|
+
neighbor2 = self.__AllAtoms[neighbor2]
|
|
449
|
+
elif(type(neighbor2)==type(atom2)):
|
|
450
|
+
None
|
|
451
|
+
else:
|
|
452
|
+
logging.error('neighbour2 should either be an integer or a packman.molecule.Atom object.')
|
|
453
|
+
return None
|
|
454
|
+
|
|
455
|
+
if(radians):
|
|
456
|
+
None
|
|
457
|
+
else:
|
|
458
|
+
theta = numpy.deg2rad(theta)
|
|
459
|
+
|
|
460
|
+
#Actual code
|
|
461
|
+
current_torsion = self.get_torsion(bond, neighbor1=neighbor1, neighbor2=neighbor2, radians=True)
|
|
462
|
+
|
|
463
|
+
rotang = current_torsion - theta
|
|
464
|
+
|
|
465
|
+
#Find the section to rotate
|
|
466
|
+
test = self.__ModelGraph.copy()
|
|
467
|
+
test.remove_edge( atom1.get_id(), atom2.get_id() )
|
|
468
|
+
before_components = [j for j in connected_components(self.__ModelGraph)]
|
|
469
|
+
after_componets = [j for j in connected_components(test)]
|
|
470
|
+
#Changed components tell you what parts have been changed
|
|
471
|
+
changed_components = []
|
|
472
|
+
for i in after_componets:
|
|
473
|
+
if(i in before_components):
|
|
474
|
+
#All the unchanged componets after breaking the bridge
|
|
475
|
+
None
|
|
476
|
+
else:
|
|
477
|
+
changed_components.append(i)
|
|
478
|
+
|
|
479
|
+
#Smaller component will be rotated to keep computational intensity low
|
|
480
|
+
to_rotate = list(changed_components[min((len(l), i) for i, l in enumerate(changed_components))[1]])
|
|
481
|
+
|
|
482
|
+
#Setting up rotation matrix
|
|
483
|
+
sn=numpy.sin(rotang)
|
|
484
|
+
cs=numpy.cos(rotang)
|
|
485
|
+
t=1-cs
|
|
486
|
+
|
|
487
|
+
v2x = atom1.get_location()[0] - atom2.get_location()[0]
|
|
488
|
+
v2y = atom1.get_location()[1] - atom2.get_location()[1]
|
|
489
|
+
v2z = atom1.get_location()[2] - atom2.get_location()[2]
|
|
490
|
+
#Normalize the rotation vector
|
|
491
|
+
mag=numpy.sqrt(numpy.square(v2x)+numpy.square(v2y)+numpy.square(v2z))
|
|
492
|
+
x = float(v2x)/mag
|
|
493
|
+
y = float(v2y)/mag
|
|
494
|
+
z = float(v2z)/mag
|
|
495
|
+
#set up the rotation matrix
|
|
496
|
+
m=numpy.zeros(9)
|
|
497
|
+
m[0]= t*x*x + cs
|
|
498
|
+
m[1]= t*x*y + sn*z
|
|
499
|
+
m[2]= t*x*z - sn*y
|
|
500
|
+
m[3]= t*x*y - sn*z
|
|
501
|
+
m[4]= t*y*y + cs
|
|
502
|
+
m[5]= t*y*z + sn*x
|
|
503
|
+
m[6]= t*x*z + sn*y
|
|
504
|
+
m[7]= t*y*z - sn*x
|
|
505
|
+
m[8]= t*z*z + cs
|
|
506
|
+
|
|
507
|
+
#Rotate The Atoms
|
|
508
|
+
tx = atom1.get_location()[0]
|
|
509
|
+
ty = atom1.get_location()[1]
|
|
510
|
+
tz = atom1.get_location()[2]
|
|
511
|
+
|
|
512
|
+
#Set the angles
|
|
513
|
+
for i in to_rotate:
|
|
514
|
+
try:
|
|
515
|
+
COORDS = self.__AllAtoms[i].get_location()
|
|
516
|
+
COORDS[0]-=tx
|
|
517
|
+
COORDS[1]-=ty
|
|
518
|
+
COORDS[2]-=tz
|
|
519
|
+
x=COORDS[0]*m[0]+COORDS[1]*m[1]+COORDS[2]*m[2]
|
|
520
|
+
y=COORDS[0]*m[3]+COORDS[1]*m[4]+COORDS[2]*m[5]
|
|
521
|
+
z=COORDS[0]*m[6]+COORDS[1]*m[7]+COORDS[2]*m[8]
|
|
522
|
+
COORDS[0]=x
|
|
523
|
+
COORDS[1]=y
|
|
524
|
+
COORDS[2]=z
|
|
525
|
+
COORDS[0]+=tx
|
|
526
|
+
COORDS[1]+=ty
|
|
527
|
+
COORDS[2]+=tz
|
|
528
|
+
self.__AllAtoms[i].set_location( numpy.array(COORDS) )
|
|
529
|
+
except:
|
|
530
|
+
logging.warning('Failed to rotate Atom: '+str(self.__AllAtoms[i].get_id()))
|
|
531
|
+
return True
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
def calculate_bonds(self):
|
|
535
|
+
"""Calculate the bonds in the given 'Model'.
|
|
536
|
+
|
|
537
|
+
Currently, bonds are only calculated based on the following RCSB PDB resource file:
|
|
538
|
+
http://ftp.wwpdb.org/pub/pdb/data/monomers/aa-variants-v1.cif.gz
|
|
539
|
+
"""
|
|
540
|
+
counter = -1
|
|
541
|
+
self.__AllBonds = {}
|
|
542
|
+
self.__ModelGraph = Graph()
|
|
543
|
+
|
|
544
|
+
#PDB File CONECT Records from annotations
|
|
545
|
+
for i in self.get_parent().get_data():
|
|
546
|
+
if(i[0:6]=='CONECT'):
|
|
547
|
+
#Information on the following line is obtained from: https://www.wwpdb.org/documentation/file-format-content/format33/sect10.html and http://www.bmsc.washington.edu/CrystaLinks/man/pdb/part_69.html and https://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html#CONECT
|
|
548
|
+
other_atoms = [ (11,16,'covalent'), (16,21,'covalent'), (21,26,'covalent'), (26,31,'covalent'), (31,36,'hydrogen'), (36,41,'hydrogen'), (41,46,'salt-bridge'), (46,51,'hydrogen'), (51,56,'hydrogen'), (56,61,'salt-bridge') ]
|
|
549
|
+
main_atom = self.get_atom( int(i[6:11]) )
|
|
550
|
+
for j in other_atoms:
|
|
551
|
+
try:
|
|
552
|
+
temp_atom = self.get_atom(int(i[j[0]:j[1]]))
|
|
553
|
+
counter+=1
|
|
554
|
+
bond = Bond(counter, main_atom, temp_atom, j[2], source='CONECT-section')
|
|
555
|
+
self.__AllBonds[counter] = bond
|
|
556
|
+
main_atom.set_bond(bond)
|
|
557
|
+
temp_atom.set_bond(bond)
|
|
558
|
+
self.__ModelGraph.add_node( main_atom.get_id() )
|
|
559
|
+
self.__ModelGraph.add_node( temp_atom.get_id() )
|
|
560
|
+
if(bond.get_type().split('-')[0]=='covalent'):
|
|
561
|
+
self.__ModelGraph.add_edge( main_atom.get_id(), temp_atom.get_id() , id = counter )
|
|
562
|
+
except:
|
|
563
|
+
None
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
#CIF FILE (https://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Categories/struct_conn.html)
|
|
567
|
+
if(counter==-1):
|
|
568
|
+
data = '\n'.join(self.get_parent().get_data())
|
|
569
|
+
|
|
570
|
+
for i in data.split('#\nloop_\n'):
|
|
571
|
+
if(i[:12] == '_struct_conn' ):
|
|
572
|
+
col_seq = []
|
|
573
|
+
for j in i.split('#'):
|
|
574
|
+
if(j[:12] == '_struct_conn' ):
|
|
575
|
+
for k in j.split('\n'):
|
|
576
|
+
try:
|
|
577
|
+
if(k[0]=='_'):
|
|
578
|
+
col_seq.append( k )
|
|
579
|
+
else:
|
|
580
|
+
temp_dict = {col_seq[numl]:l for numl,l in enumerate(k.split())}
|
|
581
|
+
#Actual approach: find chains -> residue/hetatm -> get the atom with the same name
|
|
582
|
+
chain1, chain2 = self[temp_dict['_struct_conn.ptnr1_label_asym_id']], self[temp_dict['_struct_conn.ptnr2_label_asym_id']]
|
|
583
|
+
|
|
584
|
+
ptnr1 = chain1.get_residue( int(temp_dict['_struct_conn.ptnr1_auth_seq_id']) )
|
|
585
|
+
if(ptnr1==None):
|
|
586
|
+
ptnr1 = chain1.get_hetmol( int(temp_dict['_struct_conn.ptnr1_auth_seq_id']) )
|
|
587
|
+
if(ptnr1==None):
|
|
588
|
+
ptnr1 = chain1.get_hetmol( temp_dict['_struct_conn.ptnr1_label_comp_id']+temp_dict['_struct_conn.ptnr1_auth_seq_id'] )
|
|
589
|
+
|
|
590
|
+
ptnr2 = chain2.get_residue( int(temp_dict['_struct_conn.ptnr2_auth_seq_id']) )
|
|
591
|
+
if(ptnr2==None):
|
|
592
|
+
ptnr2 = chain2.get_hetmol( int(temp_dict['_struct_conn.ptnr2_auth_seq_id']) )
|
|
593
|
+
if(ptnr2==None):
|
|
594
|
+
ptnr2 = chain2.get_hetmol( temp_dict['_struct_conn.ptnr2_label_comp_id']+temp_dict['_struct_conn.ptnr2_auth_seq_id'] )
|
|
595
|
+
|
|
596
|
+
if(ptnr1!=None and ptnr2!=None):
|
|
597
|
+
atm1 = ptnr1.get_atom(temp_dict['_struct_conn.ptnr1_label_atom_id'])
|
|
598
|
+
atm2 = ptnr2.get_atom(temp_dict['_struct_conn.ptnr2_label_atom_id'])
|
|
599
|
+
|
|
600
|
+
cif_vocab2pacman= {'covale':'covalent' , 'disulf':'covalent-single', 'hydrog':'hydrogen', 'metalc':'non-covalent'}
|
|
601
|
+
|
|
602
|
+
bond_type = None
|
|
603
|
+
try:
|
|
604
|
+
bond_type = cif_vocab2pacman[temp_dict['_struct_conn.conn_type_id']]
|
|
605
|
+
except:
|
|
606
|
+
bond_type = 'other'
|
|
607
|
+
|
|
608
|
+
counter+=1
|
|
609
|
+
bond = Bond(counter, atm1, atm2, bond_type, source='CONECT-section')
|
|
610
|
+
self.__AllBonds[counter] = bond
|
|
611
|
+
atm1.set_bond(bond)
|
|
612
|
+
atm2.set_bond(bond)
|
|
613
|
+
self.__ModelGraph.add_node( atm1.get_id() )
|
|
614
|
+
self.__ModelGraph.add_node( atm2.get_id() )
|
|
615
|
+
if(bond.get_type().split('-')[0]=='covalent'):
|
|
616
|
+
self.__ModelGraph.add_edge( atm1.get_id(), atm2.get_id() , id = counter )
|
|
617
|
+
else:
|
|
618
|
+
logging.warn('Some atom(s) are not identified correctly in the mmCIF file.')
|
|
619
|
+
|
|
620
|
+
except Exception as e:
|
|
621
|
+
#Check whats up with string error (very minor)
|
|
622
|
+
None
|
|
623
|
+
|
|
624
|
+
#Generate bonds from the default settings (No connect records)
|
|
625
|
+
for chain in self.get_chains():
|
|
626
|
+
try:
|
|
627
|
+
resi = [i for i in chain.get_residues()]
|
|
628
|
+
except:
|
|
629
|
+
logging.info('Residues are not found for bonds without CONNECT records (default bonds) for the chain: '+str(chain.get_id()))
|
|
630
|
+
continue
|
|
631
|
+
#This section is for the default bonds (Not in the connect record)
|
|
632
|
+
for i in resi:
|
|
633
|
+
try:
|
|
634
|
+
for j in aa_connectivity[i.get_name()]:
|
|
635
|
+
try:
|
|
636
|
+
atom1, atom2 = i.get_atom(j[0]), i.get_atom(j[1])
|
|
637
|
+
if(atom1!=None and atom2!=None and atom1.get_parent().get_parent().get_id() == atom2.get_parent().get_parent().get_id() ):
|
|
638
|
+
counter += 1
|
|
639
|
+
if(j[2]=='SING'):
|
|
640
|
+
bond = Bond(counter, atom1, atom2, 'covalent-single', source='RCSB/aa-variants-v1.cif')
|
|
641
|
+
elif(j[2]=='DOUB'):
|
|
642
|
+
bond = Bond(counter, atom1, atom2, 'covalent-double', source='RCSB/aa-variants-v1.cif')
|
|
643
|
+
else:
|
|
644
|
+
bond = Bond(counter, atom1, atom2, 'covalent', source='RCSB/aa-variants-v1.cif')
|
|
645
|
+
self.__AllBonds[counter] = bond
|
|
646
|
+
atom1.set_bond(bond)
|
|
647
|
+
atom2.set_bond(bond)
|
|
648
|
+
|
|
649
|
+
self.__ModelGraph.add_node( atom1.get_id() )
|
|
650
|
+
self.__ModelGraph.add_node( atom2.get_id() )
|
|
651
|
+
if(bond.get_type().split('-')[0]=='covalent'):
|
|
652
|
+
self.__ModelGraph.add_edge( atom1.get_id(), atom2.get_id() , id = counter )
|
|
653
|
+
except Exception as e:
|
|
654
|
+
#Bond pair not found
|
|
655
|
+
None
|
|
656
|
+
except:
|
|
657
|
+
logging.warn('Residue Number|Name|Chain '+str(i.get_id())+'|'+str(i.get_name())+'|'+str(i.get_parent().get_id())+' is not a standard amino acid; sidechain bonds are not calculated.')
|
|
658
|
+
|
|
659
|
+
#Peptide bonds (Assumption: All the reisudes are in the incremental/decremental order)
|
|
660
|
+
for i in range(0,len(resi)-1):
|
|
661
|
+
if( abs(resi[i].get_id() - resi[i+1].get_id()) == 1 ):
|
|
662
|
+
counter+=1
|
|
663
|
+
C, N = resi[i].get_atom('C'), resi[i+1].get_atom('N')
|
|
664
|
+
bond = Bond(counter, C, N, 'covalent-single', source='PACKMAN Peptide Bond calculation' )
|
|
665
|
+
self.__AllBonds[counter] = bond
|
|
666
|
+
C.set_bond(bond)
|
|
667
|
+
N.set_bond(bond)
|
|
668
|
+
self.__ModelGraph.add_edge( C.get_id(), N.get_id() , id = counter )
|
|
669
|
+
else:
|
|
670
|
+
logging.warning('The peptide bond following residue is missing: '+str(resi[i].get_id())+' Chain: '+resi[i].get_parent().get_id())
|
|
671
|
+
|
|
672
|
+
try:
|
|
673
|
+
None
|
|
674
|
+
#Successful run
|
|
675
|
+
'''
|
|
676
|
+
set_to = -90
|
|
677
|
+
print('Before:', self.calculate_torsion(common_bond, neighbor1=227, neighbor2=231, radians=False) )
|
|
678
|
+
self.calculate_rotation(common_bond, set_to, neighbor1=227, neighbor2=231, radians=False)
|
|
679
|
+
print('Set:',set_to)
|
|
680
|
+
print('After:', self.calculate_torsion(common_bond, neighbor1=227, neighbor2=231, radians=False) )
|
|
681
|
+
'''
|
|
682
|
+
except Exception as e:
|
|
683
|
+
print(str(e))
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
#Check Function
|
|
687
|
+
def check_clashes(self,distance=0.77):
|
|
688
|
+
"""Check if any atoms are too close to each other. This is important since too close atoms in the elastic network models can be very bad for the results.
|
|
689
|
+
|
|
690
|
+
Notes:
|
|
691
|
+
* This function will be moved to the molecule manipulation package later
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
Args:
|
|
695
|
+
distance (float): The distance cutoff user wishes to defined as a clash radius (default:0.77; max bond length)
|
|
696
|
+
|
|
697
|
+
Returns:
|
|
698
|
+
clashes (int) : Number of clashes present according to the set cutoff.
|
|
699
|
+
"""
|
|
700
|
+
from scipy.spatial import KDTree
|
|
701
|
+
all_atoms=[i for i in self.get_atoms()]
|
|
702
|
+
T=KDTree([i.get_location() for i in all_atoms])
|
|
703
|
+
return len(T.query_pairs(distance))
|