コード例 #1
0
 def test_build_alphabet_map_w_alphabet_id(self):
     """build_alphabet_map: returns correct dict when given alphabet_id
     """
     expected = dict([
         ("G", "G"),
         ("A", "G"),
         ("V", "G"),
         ("L", "G"),
         ("I", "G"),
         ("S", "G"),
         ("P", "G"),
         ("T", "G"),
         ("C", "G"),
         ("N", "G"),
         ("D", "G"),
         ("X", "G"),
         ("B", "G"),
         ("M", "M"),
         ("F", "M"),
         ("Y", "M"),
         ("W", "M"),
         ("Q", "M"),
         ("K", "M"),
         ("H", "M"),
         ("R", "M"),
         ("E", "M"),
         ("Z", "M"),
     ])
     self.assertEqual(build_alphabet_map("size_2"), expected)
     self.assertEqual(build_alphabet_map("charge_3")["E"], "D")
     self.assertEqual(build_alphabet_map("charge_3")["B"], "A")
     self.assertEqual(build_alphabet_map("charge_3")["K"], "K")
コード例 #2
0
 def test_build_alphabet_map_handles_all_ids_and_defs_wo_error(self):
     """build_alphabet_map: handles all pre-defined alphabets w/o error"""
     for alphabet_id, alphabet_def in list(alphabets.items()):
         try:
             build_alphabet_map(alphabet_id=alphabet_id)
         except ValueError:
             raise AssertionError("Failed on id: %s" % alphabet_id)
         try:
             build_alphabet_map(alphabet_def=alphabet_def)
         except ValueError:
             raise AssertionError("Failed on def: %s" % str(alphabet_def))
コード例 #3
0
 def test_build_alphabet_map_w_alphabet_def(self):
     """build_alphabet_map: returns correct dict when given alphabet_def
     """
     expected = dict([
         ("G", "S"),
         ("A", "S"),
         ("V", "S"),
         ("L", "S"),
         ("I", "S"),
         ("S", "S"),
         ("P", "S"),
         ("T", "S"),
         ("C", "S"),
         ("N", "S"),
         ("D", "S"),
         ("X", "S"),
         ("B", "S"),
         ("M", "L"),
         ("F", "L"),
         ("Y", "L"),
         ("W", "L"),
         ("Q", "L"),
         ("K", "L"),
         ("H", "L"),
         ("R", "L"),
         ("E", "L"),
         ("Z", "L"),
     ])
     self.assertEqual(
         build_alphabet_map(
             alphabet_def=[("S", "GAVLISPTCNDXB"), ("L", "MFYWQKHREZ")]),
         expected,
     )