Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse REACTION as a separate field #19

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading