openchemlib 9.13.0 → 9.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2995,6 +2995,7 @@ export interface DepictorOptions {
2995
2995
  suppressChiralText?: boolean;
2996
2996
  suppressCIPParity?: boolean;
2997
2997
  suppressESR?: boolean;
2998
+ noCarbonLabelWithCustomLabel?: boolean;
2998
2999
 
2999
3000
  showSymmetryAny?: boolean;
3000
3001
  showSymmetrySimple?: boolean;
@@ -6804,7 +6804,7 @@ function getExports($wnd) {
6804
6804
  this.setColorCode(this.mStandardForegroundColor);
6805
6805
  };
6806
6806
  _.mpDrawAtom = function mpDrawAtom(atom, esrGroupMemberCount) {
6807
- var angle, atmStart, atomStr, bestSide, bnd, charge, chax, chay, cipStr, counterHindrance, counterSide, eNegNeighbours, esrInfo, esrStr, hHeight, hNoStr, hNoWidth, hindrance, hydrogenWidth, hydrogens, hydrogensToAdd, i, i0, isoStr, j, labelWidth, largeIsoString, mapStr, minHindrance, neighbours, piElectrons, propStr, queryFeatures, ringBonds, theAngle, theColor, unpairedElectrons, valStr, x_0, xdiff, y_0, ydiff;
6807
+ var angle, atmStart, atomStr, bestSide, bnd, charge, chax, chay, cipStr, counterHindrance, counterSide, eNegNeighbours, esrInfo, esrStr, hHeight, hNoStr, hNoWidth, hindrance, hydrogenWidth, hydrogens, hydrogensToAdd, i, i0, isSmallCustomLabel, isSmallCustomLabelOnly, isoStr, j, labelWidth, mapStr, minHindrance, neighbours, piElectrons, propStr, queryFeatures, ringBonds, theAngle, theColor, unpairedElectrons, valStr, x_0, xdiff, y_0, ydiff;
6808
6808
  if (!this.mIsValidatingView)
6809
6809
  this.onDrawAtom(atom, this.mMol.getAtomLabel_0(atom), this.getAtomX_0(atom), this.getAtomY_0(atom));
6810
6810
  propStr = null;
@@ -7023,12 +7023,14 @@ function getExports($wnd) {
7023
7023
  hydrogensToAdd = this.mMol.getImplicitHydrogens_1(atom);
7024
7024
  }
7025
7025
  }
7026
- largeIsoString = false;
7026
+ isSmallCustomLabelOnly = false;
7027
+ isSmallCustomLabel = false;
7027
7028
  atomStr = this.mMol.getAtomCustomLabel_0(atom);
7028
7029
  if (jsNotEquals(atomStr, null) && jl.startsWith_Ljava_lang_String__Z__devirtual$(atomStr, "]")) {
7030
+ isSmallCustomLabelOnly = jsEquals(isoStr, null);
7031
+ isSmallCustomLabel = true;
7029
7032
  isoStr = this.append(jl.substring_I_Ljava_lang_String___devirtual$(atomStr, 1), isoStr);
7030
7033
  atomStr = null;
7031
- largeIsoString = true;
7032
7034
  }
7033
7035
  if (jsNotEquals(atomStr, null)) {
7034
7036
  hydrogensToAdd = 0;
@@ -7043,7 +7045,7 @@ function getExports($wnd) {
7043
7045
  atomStr = "?";
7044
7046
  if (neq(and_0(this.mMol.getAtomQueryFeatures(atom), 2048), 0))
7045
7047
  hydrogensToAdd = -1;
7046
- } else if (this.mMol.getAtomicNo_0(atom) != 6 || jsNotEquals(propStr, null) || jsNotEquals(isoStr, null) || hydrogensToAdd > 0 || !this.mAtomIsConnected[atom])
7048
+ } else if (this.mMol.getAtomicNo_0(atom) != 6 || jsNotEquals(propStr, null) || jsNotEquals(isoStr, null) && (!isSmallCustomLabelOnly || (this.mDisplayMode & 256) == 0) || hydrogensToAdd > 0 || !this.mAtomIsConnected[atom])
7047
7049
  atomStr = this.mMol.getAtomLabel_0(atom);
7048
7050
  labelWidth = 0;
7049
7051
  if (!this.mMol.isSelectedAtom_0(atom) & this.mMol.isExcludeGroupAtom(atom))
@@ -7064,7 +7066,7 @@ function getExports($wnd) {
7064
7066
  if ((this.mDisplayMode & 2) != 0)
7065
7067
  isoStr = jl.valueOf_18(atom);
7066
7068
  if (jsNotEquals(isoStr, null)) {
7067
- if (largeIsoString)
7069
+ if (isSmallCustomLabel)
7068
7070
  this.mpSetReducedLabelSize();
7069
7071
  else
7070
7072
  this.mpSetSmallLabelSize();
@@ -8066,6 +8068,7 @@ function getExports($wnd) {
8066
8068
  carc2.cDModeBondNo = 4;
8067
8069
  carc2.cDModeDrawBondsInGray = 16384;
8068
8070
  carc2.cDModeHiliteAllQueryFeatures = 8;
8071
+ carc2.cDModeNoCarbonLabelWithCustomLabel = 256;
8069
8072
  carc2.cDModeNoColorOnESRAndCIP = 4096;
8070
8073
  carc2.cDModeNoImplicitAtomLabelColors = 1024;
8071
8074
  carc2.cDModeNoImplicitHydrogen = 8192;
@@ -27690,7 +27693,7 @@ function getExports($wnd) {
27690
27693
  this.parse_8(mol, smiles, position, endIndex, true, true);
27691
27694
  };
27692
27695
  _.parse_8 = function parse_9(mol, smiles, position, endIndex, createCoordinates, readStereoFeatures) {
27693
- var a1, a2, allowSmarts, atom, atom0, atomMass, atomParser, baseAtom, bond, bondQueryFeatures, bondType, bondTypePosition, bracketLevel, compatibleValenceFound, ep, excludedBonds, explicitHydrogen, fromAtom, handleHydrogenAtomMap, hasBondType, hasLeadingBracket, hydrogenCount, i, i0, inventor, isDoubleDigit, newSize, number, oldSize, parity, parity$iterator, parityMap, rca, rca$array, rca$index, rca$max, ringClosureAtom, ringClosureBondQueryFeatures, ringClosureBondType, ringClosurePosition, squareBracketOpen, theChar, usedValence, valence, valence$array, valence$index, valence$max, valences;
27696
+ var a1, a2, allowSmarts, atom, atom0, atomMass, atomParser, baseAtom, bond, bondQueryFeatures, bondType, bondTypePosition, bracketLevel, compatibleValenceFound, ep, excludedBonds, explicitHydrogen, fromAtom, handleHydrogenAtomMap, hasBondType, hasLeadingBracket, hydrogenCount, i, i0, i1, i2, inventor, isDoubleDigit, newSize, number, oldSize, parity, parity$iterator, parityMap, ringClosureAtom, ringClosureBondQueryFeatures, ringClosureBondType, ringClosurePosition, squareBracketOpen, theChar, usedValence, valence, valence$array, valence$index, valence$max, valences;
27694
27697
  this.smiles = smiles;
27695
27698
  this.mMol = mol;
27696
27699
  this.mMol.clear_0();
@@ -27899,8 +27902,8 @@ function getExports($wnd) {
27899
27902
  ringClosurePosition = ju.copyOf_9(ringClosurePosition, newSize);
27900
27903
  ringClosureBondType = ju.copyOf_9(ringClosureBondType, newSize);
27901
27904
  ringClosureBondQueryFeatures = ju.copyOf_9(ringClosureBondQueryFeatures, newSize);
27902
- for (i = oldSize; i < newSize; i++)
27903
- ringClosureAtom[i] = -1;
27905
+ for (i1 = oldSize; i1 < newSize; i1++)
27906
+ ringClosureAtom[i1] = -1;
27904
27907
  }
27905
27908
  if (ringClosureAtom[number] == -1) {
27906
27909
  ringClosureAtom[number] = baseAtom[bracketLevel];
@@ -27980,12 +27983,10 @@ function getExports($wnd) {
27980
27983
  throw toJs(new jl.Exception_1("SmilesParser: unexpected character outside brackets: '" + charToString(theChar) + "' position:" + (position - 1)));
27981
27984
  }
27982
27985
  if (bondType != 1)
27983
- throw toJs(new jl.Exception_1("SmilesParser: dangling open bond"));
27984
- for (rca$array = ringClosureAtom, rca$index = 0, rca$max = rca$array.length; rca$index < rca$max; ++rca$index) {
27985
- rca = rca$array[rca$index];
27986
- if (rca != -1)
27987
- throw toJs(new jl.Exception_1("SmilesParser: dangling ring closure."));
27988
- }
27986
+ throw toJs(new jl.Exception_1("SmilesParser: dangling open bond; position:" + position));
27987
+ for (i2 = 0; i2 < ringClosureAtom.length; i2++)
27988
+ if (ringClosureAtom[i2] != -1)
27989
+ throw toJs(new jl.Exception_1("SmilesParser: dangling ring closure: " + i2 + "; position:" + position));
27989
27990
  handleHydrogenAtomMap = this.mMol.getHandleHydrogenMap_0();
27990
27991
  this.mMol.setHydrogenProtection_0(true);
27991
27992
  this.mMol.ensureHelperArrays_0(1);
@@ -28090,7 +28091,7 @@ function getExports($wnd) {
28090
28091
  return jsEquals(smiles, null) ? null : this.parseReaction_1(jl.getBytes_Ljava_nio_charset_Charset___B__devirtual$(smiles, (jnc.$clinit_StandardCharsets(), jnc.UTF_8)));
28091
28092
  };
28092
28093
  _.parseReaction_1 = function parseReaction_0(smiles) {
28093
- var closingGroupBracketIndex, end, i, index_0, index1, index2, level, mol, molend, part, rxn;
28094
+ var i, index_0, index1, index2, level, mol, molEnd, molStart, part, rxn;
28094
28095
  index1 = caru.indexOf_2(smiles, narrow_byte(62));
28095
28096
  while (index1 > 0 && smiles[index1 - 1] == narrow_byte(45))
28096
28097
  index1 = caru.indexOf_3(smiles, narrow_byte(62), index1 + 1);
@@ -28104,37 +28105,36 @@ function getExports($wnd) {
28104
28105
  rxn = new carcr.Reaction();
28105
28106
  part = 0;
28106
28107
  index_0 = 0;
28107
- closingGroupBracketIndex = -1;
28108
28108
  while (index_0 < smiles.length) {
28109
28109
  while (index_0 < smiles.length && smiles[index_0] == 46)
28110
28110
  index_0++;
28111
- if (smiles[index_0] == 40) {
28112
- if (closingGroupBracketIndex != -1)
28113
- throw toJs(new jl.Exception_1("Second open group bracket found before closing first one."));
28114
- index_0++;
28115
- level = 0;
28116
- for (i = index_0; i < smiles.length; i++) {
28117
- if (smiles[i] == 40) {
28118
- level++;
28119
- } else if (smiles[i] == 41) {
28120
- if (level-- == 0) {
28121
- closingGroupBracketIndex = i;
28122
- break;
28123
- }
28111
+ if (index_0 == smiles.length)
28112
+ break;
28113
+ molStart = index_0;
28114
+ molEnd = -1;
28115
+ level = 0;
28116
+ for (i = index_0; i < smiles.length; i++) {
28117
+ if (smiles[i] == 40) {
28118
+ level++;
28119
+ continue;
28120
+ }
28121
+ if (smiles[i] == 41) {
28122
+ if (--level < 0)
28123
+ throw toJs(new jl.Exception_1("Found closing bracket without matching opening one."));
28124
+ continue;
28125
+ }
28126
+ if (level == 0) {
28127
+ if (smiles[i] == 46 && (this.mSingleDotSeparator || i + 1 < smiles.length && smiles[i + 1] == 46) || smiles[i] == 62 && (i == 0 || smiles[i - 1] != 45)) {
28128
+ molEnd = i;
28129
+ break;
28124
28130
  }
28125
28131
  }
28126
28132
  }
28127
- end = index_0;
28128
- while (end < smiles.length && smiles[end] != 62 && !(smiles[end] == 46 && (this.mSingleDotSeparator && closingGroupBracketIndex == -1 || closingGroupBracketIndex == end - 1 || end + 1 == smiles.length || smiles[end + 1] == 46)))
28129
- end++;
28130
- molend = end;
28131
- if (closingGroupBracketIndex == end - 1) {
28132
- molend--;
28133
- closingGroupBracketIndex = -1;
28134
- }
28135
- if (index_0 != molend) {
28133
+ if (molEnd == -1)
28134
+ molEnd = smiles.length;
28135
+ if (molStart < molEnd) {
28136
28136
  mol = new carc2.StereoMolecule();
28137
- this.parse_7(mol, smiles, index_0, molend);
28137
+ this.parse_7(mol, smiles, molStart, molEnd);
28138
28138
  if (this.mSmartsMode == 1 && this.mSmartsFeatureFound)
28139
28139
  return new carc2.SmilesParser_0(this.mMode | 2).parseReaction_1(smiles);
28140
28140
  if (part == 0)
@@ -28144,7 +28144,7 @@ function getExports($wnd) {
28144
28144
  else
28145
28145
  rxn.addProduct_0(mol);
28146
28146
  }
28147
- index_0 = end;
28147
+ index_0 = molEnd;
28148
28148
  while (index_0 < smiles.length && smiles[index_0] == 62) {
28149
28149
  index_0++;
28150
28150
  part++;
@@ -30301,6 +30301,7 @@ function getExports($wnd) {
30301
30301
  var atom;
30302
30302
  if (isNull(mol))
30303
30303
  mol = this.mMol.getCompactCopy_0();
30304
+ mol.invalidateHelperArrays_0(248);
30304
30305
  for (atom = 0; atom < mol.getAllAtoms_0(); atom++)
30305
30306
  mol.getAtomCoordinates_0(atom).set_1(this.mCoordinates[atom]);
30306
30307
  if (jsNotEquals(this.mName, null))
@@ -39728,7 +39729,7 @@ function getExports($wnd) {
39728
39729
  mapNo0 = reactant.getAtomMapNo_0(j);
39729
39730
  if (mapNo0 != 0) {
39730
39731
  if (mapNoInReactant[mapNo0])
39731
- throw toJs(new jl.Exception_1("Duplicate mapping no in reactants"));
39732
+ throw toJs(new jl.Exception_1("Duplicate mapping no in reactants: " + mapNo0));
39732
39733
  mapNoInReactant[mapNo0] = true;
39733
39734
  }
39734
39735
  }
@@ -39740,7 +39741,7 @@ function getExports($wnd) {
39740
39741
  mapNo0 = product.getAtomMapNo_0(j);
39741
39742
  if (mapNo0 != 0) {
39742
39743
  if (mapNoInProduct[mapNo0])
39743
- throw toJs(new jl.Exception_1("Duplicate mapping no in products"));
39744
+ throw toJs(new jl.Exception_1("Duplicate mapping no in products: " + mapNo0));
39744
39745
  mapNoInProduct[mapNo0] = true;
39745
39746
  }
39746
39747
  }
@@ -51335,6 +51336,8 @@ function getExports($wnd) {
51335
51336
  displayMode |= 64;
51336
51337
  if (options.suppressESR)
51337
51338
  displayMode |= 128;
51339
+ if (options.noCarbonLabelWithCustomLabel)
51340
+ displayMode |= 256;
51338
51341
  if (options.showSymmetryAny)
51339
51342
  displayMode |= 768;
51340
51343
  if (options.showSymmetrySimple)
@@ -71259,7 +71262,7 @@ function getExports($wnd) {
71259
71262
  $sendStats("moduleStartup", "end");
71260
71263
  $gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
71261
71264
  const toReturn = $wnd["OCL"];
71262
- toReturn.version = "9.13.0";
71265
+ toReturn.version = "9.14.0";
71263
71266
  return toReturn;
71264
71267
  }
71265
71268
  var isBrowserWindow = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -71403,8 +71406,8 @@ export {
71403
71406
  };
71404
71407
  /**
71405
71408
  * openchemlib - Manipulate molecules
71406
- * @version v9.13.0
71407
- * @date 2025-10-28T16:31:52.366Z
71409
+ * @version v9.14.0
71410
+ * @date 2025-10-29T09:34:22.062Z
71408
71411
  * @link https://github.com/cheminfo/openchemlib-js
71409
71412
  * @license BSD-3-Clause
71410
71413
  */