def test_over_origin(): current_path = os.path.dirname(__file__) template = seqio.read_dna(os.path.join(current_path, "pMODKan-HO-pACT1GEV.ape")) assert_true(template.topology == "circular") primer1 = design.primer(template[-200:]) primer2 = design.primer(template.reverse_complement()[-200:]) over_origin = reaction.pcr(template, primer1, primer2) expected = template[-200:] + template[0:200] assert_equal(str(over_origin), str(expected))
def test_primer(): '''Test primer function.''' seq = 'ATGGTGAGCAAGGGCGAGGAGCTGTTCACCGGGGTGGTGCCCATCCTGGTCGAGCTGGACGGC' + \ 'GACGTAAACGGCCACAAGTTCAGCGTGTCCGGCGAGGGCGAGGGCGATGCCACCTACGGCAAG' + \ 'CTGACCCTGAAGTTCATCTGCACCACCGGCAAGCTGCCCGTGCCCTGGCCCACCCTCGTGACC' + \ 'ACCTTCGGCTACGGCCTGCAGTGCTTCGCCCGCTACCCCGACCACATGAAGCAGCACGACTTC' + \ 'TTCAAGTCCGCCATGCCCGAAGGCTACGTCCAGGAGCGCACCATCTTCTTCAAGGACGACGGC' + \ 'AACTACAAGACCCGCGCCGAGGTGAAGTTCGAGGGCGACACCCTGGTGAACCGCATCGAGCTG' + \ 'AAGGGCATCGACTTCAAGGAGGACGGCAACATCCTGGGGCACAAGCTGGAGTACAACTACAAC' + \ 'AGCCACAACGTCTATATCATGGCCGACAAGCAGAAGAACGGCATCAAGGTGAACTTCAAGATC' + \ 'CGCCACAACATCGAGGACGGCAGCGTGCAGCTCGCCGACCACTACCAGCAGAACACCCCCATC' + \ 'GGCGACGGCCCCGTGCTGCTGCCCGACAACCACTACCTGAGCTACCAGTCCGCCCTGAGCAAA' + \ 'GACCCCAACGAGAAGCGCGATCACATGGTCCTGCTGGAGTTCGTGACCGCCGCCGGGATCACT' + \ 'CTCGGCATGGACGAGCTGTACAAGTAA' dna_seq = DNA(seq) primer = design.primer(dna_seq, tm=72, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=None) assert_equals(str(primer), 'ATGGTGAGCAAGGGCGAGGAG') # Ensure that overhang is appropriately applied overhang_primer = design.primer(dna_seq, tm=72, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=DNA('GATCGATAT')) assert_equals(str(overhang_primer), 'GATCGATATATGGTGAGCAAGGGCGAGGAG') # If sequence is too short (too low of Tm), raise ValueError too_short = DNA('at') assert_raises(ValueError, design.primer, too_short, tm=72) # Should design different primers (sometimes) if ending on GC is preferred diff_template = DNA('GATCGATCGATACGATCGATATGCGATATGATCGATAT') nogc = design.primer(diff_template, tm=72, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=None) withgc = design.primer(diff_template, tm=72, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=True, tm_parameters='cloning', overhang=None) assert_not_equal(nogc, withgc) # Should raise ValueError if it's impossible to create an end_gc primer end_at_template = DNA('ATGCGATACGATACGCGATATGATATATatatatat' + 'ATAAaaaaaaaaaattttttttTTTTTTTTTTTTTT' + 'TTTTTTTTTT') assert_raises(ValueError, design.primer, end_at_template, end_gc=True, tm=72)