Author: bugman Date: Tue Mar 19 14:50:58 2013 New Revision: 18876 URL: http://svn.gna.org/viewcvs/relax?rev=18876&view=rev Log: Created 13 unit tests of the Internal._trim_helix() internal structural object method. Modified: trunk/test_suite/unit_tests/_generic_fns/_structure/test_internal.py Modified: trunk/test_suite/unit_tests/_generic_fns/_structure/test_internal.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_generic_fns/_structure/test_internal.py?rev=18876&r1=18875&r2=18876&view=diff ============================================================================== --- trunk/test_suite/unit_tests/_generic_fns/_structure/test_internal.py (original) +++ trunk/test_suite/unit_tests/_generic_fns/_structure/test_internal.py Tue Mar 19 14:50:58 2013 @@ -60,6 +60,197 @@ # Reset relax. reset() + + + def test__trim_helix1(self): + """1st test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + + # Residues deleted before the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[1, 2, 3, 22], res_data=res_data) + + # Test that nothing has happened. + self.assertEqual(helix, new_helix) + + + def test__trim_helix2(self): + """2nd test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + + # Residues deleted after the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[51, 52, 53], res_data=res_data) + + # Test that nothing has happened. + self.assertEqual(helix, new_helix) + + + def test__trim_helix3(self): + """3rd test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'GLU', 'A', 24, None, 'GLU', 'A', 34, None, 1, None, 11] + + # Trim the start of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[21, 22, 23], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix4(self): + """4th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'VAL', 'A', 26, None, 'GLU', 'A', 34, None, 1, None, 9] + + # Trim the start of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[21, 22, 23, 24, 25], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix5(self): + """5th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'VAL', 'A', 26, None, 'GLU', 'A', 34, None, 1, None, 9] + + # Trim the start of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[21, 22, 23, 24, 25, 30], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix6(self): + """6th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'VAL', 'A', 26, None, 'GLU', 'A', 34, None, 1, None, 9] + + # Trim the start of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[21, 22, 23, 24, 25, 40], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix7(self): + """7th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'ILE', 'A', 23, None, 'LYS', 'A', 33, None, 1, None, 11] + + # Trim the end of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[34, 35, 36], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix8(self): + """8th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + + # Trim nothing. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[35, 36], res_data=res_data) + + # Test the trimming. + self.assertEqual(helix, new_helix) + + + def test__trim_helix9(self): + """9th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'ILE', 'A', 23, None, 'ILE', 'A', 30, None, 1, None, 8] + + # Trim the end of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[31, 32, 33, 34, 35], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix10(self): + """10th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLN', 'A', 31, None, 1, None, 9] + + # Trim the end of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[24, 32, 33, 34, 35], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix11(self): + """11th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'ASN', 'A', 25, None, 'GLN', 'A', 31, None, 1, None, 6] + + # Trim the both ends of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[22, 23, 24, 32, 33, 34, 35], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix12(self): + """12th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + trimmed_helix = [1, 'H1', 'ASN', 'A', 25, None, 'GLN', 'A', 31, None, 1, None, 6] + + # Trim the both ends of the helix. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[22, 23, 24, 27, 32, 33, 34, 35], res_data=res_data) + + # Test the trimming. + self.assertEqual(trimmed_helix, new_helix) + + + def test__trim_helix13(self): + """13th test of the Internal._trim_helix() method.""" + + # The helix metadata of the internal structural object. + helix = [1, 'H1', 'ILE', 'A', 23, None, 'GLU', 'A', 34, None, 1, None, 12] + + # Trim everything. + res_data = {1: 'MET', 2: 'GLN', 3: 'ILE', 4: 'PHE', 5: 'VAL', 6: 'LYS', 7: 'THR', 8: 'LEU', 9: 'THR', 10: 'GLY', 11: 'LYS', 12: 'THR', 13: 'ILE', 14: 'THR', 15: 'LEU', 16: 'GLU', 17: 'VAL', 18: 'GLU', 19: 'PRO', 20: 'SER', 21: 'ASP', 22: 'THR', 23: 'ILE', 24: 'GLU', 25: 'ASN', 26: 'VAL', 27: 'LYS', 28: 'ALA', 29: 'LYS', 30: 'ILE', 31: 'GLN', 32: 'ASP', 33: 'LYS', 34: 'GLU'} + new_helix = self.data._trim_helix(helix=helix, trim_res_list=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35], res_data=res_data) + + # Test the trimming. + self.assertEqual(None, new_helix) def test_atom_loop(self):