Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prody/ProDy into remove_numpy_ali…
Browse files Browse the repository at this point in the history
…as_types
  • Loading branch information
jamesmkrieger committed Oct 4, 2023
2 parents 3163ceb + e7064a4 commit 653d964
Show file tree
Hide file tree
Showing 55 changed files with 779,013 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: MatteoH2O1999/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ __pycache__
*.nmd
*.pdb
*.pdb.gz
*.cif
*.cif.gz

# Docs
/docs/_build/
Expand Down
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ProDy
Version: 2.4.0
Version: 2.4.1
Summary: A Python Package for Protein Dynamics Analysis
Home-page: http://www.csb.pitt.edu/ProDy
Author: James Krieger, She Zhang, Hongchun Li, Cihan Kaya, Ahmet Bakan, and others
Expand Down
8 changes: 4 additions & 4 deletions docs/apps/prody/prody.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
usage: prody [-h] [-c] [-v]
{anm,gnm,pca,eda,align,blast,biomol,catdcd,contacts,fetch,select}
...
usage: prody [-h] [-c] [-v] {anm,gnm,pca,eda,align,blast,biomol,catdcd,contacts,fetch,select,energy,clustenm} ...

ProDy: A Python Package for Protein Dynamics Analysis

Expand All @@ -10,7 +8,7 @@ optional arguments:
-v, --version print ProDy version and exit

subcommands:
{anm,gnm,pca,eda,align,blast,biomol,catdcd,contacts,fetch,select}
{anm,gnm,pca,eda,align,blast,biomol,catdcd,contacts,fetch,select,energy,clustenm}
anm perform anisotropic network model calculations
gnm perform Gaussian network model calculations
pca perform principal component analysis calculations
Expand All @@ -22,5 +20,7 @@ subcommands:
contacts identify contacts between a target and ligand(s)
fetch fetch a PDB file
select select atoms and write a PDB file
energy fix missing atoms, solvate, minimise and calculate energy
clustenm run clustenm(d) simulations

See 'prody <command> -h' for more information on a specific command.
8 changes: 4 additions & 4 deletions docs/devel/develop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ creating a copy of the repository in your account. You will see
a link for this on ProDy_ source code page. You will have write access to
this fork and later will use it share your changes with others.

The next step is cloning the fork from your online account to your local
The next step is cloning the fork from your online account (e.g. jamesmkrieger) to your local
system. If you are not using the GitHub software, you can do it as follows::

$ git clone https://github.com/prody/ProDy.git
$ git clone https://github.com/jamesmkrieger/ProDy.git

This will create :file:`ProDy` folder with a copy of the project files in it::

Expand Down Expand Up @@ -140,10 +140,10 @@ repository as a remote to your local copy. You can do this running the
following command from the ProDy project folder::

$ cd prody
$ git remote add prodymaster [email protected]:abakan/ProDy.git
$ git remote add prodymaster [email protected]:prody/ProDy.git


You may use any name other than `prodymaster`, but `origin`, which points to
You may use any name other than `prodymaster`, except for `origin`, which points to
the ProDy fork in your account.

After setting up this remote, calling :program:`git pull` command will
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/apps/prody_clustenm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ANM Application
===============

.. automodule:: prody.apps.prody_apps.prody_clustenm
:members:
:undoc-members:
26 changes: 26 additions & 0 deletions docs/release/v2.4_series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ ProDy 2.4 Series
:local:


2.4.1 (Aug 11, 2023)
------------------------------------------------------------------------------

**New Features**:

* New function writeBILD to write modes in BILD format for viewing in Chimera/ChimeraX
* New function addMissingAtoms based on PDBFixer or OpenBabel
* Added Seaborn kernel density estimator (KDE) options to showProjection like Kaynak et al., 2022
* Added options to control adjust_text for showProjection
* Added unite_chains option to parseMMCIF to handle splitting over segments
* New function interpolateModel based on SITUS ModeHunter
* New ClustENM app
* New module for analysing water bridges (only for Python 3)
* New option nproc as a number of processors limit for solveEig, ANM, GNM and PCA calcModes

**Bug Fixes and Improvements**:

* Fixed Trajectory next frame overwriting with atoms linked
* Important fixes to alignBioPairwise
* Update to blastpdb to account for changes to on the NCBI side
* Improvements to apps including writing matrices
* Improved handling of mmCIF files including those from PDB-REDO

**Full Changelog**: https://github.com/prody/ProDy/compare/v2.4.0...v2.4.1


2.4.0 (Feb 2, 2023)
------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion prody/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""ProDy is a package for Protein Dynamics, Sequence, and Structure Analysis"""

__version__ = '2.4.0'
__version__ = '2.4.1'
__release__ = __version__ # + '-dev' # comment out '-dev' before a release

import sys
Expand Down
3 changes: 2 additions & 1 deletion prody/apps/prody_apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
path_apps = imp.find_module('prody_apps', [path_apps])[1]

PRODY_APPS = ['anm', 'gnm', 'pca', 'eda', 'align', 'blast', 'biomol',
'catdcd', 'contacts', 'fetch', 'select', 'energy']
'catdcd', 'contacts', 'fetch', 'select', 'energy',
'clustenm']

__all__ = ['prody_main']

Expand Down
19 changes: 14 additions & 5 deletions prody/apps/prody_apps/nmaoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
('select', 'atom selection',
"protein and name CA or nucleic and name P C4' C2"),
('nmodes', 'number of non-zero eigenvectors (modes) to calculate', 10),
('membrane', 'whether to include the explicit membrane model', False),

('outall', 'write all outputs', False),
('outeig', 'write eigenvalues/vectors', False),
('outcov', 'write covariance matrix', False),
('outnpz', 'write compressed ProDy data file', False),
('npzmatrices', 'write matrix to compressed ProDy data file', False),
('outscipion', 'write continuousflex modes directory and sqlite', False),
('outcc', 'write cross-correlations', False),
('outhm', 'write cross-correlations heatmap file', False),
Expand Down Expand Up @@ -47,7 +49,7 @@
'addNMAFigures', 'addNMAFigureOptions']


def addNMAParameters(parser):
def addNMAParameters(parser, include_nproc=True):

parser = parser.add_argument_group('parameters')

Expand All @@ -58,6 +60,14 @@ def addNMAParameters(parser):
parser.add_argument('-s', '--select', dest='select', type=str,
default=DEFAULTS['select'], metavar='STR',
help=HELPTEXT['select'] + ' (default: "%(default)s")')

parser.add_argument('-N', '--membrane', dest='membrane', action='store_true',
default=DEFAULTS['membrane'], help=HELPTEXT['membrane'])

if include_nproc:
parser.add_argument('-P', '--number-of-processors', dest='nproc', type=int,
default=DEFAULTS['nproc'], metavar='INT',
help=HELPTEXT['nproc'] + ' (default: %(default)s meaning use all)')

return parser

Expand Down Expand Up @@ -96,17 +106,16 @@ def addNMAOutput(parser):
parser.add_argument('-z', '--npz', dest='outnpz', action='store_true',
default=DEFAULTS['outnpz'], help=HELPTEXT['outnpz'])

parser.add_argument('-Z', '--npzmatrices', dest='npzmatrices', action='store_true',
default=DEFAULTS['npzmatrices'], help=HELPTEXT['npzmatrices'])

parser.add_argument('-S', '--export-scipion', dest='outscipion', action='store_true',
default=DEFAULTS['outscipion'], help=HELPTEXT['outscipion'])

parser.add_argument('-t', '--extend', dest='extend', type=str,
metavar='STR', choices=set(['bb', 'all', 'backbone']),
help=HELPTEXT['extend'])

parser.add_argument('-P', '--number-of-processors', dest='nproc', type=int,
default=DEFAULTS['nproc'], metavar='INT',
help=HELPTEXT['nproc'] + ' (default: %(default)s)')

return parser


Expand Down
59 changes: 34 additions & 25 deletions prody/apps/prody_apps/prody_anm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
for key, txt, val in [
('model', 'index of model that will be used in the calculations', 1),
('altloc', 'alternative location identifiers for residues used in the calculations', "A"),
('cutoff', 'cutoff distance (A)', 15.),
('cutoff', 'cutoff distance (A)', '15.'),
('gamma', 'spring constant', '1.'),
('sparse', 'use sparse matrices', False),
('kdtree', 'use kdtree for Hessian', False),
('zeros', 'calculate zero modes', False),
('turbo', 'use memory-intensive turbo option for modes', False),

('outbeta', 'write beta-factors calculated from GNM modes', False),
('outbeta', 'write beta-factors calculated from ANM modes', False),
('hessian', 'write Hessian matrix', False),
('kirchhoff', 'write Kirchhoff matrix', False),
('figcmap', 'save contact map (Kirchhoff matrix) figure', False),
Expand All @@ -43,10 +43,10 @@ def prody_anm(pdb, **kwargs):
"""

for key in DEFAULTS:
if not key in kwargs:
if key not in kwargs:
kwargs[key] = DEFAULTS[key]

from os.path import isdir, join
from os.path import isdir, join, exists
outdir = kwargs.get('outdir')
if not isdir(outdir):
raise IOError('{0} is not a valid path'.format(repr(outdir)))
Expand All @@ -57,15 +57,17 @@ def prody_anm(pdb, **kwargs):

selstr = kwargs.get('select')
prefix = kwargs.get('prefix')
cutoff = kwargs.get('cutoff')
sparse = kwargs.get('sparse')
kdtree = kwargs.get('kdtree')
nmodes = kwargs.get('nmodes')
selstr = kwargs.get('select')
model = kwargs.get('model')
altloc = kwargs.get('altloc')
zeros = kwargs.get('zeros')
turbo = kwargs.get('turbo')
membrane = kwargs.get('membrane')

if membrane and not exists(pdb):
pdb = prody.fetchPDBfromOPM(pdb)

pdb = prody.parsePDB(pdb, model=model, altloc=altloc)
if prefix == '_anm':
Expand All @@ -79,38 +81,45 @@ def prody_anm(pdb, **kwargs):
LOGGER.info('{0} atoms will be used for ANM calculations.'
.format(len(select)))

if membrane:
anm = prody.exANM(pdb.getTitle())
else:
anm = prody.ANM(pdb.getTitle())
try:
gamma = float(kwargs.get('gamma'))
LOGGER.info("Using gamma {0}".format(gamma))
except ValueError:
try:
Gamma = eval('prody.' + kwargs.get('gamma'))
gamma = Gamma(select)
LOGGER.info("Using gamma {0}".format(Gamma))
gamma = eval('prody.' + kwargs.get('gamma'))
gamma = gamma(select)
LOGGER.info("Using gamma {0}".format(gamma))
except NameError:
raise NameError("Please provide gamma as a float or ProDy Gamma class")
except TypeError:
raise TypeError("Please provide gamma as a float or ProDy Gamma class")

anm = prody.ANM(pdb.getTitle())

nproc = kwargs.get('nproc')
if nproc:
try:
cutoff = float(kwargs.get('cutoff'))
LOGGER.info("Using cutoff {0}".format(cutoff))
except ValueError:
try:
from threadpoolctl import threadpool_limits
except ImportError:
raise ImportError('Please install threadpoolctl to control threads')
import math
cutoff = eval(kwargs.get('cutoff'))
LOGGER.info("Using cutoff {0}".format(cutoff))
except NameError:
raise NameError("Please provide cutoff as a float or equation using math")
except TypeError:
raise TypeError("Please provide cutoff as a float or equation using math")

with threadpool_limits(limits=nproc, user_api="blas"):
anm.buildHessian(select, cutoff, gamma, sparse=sparse, kdtree=kdtree)
anm.calcModes(nmodes, zeros=zeros, turbo=turbo)
else:
anm.buildHessian(select, cutoff, gamma, sparse=sparse, kdtree=kdtree)
anm.calcModes(nmodes, zeros=zeros, turbo=turbo)
nproc = kwargs.get('nproc')
anm.buildHessian(select, cutoff, gamma, sparse=sparse, kdtree=kdtree)
anm.calcModes(nmodes, zeros=zeros, turbo=turbo, nproc=nproc)

LOGGER.info('Writing numerical output.')

if kwargs.get('outnpz'):
prody.saveModel(anm, join(outdir, prefix))
prody.saveModel(anm, join(outdir, prefix),
matrices=kwargs.get('npzmatrices'))

if kwargs.get('outscipion'):
prody.writeScipionModes(outdir, anm)
Expand Down Expand Up @@ -275,7 +284,7 @@ def addCommand(commands):

group = addNMAParameters(subparser)

group.add_argument('-c', '--cutoff', dest='cutoff', type=float,
group.add_argument('-c', '--cutoff', dest='cutoff', type=str,
default=DEFAULTS['cutoff'], metavar='FLOAT',
help=HELPTEXT['cutoff'] + ' (default: %(default)s)')

Expand Down
Loading

0 comments on commit 653d964

Please sign in to comment.