def test_ko_record_splitter(self): """ko_record_splitter should split ko lines into a dict of groups""" recs = [rec for rec in ko_record_iterator(TEST_KO_LINES)] split_recs = ko_record_splitter(recs[0]) exp = ['GENES AFM: AFUA_4G13070\n',\ ' PHA: PSHAa2393\n',\ ' ABO: ABO_0668\n',\ ' BXE: Bxe_B0037 Bxe_C0683 Bxe_C1002 Bxe_C1023\n',\ ' MPT: Mpe_A2274\n',\ ' BBA: Bd0910(catD)\n',\ ' GBE: GbCGDNIH1_0998 GbCGDNIH1_1171\n',\ ' FNU: FN1345\n', \ ' RBA: RB13257\n',\ ' HMA: rrnAC1925(mhpC)\n',\ ' RCI: RCIX1162 RCIX2396\n'] self.assertEqual(exp, split_recs["GENES"]) exp = [ 'CLASS Metabolism; Biosynthesis of Secondary Metabolites; Limonene and\n', ' pinene degradation [PATH:ko00903]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Caprolactam\n', ' degradation [PATH:ko00930]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism;\n', ' 1,1,1-Trichloro-2,2-bis(4-chlorophenyl)ethane (DDT) degradation\n', ' [PATH:ko00351]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Benzoate\n', ' degradation via CoA ligation [PATH:ko00632]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Benzoate\n', ' degradation via hydroxylation [PATH:ko00362]\n' ]
def test_ko_record_splitter(self): """ko_record_splitter should split ko lines into a dict of groups""" recs=[rec for rec in ko_record_iterator(TEST_KO_LINES)] split_recs = ko_record_splitter(recs[0]) exp = ['GENES AFM: AFUA_4G13070\n',\ ' PHA: PSHAa2393\n',\ ' ABO: ABO_0668\n',\ ' BXE: Bxe_B0037 Bxe_C0683 Bxe_C1002 Bxe_C1023\n',\ ' MPT: Mpe_A2274\n',\ ' BBA: Bd0910(catD)\n',\ ' GBE: GbCGDNIH1_0998 GbCGDNIH1_1171\n',\ ' FNU: FN1345\n', \ ' RBA: RB13257\n',\ ' HMA: rrnAC1925(mhpC)\n',\ ' RCI: RCIX1162 RCIX2396\n'] self.assertEqual(exp,split_recs["GENES"]) exp = ['CLASS Metabolism; Biosynthesis of Secondary Metabolites; Limonene and\n', ' pinene degradation [PATH:ko00903]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Caprolactam\n', ' degradation [PATH:ko00930]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism;\n', ' 1,1,1-Trichloro-2,2-bis(4-chlorophenyl)ethane (DDT) degradation\n', ' [PATH:ko00351]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Benzoate\n', ' degradation via CoA ligation [PATH:ko00632]\n', ' Metabolism; Xenobiotics Biodegradation and Metabolism; Benzoate\n', ' degradation via hydroxylation [PATH:ko00362]\n']
def test_ko_record_iterator(self): """ko_record_iterator should iterate over KO records""" recs = [] for rec in ko_record_iterator(TEST_KO_LINES): recs.append(rec) self.assertEqual(len(recs),3) self.assertEqual(len(recs[0]),31) exp = 'ENTRY K01559 KO\n' self.assertEqual(recs[0][0],exp) exp = ' RCI: RCIX1162 RCIX2396\n' self.assertEqual(recs[0][-1],exp) exp = 'ENTRY K01561 KO\n' self.assertEqual(recs[-1][0],exp) exp = ' MSE: Msed_1088\n' self.assertEqual(recs[-1][-1],exp)
def test_ko_record_iterator(self): """ko_record_iterator should iterate over KO records""" recs = [] for rec in ko_record_iterator(TEST_KO_LINES): recs.append(rec) self.assertEqual(len(recs), 3) self.assertEqual(len(recs[0]), 31) exp = 'ENTRY K01559 KO\n' self.assertEqual(recs[0][0], exp) exp = ' RCI: RCIX1162 RCIX2396\n' self.assertEqual(recs[0][-1], exp) exp = 'ENTRY K01561 KO\n' self.assertEqual(recs[-1][0], exp) exp = ' MSE: Msed_1088\n' self.assertEqual(recs[-1][-1], exp)