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")
transcribed_strands = [] for strand in strands: transcribed_strands.append(helicase.transcribe(strand)) print(transcribed_strands) print("\nRNA Transcription:") transcribed_rna_strands = [] for strand in strands: transcribed_rna_strands.append(helicase.transcribe_to_rna(strand)) print(transcribed_rna_strands) print("\nTranslation:") polypeptides = [] for strand in strands: polypeptides.append(helicase.represent_polypeptide(helicase.translate_unframed_strand(strand),helicase.IUPAC_3)) print(polypeptides) print("\nVerbose Translation:") verbose_polypeptides = [] for strand in strands: verbose_polypeptides.append(helicase.represent_polypeptide(helicase.translate_unframed_strand(strand),helicase.FULL_NAME)) print(verbose_polypeptides) print("\nTerse Translation:") terse_polypeptides = [] for strand in strands: terse_polypeptides.append(helicase.represent_polypeptide(helicase.translate_unframed_strand(strand),helicase.IUPAC_1)) print(terse_polypeptides) print("\n\nStrand -> Transcribed")
def test_represent_polypeptide(self): print("\nBeginning Representation Test.") polypeptide = [helicase.Met, helicase.Pro, helicase.Cys] self.assertEqual(helicase.represent_polypeptide(polypeptide, helicase.IUPAC_1), "MPC") self.assertEqual(helicase.represent_polypeptide(polypeptide, helicase.IUPAC_3), "Met/Pro/Cys") self.assertEqual(helicase.represent_polypeptide(polypeptide, helicase.FULL_NAME), "Methionine, Proline, Cysteine")
def test_represent_polypeptide_raises_valueerror(self): print("\nBeginning Invalid Verbosity Level Test.") with self.assertRaises(ValueError): helicase.represent_polypeptide([helicase.Met, helicase.Pro], 99)