Ejemplo n.º 1
0
 def make_contact_frequency(self, trajectory):
     """Convenience for making a ContactFrequency object.
     """
     return ContactFrequency(trajectory=trajectory_to_mdtraj(trajectory),
                             query=self.query,
                             haystack=self.haystack,
                             cutoff=self.cutoff)
    def _eval(self, items):
        trajectory = paths.Trajectory(items)

        # create an mdtraj trajectory out of it
        ptraj = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)

        # run the featurizer
        return self._instance.partial_transform(ptraj)
Ejemplo n.º 3
0
    def _eval(self, items):
        trajectory = peng.Trajectory(items)

        # create an mdtraj trajectory out of it
        ptraj = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)

        # run the featurizer
        return self._instance.partial_transform(ptraj)
    def test_trajectory_mdtraj_round_trip(self):
        # first test that the ops trajectory works
        nptest.assert_allclose(self.ops_trajectory.xyz, self.md_trajectory.xyz)
        nptest.assert_allclose(self.ops_trajectory.box_vectors, self.md_trajectory.unitcell_vectors)

        # switch back to mdtraj
        md_trajectory_2 = trajectory_to_mdtraj(self.ops_trajectory, self.md_topology)
        nptest.assert_allclose(self.md_trajectory.xyz, md_trajectory_2.xyz)
        nptest.assert_allclose(self.md_trajectory.unitcell_vectors, md_trajectory_2.unitcell_vectors)
    def test_trajectory_mdtraj_round_trip(self):
        # first test that the ops trajectory works
        nptest.assert_allclose(self.ops_trajectory.xyz, self.md_trajectory.xyz)
        nptest.assert_allclose(self.ops_trajectory.box_vectors,
                               self.md_trajectory.unitcell_vectors)

        # switch back to mdtraj
        md_trajectory_2 = trajectory_to_mdtraj(self.ops_trajectory,
                                               self.md_topology)
        nptest.assert_allclose(self.md_trajectory.xyz, md_trajectory_2.xyz)
        nptest.assert_allclose(self.md_trajectory.unitcell_vectors,
                               md_trajectory_2.unitcell_vectors)
Ejemplo n.º 6
0
    def _check_one_side(self, trajectory, direction, cache=None):
        if len(trajectory) < self.n_frames:
            return False
        traj = trajectory_to_mdtraj(trajectory=trajectory,
                                    md_topology=self.md_topology)
        if not cache:
            subtraj = self.subtraj_for_direction(trajectory, direction)
            contacts = self.make_contact_frequency(subtraj)
        else:
            contacts = cache.updated_contact_frequency(trajectory, direction)

        most_common = \
                contacts.residue_contacts.most_common()[:self.n_contacts]

        return (len(most_common) >= self.n_contacts
                and most_common[-1][1] >= self.frequency)
    def _eval(self, items):
        trajectory = paths.Trajectory(items)

        t = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)
        return self._instance.transform(t)
    def _eval(self, items):
        trajectory = paths.Trajectory(items)

        t = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)
        return self.cv_callable(t, **self.kwargs)
Ejemplo n.º 9
0
    def _eval(self, items):
        trajectory = peng.Trajectory(items)

        t = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)
        return self._instance.transform(t)
Ejemplo n.º 10
0
    def _eval(self, items):
        trajectory = peng.Trajectory(items)

        t = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)
        return self.cv_callable(t, **self.kwargs)
 def test_trajectory_to_mdtraj_other_input(self):
     snap = self.ops_trajectory[0]
     md1 = trajectory_to_mdtraj(snap)
     md2 = trajectory_to_mdtraj([snap])
     assert_equal(md1, md2)
 def test_trajectory_to_mdtraj_other_input(self):
     snap = self.ops_trajectory[0]
     md1 = trajectory_to_mdtraj(snap)
     md2 = trajectory_to_mdtraj([snap])
     assert_equal(md1, md2)