open-reaction-database / ord-schema

Schema for the Open Reaction Database
https://open-reaction-database.org
Apache License 2.0
95 stars 27 forks source link

Add message helper for setting a compound's name or SMILES #425

Closed connorcoley closed 4 years ago

connorcoley commented 4 years ago

During programmatic definition when manually templating, it can be annoying to keep track of the order of identifiers. For example, remembering whether reaction.inputs['my_input'].components[0].identifiers[0] is the name and ...identifiers[1] is the SMILES or vice versa.

A new message helper that is called as message_helpers.set_name(compound, 'blah') and iterates through the compound's identifiers to locate the one with the NAME type and alter the value would be convenient. Similarly, a function message_helpers.set_smiles that does the same for a SMILES-type compound identifier would be handy.