IUPAC-InChI / RInChI

Repository of the IUPAC - RInChI group
5 stars 3 forks source link

Add option to build without InChI code. #7

Open janholstjensen opened 2 years ago

janholstjensen commented 2 years ago

Having the ability to not link any InChI code into RInChI removes potential issues with symbol clashes and reduces the risk of other build issues.

To make this work, the end user of RInChI would have to provide already-calculated component InChI-s to RInChI, and the current RInChI 1.0 already supports that. So this is mainly a build configuration that should be offered.

uli-f commented 1 year ago

Once this is implemented, will there be an API entry point? In other words, will a method be available that allows to provide already-calculated component InChIs to the native RInChI library and get back the RInChI and the three different keys? And will there also be support for AuxInfo?

janholstjensen commented 1 year ago

There already sort-of-is an entry point for that in the C API, although I will grant that it is not obvious and you will currently have to first stitch together an RInChI string from your pre-calculated InChIs.

Have a look at the Python script src/rinchi_lib/test.py. The inchis_from_rinchi() function splits an RInChI string (and optionally RAuxInfo) and loads the InChIs/AuxInfos of the RInChI into the RInChI reaction components. It does not return keys, but a list of component InChIs as text. At least it will validate that you have built the RInChI input correctly.

To get the keys you can use rinchikey_from_rinchi() - now that you have the RInChI string - to produce the desired key. See the end of test.py for example usage.

uli-f commented 1 year ago

Okay, thank you for the clarification. I'll have a look 👀

I guess what I would ideally be looking for is handing over a bunch of InChIs that have a designated reaction component role and optionally their AuxInfos and getting back the RInChI and the RAuxInfo if AuxInfos were provided.

janholstjensen commented 1 year ago

So, adding something like this to the C API would work, right ?

rinchi_from_inchis(reactant_inchis, product_inchis, agent_inchis)

where the ..._inchis parameters could be strings with linefeed-delimited InChI strings; either

InChI #1
InChI #2

or

InChI #1
AuxInfo #1
InChI #2
AuxInfo #2
uli-f commented 1 year ago

Yes, that sounds good to me! 😃

janholstjensen commented 1 year ago

OK, I'll see what I can do to get that in. 😃

uli-f commented 1 year ago

OK, I'll see what I can do to get that in. 😃

Thank you, much appreciated.

janholstjensen commented 1 year ago

Issue #17 has been created to implement the suggested API function.