def test_all(): """ Large test that calls all functions. :return: None """ print("Testing all functionality") dna_seq1 = dna.convert_to_nodes("ATGCCAATGC") dna_seq2 = dna.deletion(dna_seq1, 3, 5) dna_seq3 = dna.duplication(dna_seq2, 0, 3) dna_seq4 = dna.convert_to_nodes("CC") dna_seq5 = dna.insertion(dna_seq3, dna_seq4, 3) dna_seq6 = dna.substitution(dna_seq5, 7, "T") dna_seq7 = dna.substitution(dna_seq6, 6, "A") print(dna.is_match(dna_seq1, dna_seq7), end=" ") dna_seq8 = dna.insertion(dna_seq3, dna_seq4, 0) dna_seq9 = dna.deletion(dna_seq8, 2, 2) dna_seq10 = dna.substitution(dna_seq9, 6, "C") dna_seq11 = dna.substitution(dna_seq10, 3, "T") print(dna.is_palindrome(dna_seq11), end=" ") dna_seq12 = dna.convert_to_nodes("TACG") dna_seq13 = dna.duplication(dna_seq12, 0, 4) dna_seq14 = dna.duplication(dna_seq13, 3, 1) dna_seq15 = dna.duplication(dna_seq14, 5, 1) print(dna.is_pairing(dna_seq1, dna_seq15), end=" ") print(dna.convert_to_string(dna_seq11) == "CCGTTGCC")
def test6(): """ Tests substitution function. :return: None """ print("Test6: testing substitution") dna_seq = None try: dna_seq = dna.substitution(dna_seq, 0, "A") print("False", end=" ") # failed to catch exception except: print("True", end=" ") dna_seq = linked_code.insert_at(0, "A", dna_seq) dna_seq2 = dna.substitution(dna_seq, 0, "T") print(dna_seq2.value == "T", end=" ") dna_seq = linked_code.insert_at(1, "T", dna_seq) dna_seq2 = dna.substitution(dna_seq, 1, "G") print(dna_seq2.value == "A" and dna_seq2.rest.value == "G", end=" ") dna_seq = linked_code.insert_at(2, "G", dna_seq) dna_seq = linked_code.insert_at(3, "C", dna_seq) try: dna_seq2 = dna.substitution(dna_seq, 4, "A") print("False", end=" ") # failed to catch exception except: print("True", end=" ") dna_seq2 = dna.substitution(dna_seq, 2, "A") print(dna_seq2.value == "A" and dna_seq2.rest.value == "T" \ and dna_seq2.rest.rest.value == "A")