def test_api_still_works_allframes():
    traj1, traj2, ref = _random_trajs()
    old = OldRMSDFeaturizer(ref)
    new = RMSDFeaturizer(ref)

    data_old = old.fit_transform([traj1, traj2])
    data_new = new.fit_transform([traj1, traj2])

    for do, dn in zip(data_old, data_new):
        np.testing.assert_array_almost_equal(do, dn)
        assert dn.shape == (100, 7)
Example #2
0
def test_api_still_works_allframes():
    traj1, traj2, ref = _random_trajs()
    old = OldRMSDFeaturizer(ref)
    new = RMSDFeaturizer(ref)

    data_old = old.fit_transform([traj1, traj2])
    data_new = new.fit_transform([traj1, traj2])

    for do, dn in zip(data_old, data_new):
        np.testing.assert_array_almost_equal(do, dn)
        assert dn.shape == (100, 7)
def featurize_trajectories(coords, featurizer):
    if featurizer == 'RMSDFeaturizer':
        from msmbuilder.featurizer import RMSDFeaturizer
        feat = RMSDFeaturizer(reference_traj=coords[0])
    elif featurizer == 'DRIDFeaturizer':
        from msmbuilder.featurizer import DRIDFeaturizer
        feat = DRIDFeaturizer()
    elif featurizer == 'ContactFeaturizer':
        from msmbuilder.featurizer import ContactFeaturizer
        feat = ContactFeaturizer(scheme='ca')
    elif featurizer == 'DihedralFeaturizer':
        from msmbuilder.featurizer import DihedralFeaturizer
        feat = DihedralFeaturizer(types=['phi', 'psi'])
    return feat.fit_transform(coords)
def test_api_still_works_names():
    traj1, traj2, ref = _random_trajs()
    old = OldRMSDFeaturizer(trj0=ref, atom_indices=np.arange(50))
    with warnings.catch_warnings(record=True) as w:
        new = RMSDFeaturizer(trj0=ref, atom_indices=np.arange(50))
        assert "deprecated" in str(w[-1].message)
        assert "trj0" in str(w[-1].message)

    data_old = old.fit_transform([traj1, traj2])
    data_new = new.fit_transform([traj1, traj2])

    for do, dn in zip(data_old, data_new):
        np.testing.assert_array_almost_equal(do, dn)
        assert dn.shape == (100, 7)
Example #5
0
def test_api_still_works_names():
    traj1, traj2, ref = _random_trajs()
    old = OldRMSDFeaturizer(trj0=ref, atom_indices=np.arange(50))
    with warnings.catch_warnings(record=True) as w:
        new = RMSDFeaturizer(trj0=ref, atom_indices=np.arange(50))
        assert "deprecated" in str(w[-1].message)
        assert "trj0" in str(w[-1].message)

    data_old = old.fit_transform([traj1, traj2])
    data_new = new.fit_transform([traj1, traj2])

    for do, dn in zip(data_old, data_new):
        np.testing.assert_array_almost_equal(do, dn)
        assert dn.shape == (100, 7)
def featurize_trajectories(coords, featurizer):
    '''
    Input
    coords : list of 'MDTrajDataset' object

    Output 
    features : list of arrays, length n_trajs, each of shape (n_samples, n_features)
    '''
    if featurizer == 'RMSDFeaturizer':
        from msmbuilder.featurizer import RMSDFeaturizer
        feat = RMSDFeaturizer(reference_traj=coords[0])
    elif featurizer == 'DRIDFeaturizer':
        from msmbuilder.featurizer import DRIDFeaturizer
        feat = DRIDFeaturizer()
    elif featurizer == 'ContactFeaturizer':
        from msmbuilder.featurizer import ContactFeaturizer
        feat = ContactFeaturizer(scheme='ca')
    elif featurizer == 'DihedralFeaturizer':
        from msmbuilder.featurizer import DihedralFeaturizer
        feat = DihedralFeaturizer(types=['phi', 'psi'])
    return feat.fit_transform(coords)