Esempio n. 1
0
    def test_input_options(self, tmpdir):
        u = mda.Universe(PDB_HOLE)
        cog = u.select_atoms('protein').center_of_geometry()

        with tmpdir.as_cwd():
            hole2.hole(self.filename,
                       random_seed=self.random_seed,
                       infile='hole.inp',
                       cpoint=cog,
                       ignore_residues=[])

        infile = str(tmpdir.join('hole.inp'))
        with open(infile, 'r') as f:
            contents = f.read()

        hole_input = textwrap.dedent("""
            RADIUS simple2.rad
            SPHPDB hole.sph
            SAMPLE 0.200000
            ENDRAD 22.000000
            IGNORE 
            SHORTO 0
            RASEED 31415
            CPOINT -0.0180961507 -0.0122730583 4.1497999943
            """)

        # don't check filenames
        assert contents.endswith(hole_input)
Esempio n. 2
0
 def test_keep_files(self, tmpdir):
     with tmpdir.as_cwd():
         hole2.hole(self.filename,
                    random_seed=self.random_seed,
                    infile='hole.inp',
                    keep_files=False)
         sphpdbs = tmpdir.join('*.sph')
         assert len(glob.glob(str(sphpdbs))) == 0
         outfiles = tmpdir.join('*.out')
         assert len(glob.glob(str(outfiles))) == 0
         vdwradii = tmpdir.join('simple2.rad')
         assert len(glob.glob(str(vdwradii))) == 0
         pdbfiles = tmpdir.join('*.pdb')
         assert len(glob.glob(str(pdbfiles))) == 0
         oldfiles = tmpdir.join('*.old')
         assert len(glob.glob(str(oldfiles))) == 0
Esempio n. 3
0
 def test_output_level(self, tmpdir):
     with tmpdir.as_cwd():
         with pytest.warns(UserWarning, match="needs to be < 3"):
             profiles = hole2.hole(self.filename,
                                   random_seed=self.random_seed,
                                   output_level=100)
         assert len(profiles) == 0
Esempio n. 4
0
 def test_output_level(self, tmpdir):
     with tmpdir.as_cwd():
         with pytest.warns(UserWarning) as rec:
             profiles = hole2.hole(self.filename,
                                   random_seed=self.random_seed,
                                   output_level=100)
         assert len(rec) == 1
         assert 'needs to be < 3' in rec[0].message.args[0]
         # no profiles
         assert len(profiles) == 0
Esempio n. 5
0
    def test_correct_input(self, tmpdir):
        with tmpdir.as_cwd():
            hole2.hole(self.filename,
                       random_seed=self.random_seed,
                       infile='hole.inp')

        infile = str(tmpdir.join('hole.inp'))
        with open(infile, 'r') as f:
            contents = f.read()

        hole_input = textwrap.dedent("""
            RADIUS simple2.rad
            SPHPDB hole.sph
            SAMPLE 0.200000
            ENDRAD 22.000000
            IGNORE SOL WAT TIP HOH K   NA  CL 
            SHORTO 0
            RASEED 31415
            """)

        # don't check filenames
        assert contents.endswith(hole_input)
Esempio n. 6
0
    def test_correct_profile_values(self, tmpdir):
        with tmpdir.as_cwd():
            profiles = hole2.hole(self.filename, random_seed=self.random_seed)

        values = list(profiles.values())
        assert_equal(len(values), 1, err_msg='Should only have 1 HOLE profile')
        profile = values[0]
        assert_equal(len(profile),
                     self.profile_length,
                     err_msg='Wrong number of points in HOLE profile')
        assert_almost_equal(profile.rxn_coord.mean(),
                            self.rxn_coord_mean,
                            err_msg='Wrong mean HOLE rxn_coord')
        assert_almost_equal(profile.radius.min(),
                            self.radius_min,
                            err_msg='Wrong minimum HOLE radius')
Esempio n. 7
0
 def test_application_error(self, tmpdir):
     with tmpdir.as_cwd():
         with pytest.raises(ApplicationError):
             hole2.hole(self.filename, dcd=DCD)