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 XML Annotations #22

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

sulheim
Copy link
Contributor

@sulheim sulheim commented Oct 9, 2023

Added a function that parses the XML Annotation data properly. Removed existing code reading it as a string.

Fixes issue #21

Comment

All annotations are now (from the XML annotations) are created as list. Optionally, the annotations that only refer to a single id per databse can be strings, but I thought this was more consistent. Anyway, it is easy to change this.

Demonstration

universe = reframed.load_cbmodel('universe_bacteria.xml')
print(universe.reactions.R_ABTA.metadata)

OrderedDict([('SBOTerm', 'SBO:0000176'),
('ec-code', ['2.6.1.19']),
('rhea', ['23352', '23353', '23354', '23355']),
('biocyc', ['META:GABATRANSAM-RXN']),
('metanetx.reaction', ['MNXR95186']),
('kegg.reaction', ['R01648']),
('seed.reaction', ['rxn01204'])])

print(universe.metabolites.M_glc__D_c.metadata

OrderedDict([('FORMULA', 'C6H12O6'),
('CHARGE', '0'),
('SBOTerm', 'SBO:0000247'),
('kegg.compound', ['C00031']),
('chebi',
['CHEBI:12965', 'CHEBI:17634', 'CHEBI:20999', 'CHEBI:4167']),
('kegg.drug', ['D00009']),
('hmdb', ['HMDB00122', 'HMDB06564']),
('biocyc', ['META:Glucopyranose']),
('metanetx.chemical', ['MNXM41']),
('inchikey', ['WQZGKKKJIJFFOK-GASJEMHNSA-N']),
('seed.compound', ['cpd00027', 'cpd26821'])])

Added a function that parses the XML Annotation data properly. Removed existing code reading it as a string
@cdanielmachado cdanielmachado merged commit e6d4753 into cdanielmachado:master Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants