def tearDown(self): for dcd in [pathDatafile('multi_model_truncated'), pathDatafile('dcd')]: prefix = splitext(split(dcd)[1])[0] for suffix in self.suffixes: fn = join(TEMPDIR, prefix + suffix) if isfile(fn): remove(fn)
def tearDown(self): for dcd in [ pathDatafile('multi_model_truncated'), pathDatafile('dcd') ]: prefix = splitext(split(dcd)[1])[0] for suffix in self.suffixes: fn = join(TEMPDIR, prefix + suffix) if isfile(fn): remove(fn)
def setUp(self): self.output = join(TEMPDIR, 'test_prody_catdcd.dcd') self.dcdpath = pathDatafile('dcd') self.pdbpath = pathDatafile('multi_model_truncated') self.dcd = DCDFile(self.dcdpath) self.ag = parsePDB(self.pdbpath, model=1) self.command = 'catdcd -o ' + self.output self.tearDown()
def testPCACommandPDB(self): dcd = pathDatafile('multi_model_truncated') command = self.command + dcd prefix = splitext(split(dcd)[1])[0] namespace = prody_parser.parse_args(shlex.split(command)) namespace.func(namespace) for suffix in self.suffixes: fn = join(TEMPDIR, prefix + suffix) self.assertTrue(isfile(fn), msg=fn + ' not found')
def testPCACommandPDB(self): dcd = pathDatafile('multi_model_truncated') command = self.command + dcd prefix = splitext(split(dcd)[1])[0] namespace = prody_parser.parse_args(shlex.split(command)) namespace.func(namespace) for suffix in self.suffixes: fn = join(TEMPDIR, prefix + suffix) self.assertTrue(isfile(fn), msg=fn+' not found')
def setUp(self): self.command = ('pca --pdb {pdb} ' '-e -r -o {outdir} -v -z -t all -j ' '-f %8g -d , -x .dat ' '-R -Q -J 1,2 ' '-F png -D 120 -W 5 -H 4 ').format(outdir=TEMPDIR, pdb=pathDatafile('multi_model_truncated')) self.suffixes = [ '_pca_cc.png', '_pca.pca.npz', '_pca_covariance.dat', '_pca_cross-correlations.dat', '_pca_proj_1_2.png', '_pca_evalues.dat', '_pca_proj.dat', '_pca_evectors.dat', '_pca_sf.png', '_pca_extended_all.nmd', '_pca.nmd', ] self.tearDown()
def setUp(self): self.command = ('pca --pdb {pdb} ' '-e -r -o {outdir} -v -z -t all -j ' '-f %8g -d , -x .dat ' '-R -Q -J 1,2 ' '-F png -D 120 -W 5 -H 4 ').format( outdir=TEMPDIR, pdb=pathDatafile('multi_model_truncated')) self.suffixes = [ '_pca_cc.png', '_pca.pca.npz', '_pca_covariance.dat', '_pca_cross-correlations.dat', '_pca_proj_1_2.png', '_pca_evalues.dat', '_pca_proj.dat', '_pca_evectors.dat', '_pca_sf.png', '_pca_extended_all.nmd', '_pca.nmd', ] self.tearDown()
def testMSF(self): dcd = DCDFile(pathDatafile('dcd')) ens = parseDatafile('dcd') ens.superpose() assert_array_almost_equal(calcMSF(dcd), calcMSF(ens), 4)
def testMSFfloat(self): dcd = DCDFile(pathDatafile('dcd'), astype=float) ens = parseDatafile('dcd', astype=float) ens.superpose() assert_array_almost_equal(calcMSF(dcd), calcMSF(ens), 10)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> """This module contains unit tests for fragmenting function and methods.""" __author__ = 'Ahmet Bakan' __copyright__ = 'Copyright (C) 2010-2012 Ahmet Bakan' from prody.tests import TestCase from prody import * from prody.tests.test_datafiles import pathDatafile WHOLE = fetchPDBLigand(pathDatafile('sti'))['ideal'] WHOLE_ALL = WHOLE.all WHOLE_COPY = WHOLE.copy() WHOLE_NOH = WHOLE.noh WHOLE_NOH_COPY = WHOLE_NOH.copy() SPLIT = WHOLE.select('not name N13 N21 C46 C22') SPLIT_COPY = SPLIT.copy() SPLIT_NOH = WHOLE.select('noh and not name N13 N21 C46 C22') SPLIT_NOH_COPY = SPLIT_NOH.copy() class TestFragment(TestCase): def testWhole(self): self.assertEqual(WHOLE.numFragments(), 1)
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> """This module contains unit tests for fragmenting function and methods.""" __author__ = 'Ahmet Bakan' __copyright__ = 'Copyright (C) 2010-2012 Ahmet Bakan' from unittest import TestCase from prody import * from prody.tests.test_datafiles import pathDatafile WHOLE = fetchPDBLigand(pathDatafile('sti'))['ideal'] WHOLE_ALL = WHOLE.all WHOLE_COPY = WHOLE.copy() WHOLE_NOH = WHOLE.noh WHOLE_NOH_COPY = WHOLE_NOH.copy() SPLIT = WHOLE.select('not name N13 N21 C46 C22') SPLIT_COPY = SPLIT.copy() SPLIT_NOH = WHOLE.select('noh and not name N13 N21 C46 C22') SPLIT_NOH_COPY = SPLIT_NOH.copy() class TestFragment(TestCase): def testWhole(self): self.assertEqual(WHOLE.numFragments(), 1)
"""This module contains unit tests for :mod:`.frame` module.""" __author__ = 'Ahmet Bakan' __copyright__ = 'Copyright (C) 2010-2012 Ahmet Bakan' from code import interact from prody.tests import TestCase from numpy import array from numpy.testing import assert_allclose from prody.trajectory import Trajectory from prody.tests.test_datafiles import parseDatafile, pathDatafile DCD = Trajectory(pathDatafile('dcd')) PDB = parseDatafile('multi_model_truncated', model=1) RMSD_ALL = array([0.0, 1.380, 1.745]) RMSD_CARBON = array([0.0, 0.964, 1.148]) class TestSuperpose(TestCase): def setUp(self): DCD.setCoords(PDB.getCoords()) DCD.reset() def testAll(self): rmsd = []
# along with this program. If not, see <http://www.gnu.org/licenses/> """This module contains unit tests for :mod:`.frame` module.""" __author__ = 'Ahmet Bakan' __copyright__ = 'Copyright (C) 2010-2012 Ahmet Bakan' from code import interact from prody.tests import TestCase from numpy import array from numpy.testing import assert_allclose from prody.trajectory import Trajectory from prody.tests.test_datafiles import parseDatafile, pathDatafile DCD = Trajectory(pathDatafile('dcd')) PDB = parseDatafile('multi_model_truncated', model=1) RMSD_ALL = array([0.0, 1.380, 1.745]) RMSD_CARBON = array([0.0, 0.964, 1.148]) class TestSuperpose(TestCase): def setUp(self): DCD.setCoords(PDB.getCoords()) DCD.reset() def testAll(self): rmsd = [] for frame in DCD:
# along with this program. If not, see <http://www.gnu.org/licenses/> """This module contains unit tests for fragmenting function and methods.""" __author__ = 'Ahmet Bakan' __copyright__ = 'Copyright (C) 2010-2012 Ahmet Bakan' from prody.tests import TestCase from numpy import arange from numpy.random import shuffle from prody import * from prody.tests.test_datafiles import pathDatafile AG = prody.parsePDB(pathDatafile('pdb3mht.pdb')) SHUFFLED = arange(len(AG)) SHUFFLED = AtomMap(AG, SHUFFLED) class TestShuffled(TestCase): def testCA(self): self.assertEqual(AG.ca.numAtoms(), SHUFFLED.ca.numAtoms()) def testProtein(self): self.assertEqual(AG.protein.numAtoms(), SHUFFLED.protein.numAtoms())