def sample_ssm_sequence(): return SSMSequences( forward_primer="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING", reverse_primer="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING", gene_of_interest="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING", plasmid=Plasmid( plasmid_sequence="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING"))
def test_ssm_sequence_complex_valid(self): """ Scenario desc: Checking creation of full sequence and finding the offset for long sequence (length=1747) """ sequences = SSMSequences(forward_primer=fw_primer, reverse_primer=rv_primer, gene_of_interest=gene_of_interest, plasmid=Plasmid(plasmid_sequence=plasmid_seq)) result_full_seq, offsets = sequences.get_full_sequence_with_offset() self.assertEqual(result_full_seq, full_seq) self.assertEqual(offsets, (316, 1747))
def test_ssm_sequence_wrong_multiple_goi(self): """ Scenario desc: Gene of interest is found multiple times in the plasmid. We expect error. """ sequences = SSMSequences( forward_primer=fw_primer_short, reverse_primer=rv_primer_short, gene_of_interest=goi_short, plasmid=Plasmid(plasmid_sequence=plasmid_seq_short + goi_short)) with self.assertRaises(ValueError) as context: sequences.get_full_sequence_with_offset() self.assertTrue( 'Gene of interest position is ambiguous' in str(context.exception))
def test_ssm_sequence_wrong_rv_primer(self): """ Scenario desc: Complement to reverse primer is not found in sequence. We expect error. """ sequences = SSMSequences( forward_primer=fw_primer_short, reverse_primer="CCC", gene_of_interest=goi_short, plasmid=Plasmid(plasmid_sequence=plasmid_seq_short)) with self.assertRaises(ValueError) as context: sequences.get_full_sequence_with_offset() self.assertTrue('Reverse primer was not found in plasmid' in str( context.exception))
def test_ssm_sequence_missing_goi(self): """ Scenario desc: Gene of interest is not found in sequence. We expect error. """ sequences = SSMSequences( forward_primer=fw_primer_short, reverse_primer=rv_primer_short, gene_of_interest="GGG", plasmid=Plasmid(plasmid_sequence=plasmid_seq_short)) with self.assertRaises(ValueError) as context: sequences.get_full_sequence_with_offset() self.assertTrue('Gene of interest was not found in plasmid' in str( context.exception))
def test_ssm_sequence_valid_cyclic_seq(self): """ Scenario desc: check offset computation and g.o.i. look-up in cyclic sequence. Sequence has same start/end so here we look more at creating the full sequence. """ sequences = SSMSequences(forward_primer="AAT", reverse_primer="GGC", gene_of_interest="CCC", plasmid=Plasmid(plasmid_sequence="AAA" + plasmid_seq_short + "AAA")) result_full_seq, offsets = sequences.get_full_sequence_with_offset() self.assertEqual(result_full_seq, "AATGTCAAACCCTTTGCC") self.assertEqual(offsets, (9, 12))
def test_ssm_sequence_simple_valid(self): """ Scenario desc: check offset computation and g.o.i. look-up in simple sequence. :return: """ sequences = SSMSequences( forward_primer=fw_primer_short, reverse_primer=rv_primer_short, gene_of_interest="AAA", plasmid=Plasmid(plasmid_sequence=plasmid_seq_short)) result_full_seq, offsets = sequences.get_full_sequence_with_offset() self.assertEqual(result_full_seq, "AATGTCAAACCCTTTGCC") self.assertEqual(offsets, (6, 9))
def test_ssm_sequence_simple_valid_rev(self): """ Scenario desc: check offset computation and g.o.i. look-up in simple sequence. This time the forward primer is after reverse primer in sequence. :return: """ sequences = SSMSequences( forward_primer="GCC", reverse_primer="TTT", gene_of_interest="GTC", plasmid=Plasmid(plasmid_sequence="AATGTCAAACCCTTTGCC")) result_full_seq, offsets = sequences.get_full_sequence_with_offset() self.assertEqual(result_full_seq, "GCCAATGTCAAA") self.assertEqual(offsets, (6, 9))
def create_test_config(goi, plasmid, mutations, use_fast_approximation_algorithm): ssm_data = SSMInput( sequences=SSMSequences( forward_primer="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING", reverse_primer="PLACE_YOUR_OWN_SEQUENCE_FOR_TESTING", gene_of_interest=goi, plasmid=Plasmid(plasmid_sequence=plasmid, )), config=SSMConfig( calculation_method="MaxMutationsCovered", max_three_end_ranges=1, temperature_config=TemperatureConfig(precision=0), use_fast_approximation_algorithm=use_fast_approximation_algorithm), mutations=mutations) return ssm_data
def test_ssm_sequence_goi_outside_primers(self): """ Scenario desc: Gene of interest is not found between forward and revers primer. We expect error. Plasmid sequence: AAT GTC AAA CCC TTT GCC Forward primer: AAT Reverse primer: AAA (reverse is TTT) Gene of interest: GCC (which is after TTT) Sequence specified by primers should be: AAT GTC AAA CCC TTT """ sequences = SSMSequences( forward_primer=fw_primer_short, reverse_primer="AAA", gene_of_interest="GCC", plasmid=Plasmid(plasmid_sequence=plasmid_seq_short)) with self.assertRaises(ValueError) as context: sequences.get_full_sequence_with_offset() self.assertTrue('Gene of interest was not found in plasmid' in str( context.exception))