epam / Indigo

Universal cheminformatics toolkit, utilities and database search tools
http://lifescience.opensource.epam.com
Apache License 2.0
290 stars 99 forks source link

Render api does not faithfully represent chemical structures in PNG #1969

Open ihuang8 opened 1 month ago

ihuang8 commented 1 month ago

Summary

When exporting a chemical structure from ketcher as a PNG, the image created does not match the chemical structures shown in ketcher. SRU polymer brackets are dislocated in the PNG, and hydrogens are represented as HH instead of H2

Steps to Reproduce

I added the following structure to ketcher:

  Ketcher  52424 9162D 1   1.00000     0.00000     0

  8  7  0  0  0  0  0  0  0  0999 V2000
   16.0547   -2.4559    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
   16.9208   -3.9559    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
   16.0547   -3.4559    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   15.1887   -3.9559    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   15.1887   -4.9559    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   14.3227   -5.4559    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   16.0547   -5.4559    0.0000 *   0  0  0  0  0  0  0  0  0  0  0  0
   13.4566   -4.9559    0.0000 *   0  0  0  0  0  0  0  0  0  0  0  0
  1  3  1  0     0  0
  2  3  2  0     0  0
  3  4  1  0     0  0
  4  5  1  0     0  0
  5  6  1  0     0  0
  5  7  1  0     0  0
  6  8  1  0     0  0
M  STY  1   1 SRU
M  SLB  1   1   1
M  SCN  1   1 HT 
M  SMT   1 n
M  SAL   1  6   1   2   3   4   5   6
M  SBL   1  2   6   7
M  SDI   1  4   15.6217   -4.4559   15.6217   -5.9559
M  SDI   1  4   13.8897   -5.9559   13.8897   -4.4559
M  SDS EXP  1   1
M  END
image

When I try to save the structure as a PNG, I get the following:

image

In addition, if I add a hydrogen to the ketcher canvas and save this as an image, the image shows HH instead of H2.

ketcher canvas:

image

PNG:

image

Expected Behavior

I would expect the image created via the indigo render api to faithfully represent the structures created in the ketcher canvas.

Actual Behavior

The ketcher structure and exported image do not match. In the example above, the SRU polymer bracket on the right is in the wrong position and the n is added to the left bracket instead of the right bracket. For hydrogen, the image represents this as HH instead of H2.

Environment details: