From 5dd09cf437db4828ea30bf37d4c37329eccebe9a Mon Sep 17 00:00:00 2001 From: Mitch Miller Date: Mon, 17 Jun 2024 22:16:51 -0400 Subject: [PATCH] beginning of creating warnings for SGroups with extranous atoms within the boundaries of their brackets --- pom.xml | 4 +-- .../ncats/molwitch/cdk/CdkChemicalImpl.java | 5 +-- .../cdk/writer/AbstractMdlWriterFactory.java | 32 +++++-------------- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/pom.xml b/pom.xml index 7f255ee..c679168 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,7 @@ gov.nih.ncats smsd-core - 2.2.3 + 2.2.4 org.apache.logging.log4j @@ -258,7 +258,7 @@ gov.nih.ncats smsd-exec - 2.2.3 + 2.2.4 diff --git a/src/main/java/gov/nih/ncats/molwitch/cdk/CdkChemicalImpl.java b/src/main/java/gov/nih/ncats/molwitch/cdk/CdkChemicalImpl.java index 5536e1d..13d1acc 100644 --- a/src/main/java/gov/nih/ncats/molwitch/cdk/CdkChemicalImpl.java +++ b/src/main/java/gov/nih/ncats/molwitch/cdk/CdkChemicalImpl.java @@ -46,7 +46,6 @@ import javax.vecmath.Tuple2d; -import org.junit.Assert; import org.openscience.cdk.AtomRef; import org.openscience.cdk.BondRef; import org.openscience.cdk.CDKConstants; @@ -2489,7 +2488,9 @@ public List getSGroupWarnings() { List messages = new ArrayList<>(); AtomicInteger counter = new AtomicInteger(0); this.getSGroups().forEach(sg->{ - Assert.assertEquals(2, sg.getBrackets().size()); + if(sg.getBrackets().size() != 2 ){ + Logger.getLogger(CdkChemicalImpl.class.getName()).warning("Expecting SGroups to have 2 brackets. This one has " + sg.getBrackets().size()); + } Logger.getLogger(CdkChemicalImpl.class.getName()).fine(String.format("looking at SGroup %d with %d atoms bracket 0 x: %.2f; y: %.2f; bracket 1 x: %.2f; y: %.2f\n", counter.incrementAndGet(), sg.getAtoms().count(), sg.getBrackets().get(0).getPoint1().getX(), sg.getBrackets().get(0).getPoint1().getY(), sg.getBrackets().get(1).getPoint1().getX(), sg.getBrackets().get(1).getPoint1().getY())); diff --git a/src/main/java/gov/nih/ncats/molwitch/cdk/writer/AbstractMdlWriterFactory.java b/src/main/java/gov/nih/ncats/molwitch/cdk/writer/AbstractMdlWriterFactory.java index 289f95f..29c5d96 100644 --- a/src/main/java/gov/nih/ncats/molwitch/cdk/writer/AbstractMdlWriterFactory.java +++ b/src/main/java/gov/nih/ncats/molwitch/cdk/writer/AbstractMdlWriterFactory.java @@ -21,35 +21,19 @@ package gov.nih.ncats.molwitch.cdk.writer; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.Properties; -import java.util.function.Function; - -import javax.vecmath.Point2d; -import javax.vecmath.Point3d; - -import gov.nih.ncats.molwitch.cdk.CdkUtil; -import org.apache.xpath.operations.Bool; -import org.openscience.cdk.aromaticity.Aromaticity; -import org.openscience.cdk.aromaticity.ElectronDonation; -import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.graph.Cycles; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.io.IChemObjectWriter; -import org.openscience.cdk.io.listener.PropertiesListener; - -import gov.nih.ncats.molwitch.io.ChemFormat.AromaticAwareChemFormatWriterSpecification; import gov.nih.ncats.molwitch.io.ChemFormat.ChemFormatWriterSpecification; -import gov.nih.ncats.molwitch.io.ChemFormat.KekulizationEncoding; import gov.nih.ncats.molwitch.io.ChemFormat.MolFormatSpecification; import gov.nih.ncats.molwitch.io.ChemFormat.MolFormatSpecification.Version; import gov.nih.ncats.molwitch.spi.ChemicalWriterImpl; import gov.nih.ncats.molwitch.spi.ChemicalWriterImplFactory; -import org.openscience.cdk.io.setting.IOSetting; +import org.openscience.cdk.interfaces.IAtomContainer; +import org.openscience.cdk.io.IChemObjectWriter; +import org.openscience.cdk.io.listener.PropertiesListener; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; +import java.util.function.Function; public abstract class AbstractMdlWriterFactory implements ChemicalWriterImplFactory{