Skip to content

Commit

Permalink
Merge branch 'main' of github.com:prody/ProDy into buildMSA_clustalo
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Dec 3, 2024
2 parents c95c25a + 0945824 commit 696861c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions prody/dynamics/anmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

__all__ = ['runANMD']

def runANMD(atoms, num_modes=2, max_rmsd=2., num_steps=2, tolerance=10.0,
def runANMD(atoms, num_modes=2, max_rmsd=2., num_steps=5, tolerance=10.0,
**kwargs):
"""Runs the ANMD hybrid simulation method ([CM22]_), which generates conformations
along single modes using :func:`.traverseModes` and minimises them.
Expand All @@ -67,7 +67,7 @@ def runANMD(atoms, num_modes=2, max_rmsd=2., num_steps=2, tolerance=10.0,
:type max_rmsd: float
:arg num_steps: number of conformers in each direction for each mode
Default is 2
Default is 5
:type num_steps: int
:arg tolerance: tolerance for energy minimisation in OpenMM
Expand Down
22 changes: 13 additions & 9 deletions prody/measure/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from numpy import ndarray, power, sqrt, array, zeros, arccos, dot
from numpy import sign, tile, concatenate, pi, cross, subtract, var
from numpy import unique, where
from numpy import unique, where, divide, power

from prody.atomic import Atomic, Residue, Atom, extendAtomicData
from prody.kdtree import KDTree
Expand All @@ -16,11 +16,11 @@
if PY2K:
range = xrange

__all__ = ['buildDistMatrix', 'calcDistance',
'calcCenter', 'calcGyradius', 'calcAngle',
'calcDihedral', 'calcOmega', 'calcPhi', 'calcPsi',
'calcMSF', 'calcRMSF',
'calcDeformVector',
__all__ = ['buildDistMatrix', 'calcDistance', 'calcGyradius',
'calcCenter', 'calcAngle', 'calcDihedral',
'getCenter', 'getAngle', 'getDihedral',
'calcOmega', 'calcPhi', 'calcPsi',
'calcMSF', 'calcRMSF', 'calcDeformVector',
'buildADPMatrix', 'calcADPAxes', 'calcADPs',
'pickCentral', 'pickCentralAtom', 'pickCentralConf', 'getWeights',
'calcInertiaTensor', 'calcPrincAxes', 'calcDistanceMatrix',
Expand Down Expand Up @@ -207,13 +207,17 @@ def getDihedral(coords1, coords2, coords3, coords4, radian=False):
a3 = coords4 - coords3

v1 = cross(a1, a2)
v1 = v1 / (v1 * v1).sum(-1)**0.5
v1 = divide(v1, power((v1 * v1).sum(-1), 0.5).reshape(-1,1))
v2 = cross(a2, a3)
v2 = v2 / (v2 * v2).sum(-1)**0.5
v2 = divide(v2, power((v2 * v2).sum(-1), 0.5).reshape(-1,1))
porm = sign((v1 * a3).sum(-1))
rad = arccos((v1*v2).sum(-1) / ((v1**2).sum(-1) * (v2**2).sum(-1))**0.5)
if not porm == 0:
if not all(porm == 0):
rad = rad * porm

if rad.shape[0] == 1:
rad = rad[0]

if radian:
return rad
else:
Expand Down
4 changes: 2 additions & 2 deletions prody/proteins/ciffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ def _parseMMCIFLines(atomgroup, lines, model, chain, subset,
stop = 0
while not doneAtomBlock:
line = lines[i]
if line[:11] == '_atom_site.':
if line.strip()[:11] == '_atom_site.':
fieldCounter += 1
fields[line.split('.')[1].strip()] = fieldCounter
foundAtomFields = True

elif foundAtomFields and line.strip() != '#':
elif foundAtomFields and line.strip() not in ['#', '']:
if not foundAtomBlock:
foundAtomBlock = True
start = i
Expand Down
10 changes: 5 additions & 5 deletions prody/tests/dynamics/test_anmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def testAnmdAtomsWrongType(self):
def testAnmdNumModesWrongType(self):
"""Test response to wrong type *num_modes* argument."""
if prody.PY3K:
self.assertRaises(TypeError, self.runANMD, self.ATOMS, 'nogood')
self.assertRaises(TypeError, self.runANMD, self.ATOMS, 'nogood', num_steps=2)

def testAnmdRmsdWrongType(self):
"""Test response to wrong type *max_rmsd* argument."""
if prody.PY3K:
self.assertRaises(TypeError, self.runANMD, self.ATOMS, max_rmsd='nogood')
self.assertRaises(TypeError, self.runANMD, self.ATOMS, max_rmsd='nogood', num_steps=2)

def testAnmdStepsWrongType(self):
"""Test response to wrong type *num_steps* argument."""
Expand All @@ -47,14 +47,14 @@ def testAnmdStepsWrongType(self):
def testAnmdToleranceWrongType(self):
"""Test response to wrong type *tolerance* argument."""
if prody.PY3K:
self.assertRaises(TypeError, self.runANMD, self.ATOMS, tolerance='nogood')
self.assertRaises(TypeError, self.runANMD, self.ATOMS, tolerance='nogood', num_steps=2)

class TestAnmdResults(TestANMD):

def testResults(self):
"""Test results with default parameters"""
if prody.PY3K:
DEFAULT_RESULTS = runANMD(self.ATOMS)
DEFAULT_RESULTS = runANMD(self.ATOMS, num_steps=2)
ens1 = DEFAULT_RESULTS[0]

assert_equal(len(DEFAULT_RESULTS), 2,
Expand All @@ -70,7 +70,7 @@ def testResults(self):
def testResultsNumModes1(self):
"""Test that num_modes=1 gives 1 ensemble"""
if prody.PY3K:
RESULTS = runANMD(self.ATOMS, num_modes=1)
RESULTS = runANMD(self.ATOMS, num_modes=1, num_steps=2)
assert_equal(len(RESULTS), 1,
'runANMD with num_modes=1 failed to give 1 ensemble')

Expand Down

0 comments on commit 696861c

Please sign in to comment.