Example #1
0
 def test_parse_cds_seqfeature_9(self):
     """Verify CDS feature is parsed with 3-part compound location."""
     seqfeature = test_data_utils.create_3_part_seqfeature(
         2,
         10,
         1,
         8,
         20,
         1,
         30,
         50,
         1,
         "CDS",
         qualifiers=self.qualifier_dict)
     cds_ftr = flat_files.parse_cds_seqfeature(seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr.orientation, "F")
     with self.subTest():
         self.assertEqual(cds_ftr.start, -1)
     with self.subTest():
         self.assertEqual(cds_ftr.stop, -1)
     with self.subTest():
         self.assertEqual(cds_ftr.parts, 3)
     with self.subTest():
         self.assertEqual(cds_ftr.coordinate_format, "0_half_open")
     with self.subTest():
         self.assertEqual(cds_ftr.length, 18)
Example #2
0
 def test_parse_cds_seqfeature_6(self):
     """Verify CDS feature is parsed with generic description and
     numbers in various qualifiers."""
     self.seqfeature.qualifiers["product"] = [" ORF2 "]
     self.seqfeature.qualifiers["function"] = [" GP003 "]
     self.seqfeature.qualifiers["note"] = [" 10.4 "]
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_product, "ORF2")
     with self.subTest():
         self.assertEqual(cds_ftr.product, "")
     with self.subTest():
         self.assertEqual(cds_ftr._product_num, "2")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_function, "GP003")
     with self.subTest():
         self.assertEqual(cds_ftr.function, "")
     with self.subTest():
         self.assertEqual(cds_ftr._function_num, "003")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_note, "10.4")
     with self.subTest():
         self.assertEqual(cds_ftr.note, "")
     with self.subTest():
         self.assertEqual(cds_ftr._note_num, "10.4")
Example #3
0
 def test_parse_cds_seqfeature_7(self):
     """Verify CDS feature is parsed with non-generic description and
     no numbers in various qualifiers."""
     self.seqfeature.qualifiers["product"] = [" terminase "]
     self.seqfeature.qualifiers["function"] = [" repressor "]
     self.seqfeature.qualifiers["note"] = [" lysin "]
     self.seqfeature.qualifiers["gene"] = [" terL "]
     self.seqfeature.qualifiers["locus_tag"] = ["SEA_L5_A"]
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_A")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_product, "terminase")
     with self.subTest():
         self.assertEqual(cds_ftr.product, "terminase")
     with self.subTest():
         self.assertEqual(cds_ftr._product_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_function, "repressor")
     with self.subTest():
         self.assertEqual(cds_ftr.function, "repressor")
     with self.subTest():
         self.assertEqual(cds_ftr._function_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_note, "lysin")
     with self.subTest():
         self.assertEqual(cds_ftr.note, "lysin")
     with self.subTest():
         self.assertEqual(cds_ftr._note_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.gene, "terL")
     with self.subTest():
         self.assertEqual(cds_ftr._gene_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.name, "terL")
Example #4
0
 def test_parse_cds_seqfeature_5(self):
     """Verify CDS feature is parsed with no product, function, note, and gene."""
     self.qualifier_dict.pop("product")
     self.qualifier_dict.pop("note")
     self.qualifier_dict.pop("function")
     self.qualifier_dict.pop("gene")
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr.name, "1")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_product, "")
     with self.subTest():
         self.assertEqual(cds_ftr.product, "")
     with self.subTest():
         self.assertEqual(cds_ftr._product_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_function, "")
     with self.subTest():
         self.assertEqual(cds_ftr.function, "")
     with self.subTest():
         self.assertEqual(cds_ftr._function_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_note, "")
     with self.subTest():
         self.assertEqual(cds_ftr.note, "")
     with self.subTest():
         self.assertEqual(cds_ftr._note_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.gene, "")
     with self.subTest():
         self.assertEqual(cds_ftr._gene_num, "")
Example #5
0
 def test_parse_cds_seqfeature_4(self):
     """Verify CDS feature is parsed with no translation table."""
     self.qualifier_dict.pop("transl_table")
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr.translation_table, 0)
Example #6
0
 def test_parse_cds_seqfeature_8(self):
     """Verify CDS feature is parsed with no gene."""
     self.qualifier_dict.pop("gene")
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr._locus_tag_num, "1")
     with self.subTest():
         self.assertEqual(cds_ftr.gene, "")
     with self.subTest():
         self.assertEqual(cds_ftr.name, "1")
Example #7
0
 def test_parse_cds_seqfeature_1(self):
     """Verify CDS feature is parsed."""
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr._locus_tag_num, "1")
     with self.subTest():
         self.assertEqual(cds_ftr.orientation, "F")
     with self.subTest():
         self.assertEqual(cds_ftr.start, 2)
     with self.subTest():
         self.assertEqual(cds_ftr.stop, 10)
     with self.subTest():
         self.assertEqual(cds_ftr.parts, 1)
     with self.subTest():
         self.assertEqual(cds_ftr.coordinate_format, "0_half_open")
     with self.subTest():
         self.assertEqual(cds_ftr.translation, "ABCDE")
     with self.subTest():
         self.assertEqual(cds_ftr.translation_length, 5)
     with self.subTest():
         self.assertEqual(cds_ftr.length, 18)
     with self.subTest():
         self.assertEqual(cds_ftr.translation_table, 11)
     with self.subTest():
         self.assertEqual(cds_ftr.raw_product, "gp3; terminase")
     with self.subTest():
         self.assertEqual(cds_ftr.product, "gp3; terminase")
     with self.subTest():
         self.assertEqual(cds_ftr._product_num, "3")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_function, "orf4; repressor")
     with self.subTest():
         self.assertEqual(cds_ftr.function, "orf4; repressor")
     with self.subTest():
         self.assertEqual(cds_ftr._function_num, "4")
     with self.subTest():
         self.assertEqual(cds_ftr.raw_note, "ORF5; lysin")
     with self.subTest():
         self.assertEqual(cds_ftr._note_num, "5")
     with self.subTest():
         self.assertEqual(cds_ftr.note, "ORF5; lysin")
     with self.subTest():
         self.assertEqual(cds_ftr.gene, "GP2")
     with self.subTest():
         self.assertEqual(cds_ftr._gene_num, "2")
     with self.subTest():
         self.assertTrue(isinstance(cds_ftr.seqfeature, SeqFeature))
     with self.subTest():
         self.assertEqual(cds_ftr.name, "1")
Example #8
0
 def test_parse_cds_seqfeature_2(self):
     """Verify CDS feature is parsed with no locus tag."""
     self.qualifier_dict.pop("locus_tag")
     cds_ftr = flat_files.parse_cds_seqfeature(self.seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.start, 2)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "")
     with self.subTest():
         self.assertEqual(cds_ftr._locus_tag_num, "")
     with self.subTest():
         self.assertEqual(cds_ftr.gene, "GP2")
     with self.subTest():
         self.assertEqual(cds_ftr.name, "2")
Example #9
0
 def test_parse_cds_seqfeature_10(self):
     """Verify CDS feature is parsed with fuzzy coordinates."""
     seqfeature = test_data_utils.create_1_part_seqfeature(
         2, 10, 1, "CDS", fuzzy="start", qualifiers=self.qualifier_dict)
     cds_ftr = flat_files.parse_cds_seqfeature(seqfeature)
     with self.subTest():
         self.assertEqual(cds_ftr.locus_tag, "SEA_L5_1")
     with self.subTest():
         self.assertEqual(cds_ftr.orientation, "F")
     with self.subTest():
         self.assertEqual(cds_ftr.start, -1)
     with self.subTest():
         self.assertEqual(cds_ftr.stop, 10)
     with self.subTest():
         self.assertEqual(cds_ftr.parts, 1)
     with self.subTest():
         self.assertEqual(cds_ftr.coordinate_format, "0_half_open")
     with self.subTest():
         self.assertEqual(cds_ftr.length, 18)