Skip to content

Commit

Permalink
Merge pull request #32 from Pranavkhade/GNM
Browse files Browse the repository at this point in the history
GNM
  • Loading branch information
Pranavkhade authored May 21, 2022
2 parents 22edb8a + 6c2ef5f commit 7f0dba2
Show file tree
Hide file tree
Showing 17 changed files with 384 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ WEB SERVERS
* [Hinge Prediction Web Server](https://packman.bb.iastate.edu/)
* [hd-ANM Web Server](https://hdanm.bb.iastate.edu/)
* [Packing Entropy Web Server](https://packing-entropy.bb.iastate.edu/)
* [DCI web server](https://dci.bb.iastate.edu/)

RELATED RESEARCH ARTICLES
-------------------------
Expand All @@ -60,6 +61,7 @@ RELATED RESEARCH ARTICLES
* [Compliance](https://doi.org/10.1002/prot.25968)
* [hd-ANM](https://doi.org/10.1016/j.bpj.2021.10.017)
* [Packing Entropy](coming_soon)
* [DCI](https://doi.org/10.1093/bioinformatics/btac159)

ACKNOWLEDGEMENTS
----------------
Expand Down
Binary file modified docs/_static/gallary/molecule_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ Web Servers
- `Hinge Prediction <https://packman.bb.iastate.edu/>`_
- `hdANM <https://hdanm.bb.iastate.edu/>`_
- `Packing Entropy <https://packing-entropy.bb.iastate.edu/>`_
- `DCI <https://dci.bb.iastate.edu/>`_

Publications
------------
- PACKMAN-molecule (https://doi.org/10.1093/bioadv/vbac007)
- Hinge Prediction (https://doi.org/10.1016/j.jmb.2019.11.018)
- Structural Compliance (https://doi.org/10.1002/prot.25968)
- hdANM (https://doi.org/10.1016/j.bpj.2021.10.017)
- DCI (https://doi.org/10.1093/bioinformatics/btac159)

Project Goal
------------
Expand Down
96 changes: 96 additions & 0 deletions docs/source/tutorials/GNM.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.. _tutorials_gnm_api:

Using Gaussian Network Model (GNM)
==================================

This tutorial aims to get the user to familiarize with the concept of GNM API. GNM is available only in API.

How to cite::

- For original GNM: Tirion, M.M. (1996). "Large amplitude elastic motions in proteins from a single-parameter, atomic analysis". Phys. Rev. Lett. 77 (9): 1905-1908.
- For using GNM with this package: Pranav M Khade, Robert L Jernigan, PACKMAN-Molecule: Python Toolbox for Structural Bioinformatics, Bioinformatics Advances, 2022;, vbac007, https://doi.org/10.1093/bioadv/vbac007
- For 7.8 Angstrom cutoff: Yang, L., Song, G. & Jernigan, R. L. Protein elastic network models and the ranges of cooperativity. Proc Natl Acad Sci U S A 106, 12347-52 (2009).

Note: If PACKMAN is not installed, please follow the link: https://github.com/Pranavkhade/PACKMAN


Step 1: Loading Structure
-------------------------

In this section, we load the file containing the molecular structure. To understand in dept about the :mod:`packman.molecule` object, pelase visit :ref:`tutorials_molecule`

Code Example::

from packman import molecule

#File loading
mol = molecule.load_structure('1prw.cif')
#OR
#mol = molecule.load_structure('1prw.pdb')

#If the c-alpha atoms of the ALL the chains need to be studied,
#calpha = [i for i in mol[0].get_calpha() if i is not None]

#If the c-alpha atoms of the specific chain 'A' needs to be studied,
calpha = [i for i in mol[0]['A'].get_calpha() if i is not None]


Step 2: Loading the GNM
------------------------

The GNM object has one required argument (set of atoms) and several optional arguments that can be changed according to the user's needs. Please check :mod:`packman.gnm.GNM` for more details.

Code Example::

from packman.gnm import GNM
model = GNM(calpha)


Step 3: Calculating Kirchhoff's Matrix
--------------------------------------

Please refer to the publication mentioned at the top of this page for more details.

In future, we will allow users to provide amino acid residue specific molecular masses, atom specific atomic masses, or any other type of weights that needs to be assigned to the atoms/residues. To give custom residue-specific values as mass to the method, simply create a standard python dictionary with 20 standard amino acids as keys and assign corresponding values to it (mass_type parameter).

Code Example::

model.calculate_kirchhoff()
kirchhoff = model.get_kirchhoff()
print(kirchhoff)


Step 4: Eigenvalue decomposition
--------------------------------

The Eigenvalue decomposition is carried out using the Kirchhoff's matrix and mass matrix to calculate eigenvalues and eigenvectors.

Code Example::

model.calculate_decomposition()

Eigenvalues and Eigenvectors. can be obtained by::

model.get_eigenvalues()
model.get_eigenvectors()

Respectively. Other calculated attributes and properties of the hd-ANM built can be obtained by its 'get' methods. Please refer to :mod:`packman.gnm.GNM` documentation for more details.


Step 6: Getting other data from GNM
-----------------------------------

This step demonstrates how one can obtain other data from GNM.


Code Example::

model.calculate_fluctuations()
print(model.get_fluctuations())

model.calculate_crosscorrelation()
print(model.get_pseudoinverse())

from matplotlib import pyplot as plt
plt.imshow( model.get_crosscorrelation(), cmap='hot')
plt.show()
1 change: 1 addition & 0 deletions docs/source/tutorials/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Application Programming Interface (API)
#. :ref:`tutorials_compliance`
#. :ref:`tutorials_hdANM`
#. :ref:`tutorials_entropy_api`
#. :ref:`tutorials_gnm_api`

Utilities (API)
---------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/molecule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Citation:
.. image:: ../../_static/gallary/molecule_graph.png


Figure 1. The object hierarchy of the :mod:`packman.molecule` submodule.
Figure 1. The object hierarchy of the :mod:`packman.molecule` submodule. (Figure taken from the paper cited at the top)


Downloading & Loading
Expand Down
2 changes: 1 addition & 1 deletion packman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@


#VERSION CHANGE HERE CHANGES IT IN docs AND setup.py
__version__='1.4.4'
__version__='1.4.5'
7 changes: 1 addition & 6 deletions packman/anm/anm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ class ANM:
gamma (float, optional): Spring Constant Value. Defaults to 1.0.
dr (float, optional) : Distance Cutoff. Defaults to 15.0.
power (int, optional) : Power of distance (mainly useful in non-parametric mode). Defaults to 0.
pf (None, optional) : Parameter free model?. Defaults to None.
Raises:
Exception: [description]
Exception: [description]
Exception: [description]
pf (None, optional) : Parameter free model. (Check the dr and power params) Defaults to None.
"""

def __init__(self, atoms, gamma=1.0, dr=15.0, power=0, pf=None):
Expand Down
14 changes: 7 additions & 7 deletions packman/bin/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,28 +347,28 @@ def write_hng_file():

select_count += 1
if(ALL_RESIDUES[ChainOfHinge][0]!=hinge_res_ids[0]):
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(ALL_RESIDUES[ChainOfHinge][0])+':'+str(hinge_res_ids[0]-1)+'\n' )
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(ALL_RESIDUES[ChainOfHinge][0])+':'+str(hinge_res_ids[0]-1)+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
else:
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
last_hinge_end = hinge_res_ids[-1]
elif( i.get() ):
hinge_res_ids = sorted([j.get_id() for j in current_hinge.get_elements()])
select_count += 1
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(hinge_res_ids[0]-1)+'\n' )
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(hinge_res_ids[0]-1)+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
last_hinge_end = hinge_res_ids[-1]
try:
if(ChainOfHinge != All_Hinges[numi+1].get_elements()[0].get_parent().get_id() ):
select_count += 1
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
last_hinge_end = 0
except:
None

if(last_hinge_end != ALL_RESIDUES[ChainOfHinge][-1]):
select_count += 1
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
fh.write(self.Box1.get().split('/')[-1].replace(' ','+')+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
fh.flush()
fh.close()
showinfo('Notification',self.output_filename.get()+' file saved!')
Expand Down
25 changes: 25 additions & 0 deletions packman/gnm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Author: Pranav Khade, Iowa State University
# Please read the project licence file for the Copyrights.

"""The 'packman.gnm' module is a collection of anm methods and applications built on packman.molecule API.
Notes:
* Current apps list: - packman.gnm.GNM
* Cite the following paper:
Example:
* Review the packman.bin.PACKMAN.py file for the app use.
Todo:
* Add new features
* Add citations in the note
* Use ``sphinx.ext.todo`` extension
* Clean the code
* Redesign print statements
* Add Tutorial Link
"""
from .gnm import GNM
Loading

0 comments on commit 7f0dba2

Please sign in to comment.