Skip to content

Commit b1477ef

Browse files
committed
Fix failing tests, we used to check the "isQuery" condition but aromatic bond order=4 (a query feature) messes this up at the valency setting step. I make take a deep look and refactor of the MDL parsing soon but for now this puts things back to how they were.
1 parent 79129f5 commit b1477ef

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

storage/ctab/src/main/java/org/openscience/cdk/io/MDLV2000Reader.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,10 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
433433
for (int i = 0; i < nBonds; i++) {
434434
line = input.readLine();
435435
linecount++;
436-
437436
bonds[i] = readBondFast(line, molecule.getBuilder(), atoms, explicitValence, linecount, isQuery);
438437
isQuery = isQuery ||
439438
bonds[i] instanceof IQueryBond ||
440-
(bonds[i].getOrder() == IBond.Order.UNSET &&
441-
!bonds[i].getFlag(CDKConstants.ISAROMATIC));
439+
(bonds[i].getOrder() == IBond.Order.UNSET && !bonds[i].isAromatic());
442440
}
443441

444442
if (!isQuery)
@@ -524,7 +522,8 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
524522
// sanity check that we have a decent molecule, query bonds mean we
525523
// don't have a hydrogen count for atoms and stereo perception isn't
526524
// currently possible
527-
if (!(outputContainer instanceof IQueryAtomContainer) && addStereoElements.isSet() && hasX && hasY) {
525+
if (!(outputContainer instanceof IQueryAtomContainer) && !isQuery &&
526+
addStereoElements.isSet() && hasX && hasY) {
528527
if (hasZ) { // has 3D coordinates
529528
outputContainer.setStereoElements(StereoElementFactory.using3DCoordinates(outputContainer)
530529
.createAll());

0 commit comments

Comments
 (0)