Skip to content

Commit

Permalink
test for #2898
Browse files Browse the repository at this point in the history
  • Loading branch information
orbeckst committed Aug 11, 2020
1 parent 3ea6e43 commit fc09a90
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions testsuite/MDAnalysisTests/analysis/test_dihedrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
import pytest

import MDAnalysis as mda
from MDAnalysisTests.datafiles import (GRO, XTC, DihedralArray, DihedralsArray,
RamaArray, GLYRamaArray, JaninArray,
LYSJaninArray, PDB_rama, PDB_janin)
from MDAnalysisTests.datafiles import (GRO, XTC, TPR, DihedralArray,
DihedralsArray, RamaArray, GLYRamaArray,
JaninArray, LYSJaninArray, PDB_rama,
PDB_janin)
from MDAnalysis.analysis.dihedrals import Dihedral, Ramachandran, Janin


Expand Down Expand Up @@ -106,7 +107,7 @@ def test_outside_protein_length(self, universe):
with pytest.raises(ValueError):
rama = Ramachandran(universe.select_atoms("resid 220"),
check_protein=True).run()

def test_outside_protein_unchecked(self, universe):
rama = Ramachandran(universe.select_atoms("resid 220"),
check_protein=False).run()
Expand All @@ -133,15 +134,26 @@ class TestJanin(object):
def universe(self):
return mda.Universe(GRO, XTC)

@pytest.fixture()
def universe_tpr(self):
return mda.Universe(TPR, XTC)

@pytest.fixture()
def janin_ref_array(self):
return np.load(JaninArray)

def test_janin(self, universe, janin_ref_array):
janin = Janin(universe.select_atoms("protein")).run()
self._test_janin(universe, janin_ref_array)

def test_janin_tpr(self, universe_tpr, janin_ref_array):
"""Test that CYSH are filtered (#2898)"""
self._test_janin(universe_tpr, janin_ref_array)

def _test_janin(self, u, ref_array):
janin = Janin(u.select_atoms("protein")).run()

# Test precision lowered to account for platform differences with osx
assert_almost_equal(janin.angles, janin_ref_array, 3,
assert_almost_equal(janin.angles, ref_array, 3,
err_msg="error: dihedral angles should "
"match test values")

Expand Down

0 comments on commit fc09a90

Please sign in to comment.