def H(self, universe, tmpdir):
     with tmpdir.as_cwd():
         H = HOLEtraj(universe,
                      start=self.start,
                      stop=self.stop,
                      raseed=31415)
         H.run()
     return H
예제 #2
0
파일: pore.py 프로젝트: cing/MDGenesis
    def results(self):
        H = HOLEtraj(self.u, step=self.step, executable=self.executable,
                     cvect=[0,0,1], cpoint=True)
        H.run()
        # For all frames, make a Series with average rxncoord
        # and mean across all time points.
        temp_series=[pd.Series(H.profiles[x]["radius"],
                               index=np.round(H.profiles[x]["rxncoord"],1)) for x in H.profiles]

        return pd.DataFrame(temp_series).T
예제 #3
0
    def setUpClass(cls):
        cls.universe = MDAnalysis.Universe(cls.filename)
        if not executable_not_found("hole"):
            with tempdir.in_tempdir():
                H = HOLEtraj(cls.universe, start=cls.start,
                             stop=cls.stop, raseed=31415)
                H.run()
            cls.H = H
        else:
            cls.H = None

        cls.frames = [ts.frame
                      for ts in cls.universe.trajectory[cls.start:cls.stop]]
예제 #4
0
    def test_hole_module_fd_closure(self):
        """test open file descriptors are closed (MDAnalysisTests.analysis.test_hole.TestHoleModule): Issue 129"""
        # If Issue 129 isn't resolved, this function will produce an OSError on
        # the system, and cause many other tests to fail as well.
        #
        # Successful test takes ~10 s, failure ~2 s.

        # Hasten failure by setting "ulimit -n 64" (can't go too low because of open modules etc...)
        import resource

        # ----- temporary hack -----
        # on Mac OS X (on Travis) we run out of open file descriptors
        # before even starting this test (see
        # https://github.com/MDAnalysis/mdanalysis/pull/901#issuecomment-231938093);
        # if this issue is solved by #363 then revert the following
        # hack:
        #
        import platform
        if platform.platform() == "Darwin":
            max_open_files = 512
        else:
            max_open_files = 64
        #
        # --------------------------

        resource.setrlimit(resource.RLIMIT_NOFILE,
                           (max_open_files, self.hard_max_open_files))

        with tempdir.in_tempdir():
            try:
                H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0)
            finally:
                self._restore_rlimits()

            # pretty unlikely that the code will get through 2 rounds if the MDA
            # issue 129 isn't fixed, although this depends on the file descriptor
            # open limit for the machine in question
            try:
                for i in range(2):
                    # will typically get an OSError for too many files being open after
                    # about 2 seconds if issue 129 isn't resolved
                    H.run()
            except OSError as err:
                if err.errno == errno.EMFILE:
                    raise AssertionError(
                        "HOLEtraj does not close file descriptors (Issue 129)")
                raise
            finally:
                # make sure to restore open file limit !!
                self._restore_rlimits()
예제 #5
0
    def test_hole_module_fd_closure(self):
        """test open file descriptors are closed (MDAnalysisTests.analysis.test_hole.TestHoleModule): Issue 129"""
        # If Issue 129 isn't resolved, this function will produce an OSError on
        # the system, and cause many other tests to fail as well.
        #
        # Successful test takes ~10 s, failure ~2 s.

        # Hasten failure by setting "ulimit -n 64" (can't go too low because of open modules etc...)
        import resource

        # ----- temporary hack -----
        # on Mac OS X (on Travis) we run out of open file descriptors
        # before even starting this test (see
        # https://github.com/MDAnalysis/mdanalysis/pull/901#issuecomment-231938093);
        # if this issue is solved by #363 then revert the following
        # hack:
        #
        import platform
        if platform.platform() == "Darwin":
            max_open_files = 512
        else:
            max_open_files = 64
        #
        # --------------------------

        resource.setrlimit(resource.RLIMIT_NOFILE,
                           (max_open_files, self.hard_max_open_files))

        with tempdir.in_tempdir():
            try:
                H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0)
            finally:
                self._restore_rlimits()

            # pretty unlikely that the code will get through 2 rounds if the MDA
            # issue 129 isn't fixed, although this depends on the file descriptor
            # open limit for the machine in question
            try:
                for i in range(2):
                    # will typically get an OSError for too many files being open after
                    # about 2 seconds if issue 129 isn't resolved
                    H.run()
            except OSError as err:
                if err.errno == errno.EMFILE:
                    raise AssertionError("HOLEtraj does not close file descriptors (Issue 129)")
                raise
            finally:
                # make sure to restore open file limit !!
                self._restore_rlimits()
예제 #6
0
    def setUpClass(cls):
        cls.universe = MDAnalysis.Universe(cls.filename)
        if not executable_not_found("hole"):
            with tempdir.in_tempdir():
                H = HOLEtraj(cls.universe,
                             start=cls.start,
                             stop=cls.stop,
                             raseed=31415)
                H.run()
            cls.H = H
        else:
            cls.H = None

        cls.frames = [
            ts.frame for ts in cls.universe.trajectory[cls.start:cls.stop]
        ]
예제 #7
0
    def test_hole_module_fd_closure(self):
        """Issue 129: ensure low level file descriptors to PDB files used by Hole program are properly closed"""
        # If Issue 129 isn't resolved, this function will produce an OSError on
        # the system, and cause many other tests to fail as well.
        #
        # Successful test takes ~10 s, failure ~2 s.
        try:
            # Hasten failure by setting "ulimit -n 64" (can't go too low because of open modules etc...)
            import resource

            resource.setrlimit(resource.RLIMIT_NOFILE, (64, self.hard_max_open_files))
        except ImportError:
            raise NotImplementedError("Test cannot be run without the resource module.")
        import errno
        from MDAnalysis.analysis.hole import HOLEtraj

        os.chdir(self.dir_name)
        try:
            # will need to have the 'hole' command available in the path
            H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0)
        except OSError as err:
            if err.errno == errno.ENOENT:
                raise OSError(errno.ENOENT, "HOLE binary not found")
            raise
        finally:
            self._restore_rlimits()

        # pretty unlikely that the code will get through 2 rounds if the MDA
        # issue 129 isn't fixed, although this depends on the file descriptor
        # open limit for the machine in question
        try:
            for i in xrange(2):
                # will typically get an OSError for too many files being open after
                # about 2 seconds if issue 129 isn't resolved
                H.run()
        except OSError as err:
            if err.errno == errno.EMFILE:
                raise AssertionError("HOLEtraj does not close file descriptors (Issue 129)")
            elif err.errno == errno.ENOENT:
                raise OSError(errno.ENOENT, "HOLE binary not found")
            raise
        finally:
            # make sure to restore open file limit !!
            self._restore_rlimits()
예제 #8
0
    def test_hole_module_fd_closure(self):
        """MDAnalysis.analysis.hole: Issue 129: ensure low level file descriptors to PDB files used by Hole program are properly closed"""
        # If Issue 129 isn't resolved, this function will produce an OSError on
        # the system, and cause many other tests to fail as well.
        #
        # Successful test takes ~10 s, failure ~2 s.
        try:
            # Hasten failure by setting "ulimit -n 64" (can't go too low because of open modules etc...)
            import resource
            resource.setrlimit(resource.RLIMIT_NOFILE,
                               (64, self.hard_max_open_files))
        except ImportError:
            raise NotImplementedError(
                "Test cannot be run without the resource module.")

        with tempdir.in_tempdir():
            try:
                # will need to have the 'hole' command available in the path
                H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0)
            except OSError as err:
                if err.errno == errno.ENOENT:
                    raise OSError(errno.ENOENT, "HOLE binary not found")
                raise
            finally:
                self._restore_rlimits()

            # pretty unlikely that the code will get through 2 rounds if the MDA
            # issue 129 isn't fixed, although this depends on the file descriptor
            # open limit for the machine in question
            try:
                for i in xrange(2):
                    # will typically get an OSError for too many files being open after
                    # about 2 seconds if issue 129 isn't resolved
                    H.run()
            except OSError as err:
                if err.errno == errno.EMFILE:
                    raise AssertionError(
                        "HOLEtraj does not close file descriptors (Issue 129)")
                elif err.errno == errno.ENOENT:
                    raise OSError(errno.ENOENT, "HOLE binary not found")
                raise
            finally:
                # make sure to restore open file limit !!
                self._restore_rlimits()
예제 #9
0
def run_hole_traj(file, outname, name):
    if 'pfht1' in name:
        H = HOLEtraj(file,
                     executable='/home/semccomas/hole2/exe/hole',
                     cvect=[0, 0, 1],
                     cpoint=[51.435, 51.255, 38.52],
                     sample=0.01)  #52.935 #diff cvect for pfht1 and glut3
    elif 'glut' in name:
        H = HOLEtraj(file,
                     executable='/home/semccomas/hole2/exe/hole',
                     cvect=[0, 0, 1],
                     cpoint=[50.035, 51.655, 52.52],
                     sample=0.01)
    ##old H = HOLEtraj(file, executable = '/home/semccomas/hole2/exe/hole', cvect = [0,0,1], cpoint = [50.035, 51.655, 52.52])
    H.run()
    H.save(outname)
예제 #10
0
import matplotlib.pyplot as plt
import matplotlib.cm
import sys
from MDAnalysis.analysis.hole import HOLE, HOLEtraj
from MDAnalysis import Universe
import numpy as np
import pandas as pd 

script_name = sys.argv[0]
top = sys.argv[1]
traj = sys.argv[2]
run = sys.argv[3]

u = Universe(top, traj)
H = HOLEtraj(u, cpoint=True, step=25, cvect=[0,0,1], endrad=9, executable="~/hole2/exe/hole")

if run == 'True':
    H.run()
    H.save(filename='hole.pickle')

else:
    import cPickle
    H.profiles = cPickle.load(open('hole.pickle'))

minrad = H.min_radius()
I9 = []
for q, profile in H:
    d = {'radius':profile.radius, 'coord':profile.rxncoord}
    data = pd.DataFrame(d)
    I9.append(data['radius'][data['coord'].between(56,65,inclusive=True)].min())
##    new_ts = mda.transformations.center_in_box(pore_sel,point=[0,0,0])(ts)
#    u.ts = mda.transformations.center_in_box(pore_sel,point=[0,0,0])(ts)

#rotating

#u2=mda.Universe('.pdb')
#annoying wt sel
#pore_entry_sel=u.select_atoms("resid  186 190 363 241 and name CA")
pore_entry_sel = u.select_atoms("resid 993 352")
#pore_entry_sel=u.select_atoms("resid 334 336 352 and name CA")

pore_start = pore_entry_sel.center_of_mass()
#pore_start=  [160.598007, 158.057007,  163.794006]

print(pore_start)
sphpdb = str(sys.argv[-1])[:-4] + '.sph'

print(sphpdb)

H = HOLEtraj(u,
             cpoint=pore_start,
             cvect=[0, 0, 1],
             executable="~/md/hole2/exe/hole")  # set path to your hole binary

#H = HOLE('./6msm_prot.pdb', executable="~/md/hole2/exe/hole")  # set path to your hole binary
H.run()

os.rename('hole.sph', sphpdb)
#H.collect()
H.plot(linewidth=3, color="black", label=False)
예제 #12
0
 def H(self, universe, tmpdir):
     with tmpdir.as_cwd():
         H = HOLEtraj(universe, start=self.start, stop=self.stop, raseed=31415)
         H.run()
     return H