def test_ls_AA_in_df(self): df = residue_and_atom.find_AA("*", self.top, return_df=True) idxs = residue_and_atom._ls_AA_in_df("GLU",df) self.assertEqual(idxs,[0,4])
def test_just_numbers(self): np.testing.assert_array_equal(residue_and_atom.find_AA("28", self.geom2frags.top), [5, 13])
def test_doesnt_grab_index(self): idxs = residue_and_atom.find_AA(4, self.top) self.assertEqual(idxs,[])
def test_dataframe(self): from pandas import DataFrame df = residue_and_atom.find_AA("GLU", self.top, return_df=True) self.assertIsInstance(df,DataFrame)
def test_works(self): idxs = residue_and_atom.find_AA("GLU", self.top) self.assertEqual(idxs,[0,4])
def test_ambiguity(self): # AMBIGUOUS definition i.e. each residue is present in multiple fragments self.assertSequenceEqual(residue_and_atom.find_AA("LYS28", self.geom2frags.top), [5, 13]) # getting multiple idxs,as expected self.assertSequenceEqual(residue_and_atom.find_AA("K28", self.geom2frags.top), [5, 13])
def test_rules(self): res = residue_and_atom.find_AA("P0G", self.top)[0] res = self.top.residue(res) CA = residue_and_atom.find_CA(res, CA_dict={"P0G":"CAA"}) assert CA.name=="CAA"
def test_malformed_code(self): with pytest.raises(ValueError): residue_and_atom.find_AA("ARGI200", self.geom.top)
def test_malformed_input(self): with pytest.raises(ValueError): residue_and_atom.find_AA("GLUTAMINE", self.geom.top)
def test_does_not_find_AA(self): assert (residue_and_atom.find_AA("lys20", self.geom.top)) == [] # small case won't give any result assert (residue_and_atom.find_AA('w32', self.geom.top)) == [] # small case won't give any result assert (residue_and_atom.find_AA('w 32', self.geom.top)) == [] # spaces between characters won't work
def test_short_long_AA_code(self): self.assertSequenceEqual(residue_and_atom.find_AA('GLU', self.geom.top), [0, 4])
def test_full_short_AA_code(self): self.assertSequenceEqual(residue_and_atom.find_AA('E30', self.geom.top), [0]) self.assertSequenceEqual(residue_and_atom.find_AA('W32', self.geom.top), [2])
def test_full_long_AA_code(self): self.assertSequenceEqual(residue_and_atom.find_AA("GLU30", self.geom.top), [0]) self.assertSequenceEqual(residue_and_atom.find_AA("LYS29", self.geom.top), [5])