def test_parse_coordinates_8(self): """Verify location of invalid data type is not parsed.""" seqfeature = SeqFeature(None, type="CDS", strand=None) start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, -1) with self.subTest(): self.assertEqual(stop, -1) with self.subTest(): self.assertEqual(parts, 0)
def test_parse_coordinates_6(self): """Verify undefined strand 2-part compound location is not parsed.""" seqfeature = test_data_utils.create_2_part_seqfeature( 2, 10, None, 8, 20, None, "CDS") start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, -1) with self.subTest(): self.assertEqual(stop, -1) with self.subTest(): self.assertEqual(parts, 0)
def test_parse_coordinates_3(self): """Verify -1 strand 2-part compound location is parsed correctly.""" seqfeature = test_data_utils.create_2_part_seqfeature( 2, 10, -1, 8, 20, -1, "CDS") start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, 8) with self.subTest(): self.assertEqual(stop, 10) with self.subTest(): self.assertEqual(parts, 2)
def test_parse_coordinates_7(self): """Verify 1 strand 3-part compound location is not parsed.""" seqfeature = test_data_utils.create_3_part_seqfeature( 2, 10, 1, 8, 20, 1, 30, 50, 1, "CDS") start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, -1) with self.subTest(): self.assertEqual(stop, -1) with self.subTest(): self.assertEqual(parts, 3)
def test_parse_coordinates_1(self): """Verify non-compound location is parsed correctly.""" seqfeature = test_data_utils.create_1_part_seqfeature(2, 10, 1, "CDS") output_start, output_stop, parts = \ flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(output_start, 2) with self.subTest(): self.assertEqual(output_stop, 10) with self.subTest(): self.assertEqual(parts, 1)
def test_parse_coordinates_5(self): """Verify -1 strand 2-part compound location that wraps around genome end is parsed correctly.""" # Wrap-around feature, directly copied from # Biopython-parsed Lifes_Draft flat file. # start1 = 0, stop1 = 9, start2 = 58743, stop2 = 59253, strand = -1 seqfeature = test_data_utils.get_lifes_cds_122_seqfeature() start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, 58743) with self.subTest(): self.assertEqual(stop, 9) with self.subTest(): self.assertEqual(parts, 2)
def test_parse_coordinates_4(self): """Verify 1 strand 2-part compound location that wraps around genome end is parsed correctly.""" # Wrap-around feature, directly copied from # Biopython-parsed Alice flat file. # start1 = 152829, stop1 = 153401, start2 = 0, stop2 = 4, strand = 1 seqfeature = test_data_utils.get_alice_cds_252_seqfeature() start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, 152829) with self.subTest(): self.assertEqual(stop, 4) with self.subTest(): self.assertEqual(parts, 2)
def test_parse_coordinates_10(self): """Verify non-compound location with fuzzy stop coordinate is parsed correctly.""" seqfeature = test_data_utils.create_1_part_seqfeature(2, 10, 1, "CDS", fuzzy="stop") start, stop, parts = flat_files.parse_coordinates(seqfeature) with self.subTest(): self.assertEqual(start, 2) with self.subTest(): self.assertEqual(stop, -1) with self.subTest(): self.assertEqual(parts, 1)