EnzymeML / PyEnzyme

🧬 - Data management and modeling framework based on EnzymeML.
BSD 2-Clause "Simplified" License
23 stars 9 forks source link

REST API: Unit and creator entries do not appear in the EnzymeML documents #26

Closed StephanM87 closed 2 years ago

StephanM87 commented 2 years ago

When I send a request to the /create Enpoint, containing the following JSON:

JSON ``` { 'name': 'decarboxylation', 'pubmedid': '23232', 'url': 'www.example.com', 'doi': 'doi:10.101012323', 'created': '10.01.2022', 'modified': '11.01.2022', 'vessels': { 'vessel1': { 'name': 'eppi', 'volume': 1.0, 'unit': 'ml', 'constant': True, 'id': 'v1', 'meta_id': 'asd', 'uri': 'sffdfd', 'creator_id': 'dsffd' }, 'vessel2': { 'name': 'falcon', 'volume': 1.0, 'unit': 'ul', 'constant': True, 'id': 'v2', 'meta_id': 'asd', 'uri': 'sffdfd', 'creator_id': 'a1' } }, 'units': { 'mL': { 'name': 'mL', 'id': 'u0', 'meta_id': 'meta_u0', 'units': [ { 'kind': 'litre', 'exponent': -3.0, 'scale': 0, 'multiplier': 0.0 } ], 'ontology': '' }, 'uL': { 'name': 'uL', 'id': 'u1', 'meta_id': 'meta_u1', 'units': [ { 'kind': 'litre', 'exponent': -6.0, 'scale': 0, 'multiplier': 0.0 } ], 'ontology': '' }, 'mole_l': { 'name': 'mole', 'id': 'u2', 'meta_id': 'meta_u2', 'units': [ { 'kind': 'mole', 'exponent': -9.0, 'scale': 0, 'multiplier': 0.0 } ], 'ontology': 'SBO_0000472' } }, 'creators': { 'creator1': { 'given_name': 'Jan', 'family_name': 'jansen', 'mail': 'sdads', 'id': 'a1' } }, 'proteins': { 'protein_1': { 'name': 'ahas', 'id': 'p0', 'vessel_id': 'v1', 'meta_id': 'adsd', 'init_conc': 0.0, 'constant': True, 'boundary': False, 'unit': 'mmole/l', 'ontology': 'SBO:0000176', 'uri': 'fdsffsd', 'creator_id': 'dsfdfsd', 'sequence': 'ASDF', 'ecnumber': '1.1.1.1', 'organism': 'e.coli', 'organism_tax_id': 'awdwada', 'uniprotid': 'dffdsdf' } }, 'reactants': { 'reactant1': { 'name': 'acetaldehyde', 'id': 's1', 'vessel_id': 'sfdg', 'meta_id': 'sdfsf', 'init_conc': 0.0, 'constant': False, 'boundary': False, 'unit': 'mgram/ml', 'ontology': 'SBO:0000377', 'uri': 'fdfs', 'creator_id': 'sdfds', 'smiles': 'fds', 'inchi': 'sdfdsf', 'chebi_id': 'sefsef' } }, 'reactions': { 'protein_1': { 'name': 'decarboxaltion', 'reversible': True, 'temperature': 37.0, 'temperature_unit': 'Celsius', 'ph': 5.0, 'ontology': 'SBO:0000176', 'id': 'r1', 'meta_id': 'meta_r1', 'uri': 'www.www.', 'creator_id': 'creator_1', 'model': None, 'educts': [ { 'species_id': 'name', 'stoichiometry': 1.0, 'constant': True, 'ontology': 'SBO:0000176' } ], 'products': [ ], 'modifiers': [ ] } }, 'level': 3, 'version': '2' } ```

I receive a EnzymeML document, which looks like this:

EnzymeML ``` - - - - doi:10.101012323 https://identifiers.org/pubmed:23232 www.example.com - - - - - - - - - - - - - - - - ASDF 1.1.1.1 dffdsdf e.coli - - - sdfdsf fds - - - ```

I unfortunately cannot spot the creator or the defined unit? Is there any help?

JR-1991 commented 2 years ago

Thank you for the issue submission Stephan!

Regarding the handling of authors, these are currently not written in the SBML file but to the metadata of the OMEX archive. This is an artifact from PyEnzyme's initial implementation due to an error using libSBML. It is an ongoing ToDo that just yet hasn't been fixed, but will be done in the future. For this, I created a new issue to not lose track.

In terms of units, it is not meant for the user to insert UnitDef objects manually, because that would require a background in libSBML. To dive deeper into the workings of the /create, the source code of the endpoint rebuilds the entire document, where units are individually inferred from the given objects - Just as "regular" PyEnzyme code. Unit definitions are thus parsed from their "string" counterparts, which has some advantages:

Finally, the issue is that I can not remove the "unit"-part from the schema since it is derived from the PyDantic data model by FastAPI . Once I'll figure a way out to discard parts from the scheme, this will definitely be removed.

Hope that helped :-)