Skip to content

Commit

Permalink
Merge pull request #19 from lozuponelab/reaction_to_newfield
Browse files Browse the repository at this point in the history
Parse REACTION as a separate field
  • Loading branch information
sterrettJD authored Feb 5, 2024
2 parents 2e3bf83 + 658e23c commit 3204d6f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions KEGG_parser/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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')
Expand Down
6 changes: 4 additions & 2 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
7 changes: 5 additions & 2 deletions tests/test_parse_KEGG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3204d6f

Please sign in to comment.