def test_comprehensive(self): logging.debug("\nBeginning Comprehensive Test.-----------") (handle, filename) = tempfile.mkstemp() handle = open(filename, "w") handle.write("CATGTAACC\ncatgccccccccctaatct") handle.close() strands = helicase.load_strands_from_file(filename) self.assertEqual(strands, ['catgtaacc', 'catgccccccccctaatct']) framed_strands = [] for strand in strands: framed_strands.append(helicase.frame_strand(strand)) self.assertEqual(framed_strands, [(['atg', 'taa', 'cc'], 1), (['atg', 'ccc', 'ccc', 'ccc', 'taa', 'tct'], 1)]) polypeptides = [] for strand in framed_strands: polypeptides.append(helicase.translate_framed_strand(strand[0])) self.assertEqual(polypeptides, [[('M', 'Met', 'Methionine')], [('M', 'Met', 'Methionine'), ('P', 'Pro', 'Proline'), ('P', 'Pro', 'Proline'), ('P', 'Pro', 'Proline')]]) polypeptide_representations = [] for polypeptide in polypeptides: polypeptide_representations.append(helicase.represent_polypeptide(polypeptide, 1)) self.assertEqual(polypeptide_representations, ['Met', 'Met/Pro/Pro/Pro']) logging.debug("Done Comprehensive Test.-----------\n")
def test_translate_framed_strand(self): print("\nBeginning Framed Translation Test.") framed_strand = helicase.frame_strand('catgccccccccctaatct')[0] self.assertEqual(helicase.translate_framed_strand(framed_strand), [helicase.Met, helicase.Pro, helicase.Pro, helicase.Pro])