IUPAC-InChI / RInChI

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

Different behaviour with no-structures #24

Open fbaensch-beilstein opened 4 weeks ago

fbaensch-beilstein commented 4 weeks ago

Is there a reason why reactions that only contain no-structures are sometimes handled differently?

For example, an ‘empty’ RInChI with the no-struct flag is returned for this rxn file (RInChI=1.00.1S//d+/u1-1-0):

Empty_Rinchi $RXN ISIS 012320160130 1 1 $MOL -ISIS- 01231601302D 0 0 0 0 0 0 0 0 0 0999 V2000 M END $MOL -ISIS- 01231601302D 1 0 0 0 0 0 0 0 0 0999 V2000 8.5292 -2.7458 0.0000 A 0 0 0 0 0 0 0 0 0 0 0 0 M END

However, an error is thrown for this reaction file, which also contains two no-struct flags:

Error_reaction $RXN ISIS 012320160139 1 1 $MOL -ISIS- 01231601392D 6 6 0 0 0 0 0 0 0 0999 V2000 1.4416 -1.8375 0.0000 C 0 0 0 0 0 0 0 0 0 4 0 0 2.2666 -1.8375 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 2.5234 -1.0534 0.0000 C 0 0 0 0 0 0 0 0 0 3 0 0 1.8541 -0.5667 0.0000 C 0 0 3 0 0 0 0 0 0 2 0 0 1.1891 -1.0534 0.0000 C 0 0 0 0 0 0 0 0 0 5 0 0 1.8529 0.2583 0.0000 R 0 0 0 0 0 0 0 0 0 1 0 0 2 3 1 0 0 0 0 3 4 1 0 0 0 0 4 5 1 0 0 0 0 5 1 1 0 0 0 0 1 2 1 0 0 0 0 4 6 1 0 0 0 0 M END $MOL -ISIS- 01231601392D 6 6 0 0 0 0 0 0 0 0999 V2000 6.2833 -1.8375 0.0000 C 0 0 0 0 0 0 0 0 0 4 0 0 7.1083 -1.8375 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 7.3651 -1.0534 0.0000 C 0 0 0 0 0 0 0 0 0 3 0 0 6.6958 -0.5667 0.0000 C 0 0 3 0 0 0 0 0 0 2 0 0 6.0308 -1.0534 0.0000 C 0 0 0 0 0 0 0 0 0 5 0 0 6.6945 0.2583 0.0000 A 0 0 0 0 0 0 0 0 0 1 0 0 2 3 1 0 0 0 0 3 4 1 0 0 0 0 4 5 1 0 0 0 0 5 1 1 0 0 0 0 1 2 1 0 0 0 0 4 6 1 0 0 0 0 M END

In my opinion, an ‘empty’ RInChI should also be returned for the second file.

janholstjensen commented 4 weeks ago

Thanks for the report. From just eye-balling the "Error_reaction" file it doesn't look like two No-Structures (?). I would assume that the error is caused by the R-atom in the first molfile.

Can you attach the examples as text files ? Then I will try to reproduce.

fbaensch-beilstein commented 4 weeks ago

So far, I have understood a no-structure in the context of the RInChI to mean that if no InChI can be generated for a structure, a ‘no-structure’ component is generated. However, this may simply be a comprehension problem on my part.

Please find both files attached, masked with .txt extension: empty_rinchi.rxn.txt error_reaction.rxn.txt

janholstjensen commented 1 week ago

"empty_rinchi.rxn.txt"

This RXN file is perceived as two No-Structure-s since the second structure is a single 'A' atom and thus equivalent to a No-Structure from RInChI's point of view (see issue #23).

"error_reaction.rxn.txt"

The R-atom in the first input structure causes InChI generation to fail. The InChI library returns a szMessage of "Unknown element(s): R" but that message is not propagated as part of the error message of RInChI.

If the input structures are swapped, the InChI library fails with a message "Unknown element(s): A", but RInChI simply returns "Error: no InChI has been created.".

This behavior is not helpful and will be changed so the InChI error messages are propagated.

janholstjensen commented 1 week ago

Labelled as "documentation" issue as issue #23 covers the bug/behavior seen by these example files. The original issue name and first comment describes the documentation issue seen by example files in #24.