Skip to content

Commit

Permalink
epam#2741 Image missing stereochemistry information when using abbrev…
Browse files Browse the repository at this point in the history
…iations (epam#2742)
  • Loading branch information
jblack-mestre authored Feb 4, 2025
1 parent 8bc1a0f commit 121b7d2
Show file tree
Hide file tree
Showing 7 changed files with 370 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/tests/integration/ref/rendering/render_reactions.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ issue 2512 two short equilibrium half arrows
issue_2512.png rendering status: OK
issue 2513 elliptical-arc-arrow render error
issue_2513.png rendering status: OK
issue 2741 missing stereochemistry
missing_stereochemistry_2741.png rendering status: OK
Original file line number Diff line number Diff line change
@@ -0,0 +1,356 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE CDXML SYSTEM "https://static.chemistry.revvitycloud.com/cdxml/CDXML.dtd" >
<CDXML
CreationProgram="ChemDraw 23.1.1.3"
Name="missing_stereochemistry_2741.cdxml"
BoundingBox="219.76 132.84 460.07 186.64"
WindowPosition="0 0"
WindowSize="0 0"
WindowIsZoomed="yes"
FractionalWidths="yes"
InterpretChemically="yes"
ShowAtomQuery="yes"
ShowAtomStereo="no"
ShowAtomEnhancedStereo="yes"
ShowAtomNumber="no"
ShowResidueID="no"
ShowBondQuery="yes"
ShowBondRxn="yes"
ShowBondStereo="no"
ShowTerminalCarbonLabels="no"
ShowNonTerminalCarbonLabels="no"
HideImplicitHydrogens="no"
LabelFont="3"
LabelSize="10"
LabelFace="96"
CaptionFont="3"
CaptionSize="10"
HashSpacing="2.50"
MarginWidth="1.60"
LineWidth="0.60"
BoldWidth="2"
BondLength="14.40"
BondSpacing="18"
ChainAngle="120"
LabelJustification="Auto"
CaptionJustification="Left"
AminoAcidTermini="HOH"
ShowSequenceTermini="yes"
ShowSequenceBonds="yes"
ShowSequenceUnlinkedBranches="no"
ResidueWrapCount="40"
ResidueBlockCount="10"
PrintMargins="36 36 36 36"
MacPrintInfo="000300000258025800000000132A1906FF9FFF9F138B19670365052803FC000200000258025800000000132A1906000100000064000000010001010100000001270F000100010000000000000000000000000002001901900000000000600000000000000000000100000000000000000000000000000000"
ChemPropName=""
ChemPropFormula="Chemical Formula: "
ChemPropExactMass="Exact Mass: "
ChemPropMolWt="Molecular Weight: "
ChemPropMOverZ="m/z: "
ChemPropAnalysis="Elemental Analysis: "
ChemPropBoilingPt="Boiling Point: "
ChemPropMeltingPt="Melting Point: "
ChemPropCritTemp="Critical Temp: "
ChemPropCritPres="Critical Pres: "
ChemPropCritVol="Critical Vol: "
ChemPropGibbs="Gibbs Energy: "
ChemPropLogP="Log P: "
ChemPropMR="MR: "
ChemPropHenry="Henry&apos;s Law: "
ChemPropEForm="Heat of Form: "
ChemProptPSA="tPSA: "
ChemPropCLogP="CLogP: "
ChemPropCMR="CMR: "
ChemPropLogS="LogS: "
ChemPropPKa="pKa: "
ChemPropID=""
ChemPropFragmentLabel=""
color="0"
bgcolor="1"
RxnAutonumberStart="1"
RxnAutonumberConditions="no"
RxnAutonumberStyle="Roman"
RxnAutonumberFormat="(#)"
><colortable>
<color r="1" g="1" b="1"/>
<color r="0" g="0" b="0"/>
<color r="1" g="0" b="0"/>
<color r="1" g="1" b="0"/>
<color r="0" g="1" b="0"/>
<color r="0" g="1" b="1"/>
<color r="0" g="0" b="1"/>
<color r="1" g="0" b="1"/>
</colortable><fonttable>
<font id="3" charset="iso-8859-1" name="Arial"/>
</fonttable><page
id="108"
BoundingBox="0 0 720 540"
HeaderPosition="36"
FooterPosition="36"
PrintTrimMarks="yes"
HeightPages="1"
WidthPages="1"
><fragment
id="28"
BoundingBox="219.76 157.35 266.82 175.24"
Z="61"
><n
id="25"
p="231.59 166.05"
Z="60"
AS="N"
AtomID="1"
/><n
id="33"
p="245.29 161.60"
Z="62"
AS="N"
AtomID="2"
/><n
id="40"
p="219.94 157.59"
Z="64"
AS="N"
AtomID="3"
/><n
id="93"
p="255.99 171.24"
Z="109"
NodeType="Fragment"
NeedsClean="yes"
AS="N"
AtomID="4"
><fragment
id="109"
><n
id="98"
p="255.99 171.24"
Z="12"
/><n
id="99"
p="266.65 180.84"
Z="13"
Element="7"
NumHydrogens="0"
NeedsClean="yes"
><t
p="263.04 184.74"
BoundingBox="263.04 176.40 270.26 184.74"
LabelJustification="Left"
><s font="3" size="10" color="0" face="96">N</s></t></n><n
id="100"
p="245.32 161.63"
Z="14"
NodeType="ExternalConnectionPoint"
/><b
id="101"
Z="15"
B="98"
E="99"
Order="3"
/><b
id="102"
Z="16"
B="100"
E="98"
/></fragment><t
p="252.38 175.14"
BoundingBox="252.38 166.68 266.82 175.24"
LabelJustification="Left"
LabelAlignment="Left"
><s font="3" size="10" color="0" face="96">CN</s></t></n><b
id="39"
Z="63"
B="33"
E="25"
Order="2"
BS="E"
BondCircularOrdering="94 0 41 0"
/><b
id="41"
Z="65"
B="25"
E="40"
BS="N"
/><b
id="94"
Z="110"
B="33"
E="93"
BS="N"
/></fragment><fragment
id="61"
BoundingBox="418.56 132.84 460.07 186.64"
Z="85"
><n
id="62"
p="431.09 155.55"
Z="83"
Geometry="Tetrahedral"
AS="S"
BondOrdering="80 84 0 85"
AtomID="5"
/><n
id="63"
p="431.09 169.95"
Z="84"
AS="N"
AtomID="6"
/><n
id="64"
p="444.79 174.40"
Z="86"
Element="7"
NumHydrogens="1"
NeedsClean="yes"
AS="N"
AtomID="7"
><t
p="441.18 178.30"
BoundingBox="441.18 169.96 448.40 186.64"
LabelJustification="Left"
LabelAlignment="Below"
LineStarts="2 3"
><s font="3" size="10" color="0" face="96">NH</s></t></n><n
id="65"
p="453.25 162.75"
Z="87"
AS="N"
AtomID="8"
/><n
id="66"
p="444.79 151.10"
Z="88"
Geometry="Tetrahedral"
AS="S"
BondOrdering="84 83 86 0"
AtomID="9"
/><n
id="67"
p="419.44 147.09"
Z="94"
AS="N"
AtomID="10"
/><n
id="68"
p="449.24 137.40"
Z="96"
NodeType="Fragment"
NeedsClean="yes"
AS="N"
AtomID="11"
><fragment
id="110"
><n
id="70"
p="449.24 137.40"
Z="78"
/><n
id="71"
p="453.67 123.76"
Z="79"
Element="7"
NumHydrogens="0"
NeedsClean="yes"
><t
p="450.06 127.66"
BoundingBox="450.06 119.32 457.28 127.66"
LabelJustification="Left"
><s font="3" size="10" color="0" face="96">N</s></t></n><n
id="72"
p="444.80 151.05"
Z="80"
NodeType="ExternalConnectionPoint"
ExternalConnectionNum="1"
/><b
id="73"
Z="81"
B="70"
E="71"
Order="3"
/><b
id="74"
Z="82"
B="72"
E="70"
Display="WedgedHashBegin"
/></fragment><t
p="445.63 141.30"
BoundingBox="445.63 132.84 460.07 141.40"
LabelJustification="Left"
LabelAlignment="Left"
><s font="3" size="10" color="0" face="96">CN</s></t></n><b
id="80"
Z="89"
B="62"
E="63"
BS="N"
/><b
id="81"
Z="90"
B="63"
E="64"
BS="N"
/><b
id="82"
Z="91"
B="64"
E="65"
BS="N"
/><b
id="83"
Z="92"
B="65"
E="66"
BS="N"
/><b
id="84"
Z="93"
B="66"
E="62"
BS="N"
/><b
id="85"
Z="95"
B="62"
E="67"
Display="WedgeBegin"
BS="N"
/><b
id="86"
Z="97"
B="66"
E="68"
Display="WedgedHashBegin"
BS="N"
/></fragment><graphic
id="105"
SupersededBy="111"
BoundingBox="367.60 160.50 300 160.50"
Z="77"
GraphicType="Line"
ArrowType="FullHead"
HeadSize="1500"
/><scheme
id="112"
><step
id="113"
ReactionStepReactants="28"
ReactionStepProducts="61"
ReactionStepArrows="105"
/></scheme><arrow
id="111"
BoundingBox="300 157.50 367.60 162.75"
Z="77"
FillType="None"
ArrowheadHead="Full"
ArrowheadType="Solid"
HeadSize="1500"
ArrowheadCenterSize="1313"
ArrowheadWidth="375"
Head3D="367.60 160.50 0"
Tail3D="300 160.50 0"
Center3D="517.60 240.75 0"
MajorAxisEnd3D="585.21 240.75 0"
MinorAxisEnd3D="517.60 308.35 0"
/></page></CDXML>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions api/tests/integration/tests/rendering/render_reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ def renderRxnfile(filename, outfile):
renderer.renderToFile(rxn, joinPathPy("out/" + png_fname, __file__))
print(checkImageSimilarity(png_fname))

print("issue 2741 missing stereochemistry")
indigo.resetOptions()
indigo.setOption("render-output-format", "png")
fname = "missing_stereochemistry_2741"
png_fname = fname + ".png"
cdxml_fname = joinPathPy("reactions/%s.cdxml" % fname, __file__)
rxn = indigo.loadReactionFromFile(cdxml_fname)
renderer.renderToFile(rxn, joinPathPy("out/" + png_fname, __file__))
print(checkImageSimilarity(png_fname))

if isIronPython():
renderer.Dispose()
indigo.Dispose()
3 changes: 2 additions & 1 deletion core/render2d/src/render_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,9 @@ void MoleculeRenderInternal::_prepareSGroups(bool collapseAtLeastOneSuperatom)
else
{
Molecule& amol = mol.asMolecule();
bondID = amol.addBond(superAtomID, neighboringAtomID, amol.getBondOrder(neighboringBondID));
bondID = amol.addBond(neighboringAtomID, superAtomID, amol.getBondOrder(neighboringBondID));
amol.setEdgeTopology(bondID, amol.getBondTopology(neighboringBondID));
amol.setBondDirection(bondID, mol.getBondDirection(neighboringBondID));
}
if (_bondMappingInv.find(bondID) != _bondMappingInv.end())
_bondMappingInv.erase(bondID);
Expand Down

0 comments on commit 121b7d2

Please sign in to comment.