def test_load_from_file(self): print("\nBeginning File Loading Test.") (handle, filename) = tempfile.mkstemp() handle = open(filename, "w") handle.write("catgtaacc\ncatgccccccccctaatct") handle.close() self.assertEqual(helicase.load_strands_from_file(filename), ['catgtaacc', 'catgccccccccctaatct']) handle.close() os.unlink(filename)
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")
import helicase import logging logging.basicConfig(level=logging.WARNING) print("Loading from File:") strands = helicase.load_strands_from_file("example.dna") print(strands) print("\nFraming:") framed_strands = [] for strand in strands: framed_strands.append(helicase.frame_strand(strand)) print(framed_strands) print("\nTranscription:") 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: