Exemple #1
0
 def test_no_atom_masses(self, universe):
     #if no masses are present
     u = mda.Universe.empty(6,
                            2,
                            atom_resindex=[0, 0, 0, 1, 1, 1],
                            trajectory=True)
     with pytest.warns(SelectionWarning):
         align.get_matching_atoms(u.atoms, u.atoms)
Exemple #2
0
 def test_one_universe_has_masses(self, universe):
     u = mda.Universe.empty(6,
                            2,
                            atom_resindex=[0, 0, 0, 1, 1, 1],
                            trajectory=True)
     ref = mda.Universe.empty(6,
                              2,
                              atom_resindex=[0, 0, 0, 1, 1, 1],
                              trajectory=True)
     ref.add_TopologyAttr('masses')
     with pytest.warns(SelectionWarning):
         align.get_matching_atoms(u.atoms, ref.atoms)
 def test_nomatch_atoms_raise(self, universe, reference,
                              strict, selection="protein and backbone"):
     # one atom less but same residues; with strict=False should try
     # to get selections (but current code fails, so we also raise SelectionError)
     ref = reference.select_atoms(selection).atoms[1:]
     mobile = universe.select_atoms(selection)
     if strict:
         with pytest.raises(SelectionError):
             groups = align.get_matching_atoms(ref, mobile, strict=strict)
     else:
         with pytest.warns(SelectionWarning):
             with pytest.raises(SelectionError):
                 groups = align.get_matching_atoms(ref, mobile, strict=strict)
Exemple #4
0
 def test_nomatch_atoms_raise(self, universe, reference,
                              strict, selection="protein and backbone"):
     # one atom less but same residues; with strict=False should try
     # to get selections (but current code fails, so we also raise SelectionError)
     ref = reference.select_atoms(selection).atoms[1:]
     mobile = universe.select_atoms(selection)
     if strict:
         with pytest.raises(SelectionError):
             groups = align.get_matching_atoms(ref, mobile, strict=strict)
     else:
         with pytest.warns(SelectionWarning):
             with pytest.raises(SelectionError):
                 groups = align.get_matching_atoms(ref, mobile, strict=strict)
 def test_nomatch_residues_raise_empty(self, universe, reference_small,
                                       strict, selection="protein and backbone"):
     # one atom less and all residues different: will currently create
     # empty selections with strict=False, see also
     # https://gist.github.com/orbeckst/2686badcd15031e6c946baf9164a683d
     ref = reference_small.select_atoms(selection)
     mobile = universe.select_atoms(selection)
     if strict:
         with pytest.raises(SelectionError):
             groups = align.get_matching_atoms(ref, mobile, strict=strict)
     else:
         with pytest.warns(SelectionWarning):
             with pytest.raises(SelectionError):
                 groups = align.get_matching_atoms(ref, mobile, strict=strict)
Exemple #6
0
 def test_nomatch_residues_raise_empty(self, universe, reference_small,
                                       strict, selection="protein and backbone"):
     # one atom less and all residues different: will currently create
     # empty selections with strict=False, see also
     # https://gist.github.com/orbeckst/2686badcd15031e6c946baf9164a683d
     ref = reference_small.select_atoms(selection)
     mobile = universe.select_atoms(selection)
     if strict:
         with pytest.raises(SelectionError):
             groups = align.get_matching_atoms(ref, mobile, strict=strict)
     else:
         with pytest.warns(SelectionWarning):
             with pytest.raises(SelectionError):
                 groups = align.get_matching_atoms(ref, mobile, strict=strict)
Exemple #7
0
 def test_match(self,
                universe,
                reference,
                strict,
                selection="protein and backbone"):
     ref = reference.select_atoms(selection)
     mobile = universe.select_atoms(selection)
     groups = align.get_matching_atoms(ref, mobile, strict=strict)
     assert_equal(groups[0].names, groups[1].names)
Exemple #8
0
 def test_match(self, universe, reference, strict,
                selection="protein and backbone"):
     ref = reference.select_atoms(selection)
     mobile = universe.select_atoms(selection)
     groups = align.get_matching_atoms(ref, mobile, strict=strict)
     assert_equal(groups[0].names, groups[1].names)