def test_infers_within_frame_position(self): self.assertEqual( utilities.NucleotideSubstitutionEvent( "c.3A>G").codon_frame_position(one_based=False), 1, ) self.assertEqual( utilities.NucleotideSubstitutionEvent( "c.3A>G").codon_frame_position(one_based=True), 3, )
def test_negative_rna_position_error(self): with self.assertRaises(IndexError): utilities.NucleotideSubstitutionEvent("r.-100a>u")
def test_parses_negative_positions(self): nt = utilities.NucleotideSubstitutionEvent("n.-100A>T") self.assertEqual(nt.position, -100)
def test_parses_prefix(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1A>G").prefix, "c")
def test_formats_event_string_correctly(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1A>G").event, "1A>G") self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1=").event, "1=")
def test_parses_alt_base(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1A>G").alt, "G") self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1=").alt, None)
def test_infers_silent(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1=").silent, True)
def test_parses_ref_base(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1A>G").ref, "A") self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1=").ref, None)
def test_error_negative_position_when_computing_codon_position(self): nt = utilities.NucleotideSubstitutionEvent("c.-1A>G") with self.assertRaises(ValueError): nt.codon_position() with self.assertRaises(ValueError): nt.codon_frame_position()
def test_parses_position(self): self.assertEqual( utilities.NucleotideSubstitutionEvent("c.1A>G").position, 1) self.assertEqual( utilities.NucleotideSubstitutionEvent("c.-1A>G").position, -1)
def test_strips_ws(self): self.assertEqual( utilities.NucleotideSubstitutionEvent(" c.1A>G ").variant, "c.1A>G")
def test_error_invalid_dna_substitution_syntax(self): with self.assertRaises(exceptions.InvalidVariantType): utilities.NucleotideSubstitutionEvent("c.100_101delins")