Esempio n. 1
0
def test_init_from_trajectory(GS6_CO, NTL9_CO, GS6_CP, NTL9_CP):
    trajs = [GS6_CO, NTL9_CO]
    proteins = [GS6_CP, NTL9_CP]
    for ct_traj, ct_protein in zip(trajs, proteins):
        protein_from_md = ssprotein.SSProtein(ct_traj)
        assert protein_from_md.n_frames > 0
        assert protein_from_md.n_residues > 0
        assert protein_from_md.length() == ct_protein.length()

        protein_from_ct = ssprotein.SSProtein(ct_traj.traj)
        assert protein_from_ct.n_frames > 0
        assert protein_from_ct.n_residues > 0
        assert protein_from_ct.length() == ct_protein.length()
def test_properties(GS6_CO, NTL9_CO, GS6_CP, NTL9_CP):
    properties = 'resid_with_CA,ncap,ccap,n_frames,n_residues,residue_index_list'.split(
        ',')
    trajs = [GS6_CO, NTL9_CO]
    proteins = [GS6_CP, NTL9_CP]
    for ct_traj, ct_protein in zip(trajs, proteins):
        protein_from_ct = ssprotein.SSProtein(ct_traj)

        for prop in properties:
            assert getattr(protein_from_ct, prop) == getattr(ct_protein, prop)
Esempio n. 3
0
def test_residue_atom_com_new_resid_atom_name_CA(GS6_CO, NTL9_CO):
    trajs = [GS6_CO, NTL9_CO]
    for traj in trajs:
        # instantiate a new protein object since the previous reference is modified
        # elsewhere - hence our residue count will be off.
        protein = ssprotein.SSProtein(traj)
        unavailable_residue_index = protein.n_residues + 1
        protein.residue_atom_com(unavailable_residue_index, atom_name='CA')
        assert len(
            protein._SSProtein__residue_atom_table) == protein.n_residues + 1
def test_init_from_trajectory_invalid():
    args = [1, 1.0, 'test', None]
    for arg in args:
        with pytest.raises(RuntimeError):
            protein = ssprotein.SSProtein(arg)
Esempio n. 5
0
 def lengthen_protein_trajectory(protein_traj, num_copies):
     trajectories = [protein_traj.traj for i in range(num_copies)]
     traj = protein_traj.traj.join(trajectories)
     protein = ssprotein.SSProtein(traj)
     return protein