From 3c325ab4a29eb18ebbb3549f622fa5f2b477cc9f Mon Sep 17 00:00:00 2001 From: John Sterrett Date: Mon, 5 Feb 2024 11:26:10 -0700 Subject: [PATCH 1/3] move REACTION to its separate field in PARSE_KO to reflect changes to KEGG API output --- KEGG_parser/parsers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KEGG_parser/parsers.py b/KEGG_parser/parsers.py index 5bcb9ed..c5ba5f1 100644 --- a/KEGG_parser/parsers.py +++ b/KEGG_parser/parsers.py @@ -154,7 +154,8 @@ def split_module_reaction(current_dict, current_entry_name, current_entry_data): PARSE_KO_BY_FIELD = { 'ENTRY': split_entry, 'NAME': split_name_by_comma, 'DEFINITION': return_self, 'PATHWAY': split_and_append, 'MODULE': split_and_append, 'DISEASE': split_and_append, - 'CLASS': add_class, 'DBLINKS': add_nested_dict, 'GENES': add_nested_dict + 'CLASS': add_class, 'DBLINKS': add_nested_dict, 'GENES': add_nested_dict, + 'REACTION': split_and_append } PARSE_RN_BY_FIELD = { @@ -194,7 +195,7 @@ def split_module_reaction(current_dict, current_entry_name, current_entry_data): 'COMPOUND': add_module_orthology, 'COMMENT': return_self, 'DBLINKS': add_nested_dict } -NOT_CAPTURED_KO_FIELDS = ('REFERENCE', 'AUTHORS', 'TITLE', 'JOURNAL', 'SEQUENCE', 'BRITE', 'SYMBOL', 'REACTION', +NOT_CAPTURED_KO_FIELDS = ('REFERENCE', 'AUTHORS', 'TITLE', 'JOURNAL', 'SEQUENCE', 'BRITE', 'SYMBOL', 'NETWORK', 'ELEMENT') NOT_CAPTURED_RN_FIELDS = ('REFERENCE', 'AUTHORS', 'TITLE', 'JOURNAL', 'BRITE') From c056fb4786f4b733841a47c9ba8021d44a534473 Mon Sep 17 00:00:00 2001 From: John Sterrett Date: Mon, 5 Feb 2024 11:35:55 -0700 Subject: [PATCH 2/3] new REACTION field to reflect kegg changes --- tests/test_fixtures.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 70f9dae..15b8046 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -8,8 +8,10 @@ def ko_raw_record(): "PATHWAY ko00000 a fake pathway\n" \ "DISEASE H00000 A bad one\n" \ "CLASS Metabolism; Carbohydrate Metabolism; Glycolysis / Gluconeogenesis[PATH:ko00010]\n" \ - "DBLINKS RN: R00000\n" \ - " COG: COG0000\n" \ + "REACTION R00623 primary_alcohol:NAD+ oxidoreductase\n" \ + " R00754 ethanol:NAD+ oxidoreductase\n" \ + "DBLINKS COG: COG0000\n" \ + " GO: 0004022 0004023 0004024 0004025\n" \ "GENES HSA: hsa00000\n" \ "REFERENCE\n" \ " AUTHORS Fake G.\n" \ From 658e23c3b68153cafd0c2d2ed06192201cc77b0a Mon Sep 17 00:00:00 2001 From: John Sterrett Date: Mon, 5 Feb 2024 11:36:18 -0700 Subject: [PATCH 3/3] update REACTION field in KO test --- tests/test_parse_KEGG.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_parse_KEGG.py b/tests/test_parse_KEGG.py index 852da41..c38ad9b 100644 --- a/tests/test_parse_KEGG.py +++ b/tests/test_parse_KEGG.py @@ -29,9 +29,12 @@ def test_get_from_kegg_rxns(loop, list_of_rxns): def test_parse_ko(ko_raw_record): ko_record = parse_ko(ko_raw_record) - assert len(ko_record) == 8 - assert tuple(ko_record['DBLINKS']['RN']) == tuple(['R00000']) + assert len(ko_record) == 9 + assert tuple(ko_record['REACTION']) == tuple([('R00623', 'primary_alcohol:NAD+ oxidoreductase'), + ('R00754', 'ethanol:NAD+ oxidoreductase') + ]) assert tuple(ko_record['DBLINKS']['COG']) == tuple(['COG0000']) + assert tuple(ko_record['DBLINKS']['GO']) == tuple(["0004022", "0004023", "0004024", "0004025"]) @pytest.fixture()