コード例 #1
0
 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,
     )
コード例 #2
0
 def test_negative_rna_position_error(self):
     with self.assertRaises(IndexError):
         utilities.NucleotideSubstitutionEvent("r.-100a>u")
コード例 #3
0
 def test_parses_negative_positions(self):
     nt = utilities.NucleotideSubstitutionEvent("n.-100A>T")
     self.assertEqual(nt.position, -100)
コード例 #4
0
 def test_parses_prefix(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1A>G").prefix, "c")
コード例 #5
0
 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=")
コード例 #6
0
 def test_parses_alt_base(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1A>G").alt, "G")
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1=").alt, None)
コード例 #7
0
 def test_infers_silent(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1=").silent, True)
コード例 #8
0
 def test_parses_ref_base(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1A>G").ref, "A")
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1=").ref, None)
コード例 #9
0
 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()
コード例 #10
0
 def test_parses_position(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.1A>G").position, 1)
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent("c.-1A>G").position, -1)
コード例 #11
0
 def test_strips_ws(self):
     self.assertEqual(
         utilities.NucleotideSubstitutionEvent(" c.1A>G ").variant,
         "c.1A>G")
コード例 #12
0
 def test_error_invalid_dna_substitution_syntax(self):
     with self.assertRaises(exceptions.InvalidVariantType):
         utilities.NucleotideSubstitutionEvent("c.100_101delins")