From 2ceef95e7487920db56a0b4f59337adf588c602a Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Wed, 24 Feb 2010 21:22:29 +0100 Subject: [PATCH 1/5] Synchronized behavior with the MDLV2000Reader (addressing bug #2942196) Signed-off-by: Rajarshi Guha --- src/main/org/openscience/cdk/io/MDLReader.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/org/openscience/cdk/io/MDLReader.java b/src/main/org/openscience/cdk/io/MDLReader.java index a847d2f0075..fb9246a475e 100644 --- a/src/main/org/openscience/cdk/io/MDLReader.java +++ b/src/main/org/openscience/cdk/io/MDLReader.java @@ -318,6 +318,8 @@ private IMolecule readMolecule(IMolecule molecule) throws CDKException { double x = 0.0; double y = 0.0; double z = 0.0; + double totalX = 0.0; + double totalY = 0.0; double totalZ = 0.0; //int[][] conMat = new int[0][0]; //String help; @@ -372,7 +374,10 @@ private IMolecule readMolecule(IMolecule molecule) throws CDKException { x = new Double(line.substring( 0,10).trim()).doubleValue(); y = new Double(line.substring(10,20).trim()).doubleValue(); z = new Double(line.substring(20,30).trim()).doubleValue(); - totalZ += Math.abs(z); // *all* values should be zero, not just the sum + // *all* values should be zero, not just the sum + totalX += Math.abs(x); + totalY += Math.abs(y); + totalZ += Math.abs(z); logger.debug("Coordinates: " + x + "; " + y + "; " + z); String element = line.substring(31,34).trim(); @@ -484,7 +489,12 @@ private IMolecule readMolecule(IMolecule molecule) throws CDKException { } // convert to 2D, if totalZ == 0 - if (totalZ == 0.0 && !forceReadAs3DCoords.isSet()) { + if (totalX == 0.0 && totalY == 0.0 && totalZ == 0.0) { + logger.info("All coordinates are 0.0"); + for (IAtom atomToUpdate : molecule.atoms()) { + atomToUpdate.setPoint3d(null); + } + } else if (totalZ == 0.0 && !forceReadAs3DCoords.isSet()) { logger.info("Total 3D Z is 0.0, interpreting it as a 2D structure"); Iterator atomsToUpdate = molecule.atoms().iterator(); while (atomsToUpdate.hasNext()) { From 677b3f63361c70dc6805b78c99897322c91b5f6c Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Wed, 24 Feb 2010 22:00:01 +0100 Subject: [PATCH 2/5] Fixed some spelling errors and added JavaDoc links Signed-off-by: Rajarshi Guha --- .../UniversalIsomorphismTester.java | 168 +++++++++--------- 1 file changed, 86 insertions(+), 82 deletions(-) diff --git a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java index 09a9b797e87..b9ca48a1f61 100644 --- a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java +++ b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java @@ -36,6 +36,7 @@ import org.openscience.cdk.isomorphism.matchers.IQueryAtom; import org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer; import org.openscience.cdk.isomorphism.matchers.IQueryBond; +import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer; import org.openscience.cdk.isomorphism.mcss.RGraph; import org.openscience.cdk.isomorphism.mcss.RMap; import org.openscience.cdk.isomorphism.mcss.RNode; @@ -59,15 +60,17 @@ * The constraint flexibility allows a number of interesting queries. * The substructure analysis relies on the RGraph generic class (see: RGraph) * This class implements the link between the RGraph model and the - * the CDK model in this way the RGraph remains independent and may be used + * the CDK model in this way the {@link RGraph} remains independent and may be used * in other contexts. * *

This algorithm derives from the algorithm described in * {@cdk.cite HAN90} and modified in the thesis of T. Hanser {@cdk.cite HAN93}. * - *

With the isSubgraph() method, the second, and only the second - * argument may be a IQueryAtomContainer, which allows one to do MQL like queries. - * The first IAtomContainer must never be an IQueryAtomContainer. An example:

+ *  

With the {@link #isSubgraph(IAtomContainer, IAtomContainer)} method, + * the second, and only the second argument may be a {@link IQueryAtomContainer}, + * which allows one to do SMARTS or MQL like queries. + * The first {@link IAtomContainer} must never be an {@link IQueryAtomContainer}. + * An example:

  *  SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
  *  IAtomContainer atomContainer = sp.parseSmiles("CC(=O)OC(=O)C"); // acetic acid anhydride
  *  IAtomContainer SMILESquery = sp.parseSmiles("CC"); // acetic acid anhydride
@@ -77,11 +80,11 @@
  *
  *  

WARNING: * As a result of the adjacency perception used in this algorithm - * there is a single limitation : cyclopropane and isobutane are seen as isomorph + * there is a single limitation: cyclopropane and isobutane are seen as isomorph. * This is due to the fact that these two compounds are the only ones where - * each bond is connected two each other bond (bonds are fully conected) + * each bond is connected two each other bond (bonds are fully connected) * with the same number of bonds and still they have different structures - * The algotihm could be easily enhanced with a simple atom mapping manager + * The algorithm could be easily enhanced with a simple atom mapping manager * to provide an atom level overlap definition that would reveal this case. * We decided not to penalize the whole procedure because of one single * exception query. Furthermore isomorphism may be discarded since the number of atoms are @@ -127,11 +130,10 @@ public class UniversalIsomorphismTester { /** * Tests if g1 and g2 are isomorph. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return true if the 2 molecule are isomorph - * @throws org.openscience.cdk.exception.CDKException if the first molecule is an instance - * of IQueryAtomContainer + * @throws CDKException if the first molecule is an instance of IQueryAtomContainer */ public static boolean isIsomorph(IAtomContainer g1, IAtomContainer g2) throws CDKException{ if (g1 instanceof IQueryAtomContainer) @@ -162,8 +164,8 @@ public static boolean isIsomorph(IAtomContainer g1, IAtomContainer g2) throws C /** * Returns the first isomorph mapping found or null. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the first isomorph mapping found projected of g1. This is a List of RMap objects containing Ids of matching bonds. */ public static List getIsomorphMap(IAtomContainer g1, IAtomContainer g2) throws CDKException{ @@ -187,12 +189,11 @@ public static List getIsomorphMap(IAtomContainer g1, IAtomContainer g2) t /** * Returns the first isomorph 'atom mapping' found for g2 in g1. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the first isomorph atom mapping found projected on g1. * This is a List of RMap objects containing Ids of matching atoms. - * @throws org.openscience.cdk.exception.CDKException if the first molecules is not an instance of - * {@link org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer} + * @throws CDKException if the first molecules is not an instance of {@link IQueryAtomContainer} */ public static List getIsomorphAtomsMap(IAtomContainer g1, IAtomContainer g2) throws CDKException { if (g1 instanceof IQueryAtomContainer) @@ -215,8 +216,8 @@ public static List getIsomorphAtomsMap(IAtomContainer g1, IAtomContainer g * Returns all the isomorph 'mappings' found between two * atom containers. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the list of all the 'mappings' */ public static List> getIsomorphMaps(IAtomContainer g1, IAtomContainer g2) throws CDKException{ @@ -229,20 +230,22 @@ public static List> getIsomorphMaps(IAtomContainer g1, IAtomContainer /** * Returns all the subgraph 'bond mappings' found for g2 in g1. - * This is an ArrayList of ArrayLists of RMap objects. + * This is an {@link List} of {@link List}s of {@link RMap} objects. * * Note that if the query molecule is a single atom, then bond mappings - * cannot be defined. In such a case, the RMap object refers directly to + * cannot be defined. In such a case, the {@link RMap} object refers directly to * atom - atom mappings. Thus RMap.id1 is the index of the target atom * and RMap.id2 is the index of the matching query atom (in this case, * it will always be 0). Note that in such a case, there is no need - * to call makeAtomsMapsofBondsMaps, though if it is called, then the + * to call {@link #makeAtomsMapsOfBondsMaps(List, IAtomContainer, IAtomContainer)}, + * though if it is called, then the * return value is simply the same as the return value of this method. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the list of all the 'mappings' found projected of g1 - * @see #makeAtomsMapsOfBondsMaps(java.util.List, org.openscience.cdk.interfaces.IAtomContainer, org.openscience.cdk.interfaces.IAtomContainer) + * + * @see #makeAtomsMapsOfBondsMaps(List, IAtomContainer, IAtomContainer) */ public static List> getSubgraphMaps(IAtomContainer g1, IAtomContainer g2) throws CDKException{ return search(g1, g2, new BitSet(), getBitSet(g2), true, true); @@ -252,9 +255,10 @@ public static List> getSubgraphMaps(IAtomContainer g1, IAtomContainer /** * Returns the first subgraph 'bond mapping' found for g2 in g1. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. - * @return the first subgraph bond mapping found projected on g1. This is a List of RMap objects containing Ids of matching bonds. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. + * @return the first subgraph bond mapping found projected on g1. This is a {@link List} of + * {@link RMap} objects containing Ids of matching bonds. */ public static List getSubgraphMap(IAtomContainer g1, IAtomContainer g2) throws CDKException{ List result = null; @@ -270,12 +274,12 @@ public static List getSubgraphMap(IAtomContainer g1, IAtomContainer g2) t /** * Returns all subgraph 'atom mappings' found for g2 in g1. - * This is an ArrayList of ArrayLists of RMap objects. + * This is an {@link List} of {@link List}s of {@link RMap} objects. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return all subgraph atom mappings found projected on g1. This is a - * List of RMap objects containing Ids of matching atoms. + * {@link List} of {@link RMap} objects containing Ids of matching atoms. */ public static List> getSubgraphAtomsMaps(IAtomContainer g1, IAtomContainer g2) @@ -295,10 +299,10 @@ public static List> getSubgraphAtomsMaps(IAtomContainer g1, /** * Returns the first subgraph 'atom mapping' found for g2 in g1. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the first subgraph atom mapping found projected on g1. - * This is a List of RMap objects containing Ids of matching atoms. + * This is a {@link List} of {@link RMap} objects containing Ids of matching atoms. */ public static List getSubgraphAtomsMap(IAtomContainer g1, IAtomContainer g2) @@ -316,8 +320,8 @@ public static List getSubgraphAtomsMap(IAtomContainer g1, /** * Tests if g2 a subgraph of g1. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return true if g2 a subgraph on g1 */ public static boolean isSubgraph(IAtomContainer g1, IAtomContainer g2) throws CDKException{ @@ -353,10 +357,10 @@ public static boolean isSubgraph(IAtomContainer g1, IAtomContainer g2) throws C // Maximum common substructure search /** - * Returns all the maximal common substructure between 2 atom containers. + * Returns all the maximal common substructure between twp atom containers. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @return the list of all the maximal common substructure * found projected of g1 (list of AtomContainer ) */ @@ -375,10 +379,10 @@ public static List getOverlaps(IAtomContainer g1, IAtomContainer /** - * Transforms an AtomContainer into a BitSet (which's size = number of bond + * Transforms an AtomContainer into a {@link BitSet} (which's size = number of bond * in the atomContainer, all the bit are set to true). * - * @param ac AtomContainer to transform + * @param ac {@link IAtomContainer} to transform * @return The bitSet */ public static BitSet getBitSet(IAtomContainer ac) { @@ -400,7 +404,7 @@ public static BitSet getBitSet(IAtomContainer ac) { // Internal methods /** - * Builds the RGraph ( resolution graph ), from two atomContainer + * Builds the {@link RGraph} ( resolution graph ), from two atomContainer * (description of the two molecules to compare) * This is the interface point between the CDK model and * the generic MCSS algorithm based on the RGRaph. @@ -418,12 +422,12 @@ public static RGraph buildRGraph(IAtomContainer g1, IAtomContainer g2) throws C /** - * General Rgraph parsing method (usually not used directly) + * General {@link RGraph} parsing method (usually not used directly) * This method is the entry point for the recursive search * adapted to the atom container input. * - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. * @param c1 initial condition ( bonds from g1 that * must be contains in the solution ) * @param c2 initial condition ( bonds from g2 that @@ -431,7 +435,7 @@ public static RGraph buildRGraph(IAtomContainer g1, IAtomContainer g2) throws C * @param findAllStructure if false stop at the first structure found * @param findAllMap if true search all the 'mappings' for one same * structure - * @return a List of Lists of RMap objects that represent the search solutions + * @return a List of Lists of {@link RMap} objects that represent the search solutions */ public static List> search(IAtomContainer g1, IAtomContainer g2, BitSet c1, BitSet c2, boolean findAllStructure, boolean findAllMap) throws CDKException{ @@ -484,11 +488,11 @@ public static List> search(IAtomContainer g1, IAtomContainer g2, BitS // Manipulation tools /** - * Projects a list of RMap on a molecule. + * Projects a list of {@link RMap} on a molecule. * * @param rMapList the list to project * @param g the molecule on which project - * @param id the id in the RMap of the molecule g + * @param id the id in the {@link RMap} of the molecule g * @return an AtomContainer */ public static IAtomContainer project(List rMapList, IAtomContainer g, int id) { @@ -567,8 +571,7 @@ public static ArrayList projectList(List> rMapsList, * * @param graphList the list of structure to clean * @return the list cleaned - * @throws org.openscience.cdk.exception.CDKException if there is a problem in obtaining - * subgraphs + * @throws CDKException if there is a problem in obtaining subgraphs */ private static List getMaximum(ArrayList graphList) throws CDKException { List reducedGraphList = (List) graphList.clone(); @@ -592,13 +595,12 @@ private static List getMaximum(ArrayList graphLi } /** - * Checks for single atom cases before doing subgraph/isomorphism search + * Checks for single atom cases before doing subgraph/isomorphism search. * - * @param g1 AtomContainer to match on. Must not be an IQueryAtomContainer. - * @param g2 AtomContainer as query. May be an IQueryAtomContainer. - * @return List of List of RMap objects for the Atoms (not Bonds!), null if no single atom case - * @throws org.openscience.cdk.exception.CDKException if the first molecule is an instance - * of IQueryAtomContainer + * @param g1 AtomContainer to match on. Must not be an {@link IQueryAtomContainer}. + * @param g2 AtomContainer as query. May be an {@link IQueryAtomContainer}. + * @return {@link List} of {@link List} of {@link RMap} objects for the Atoms (not Bonds!), null if no single atom case + * @throws CDKException if the first molecule is an instance of IQueryAtomContainer */ public static List checkSingleAtomCases(IAtomContainer g1, IAtomContainer g2) throws CDKException { if (g1 instanceof IQueryAtomContainer) @@ -644,12 +646,13 @@ public static List checkSingleAtomCases(IAtomContainer g1, IAtomContainer } /** - * This makes maps of matching atoms out of a maps of matching bonds as produced by the get(Subgraph|Ismorphism)Maps methods. + * This makes maps of matching atoms out of a maps of matching bonds as produced by the + * get(Subgraph|Ismorphism)Maps methods. * * @param l The list produced by the getMap method. - * @param g1 The first atom container. Must not be a IQueryAtomContainer. - * @param g2 The second one (first and second as in getMap). May be an QueryAtomContaienr. - * @return A Vector of Vectors of RMap objects of matching Atoms. + * @param g1 The first atom container. Must not be a {@link IQueryAtomContainer}. + * @param g2 The second one (first and second as in getMap). May be an {@link QueryAtomContainer}. + * @return A List of {@link List}s of {@link RMap} objects of matching Atoms. */ public static List> makeAtomsMapsOfBondsMaps(List> l, IAtomContainer g1, IAtomContainer g2) { if (l == null) { @@ -664,12 +667,14 @@ public static List> makeAtomsMapsOfBondsMaps(List> l, IAto } /** - * This makes a map of matching atoms out of a map of matching bonds as produced by the get(Subgraph|Ismorphism)Map methods. + * This makes a map of matching atoms out of a map of matching bonds as produced by the + * get(Subgraph|Ismorphism)Map methods. * * @param l The list produced by the getMap method. - * @param g1 first molecule. Must not be an IQueryAtomContainer. - * @param g2 second molecule. May be an IQueryAtomContainer. - * @return The mapping found projected on g1. This is a List of RMap objects containing Ids of matching atoms. + * @param g1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param g2 second molecule. May be an {@link IQueryAtomContainer}. + * @return The mapping found projected on g1. This is a {@link List} of {@link RMap} objects + * containing Ids of matching atoms. */ public static List makeAtomsMapOfBondsMap(List l, IAtomContainer g1, IAtomContainer g2) { if(l==null) @@ -723,13 +728,13 @@ public static List makeAtomsMapOfBondsMap(List l, IAtomContainer g1, /** - * Builds the nodes of the RGraph ( resolution graph ), from + * Builds the nodes of the {@link RGraph} ( resolution graph ), from * two atom containers (description of the two molecules to compare) * * @param gr the target RGraph - * @param ac1 first molecule. Must not be an IQueryAtomContainer. - * @param ac2 second molecule. May be an IQueryAtomContainer. - * @throws org.openscience.cdk.exception.CDKException if it takes too long to identify overlaps + * @param ac1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param ac2 second molecule. May be an {@link IQueryAtomContainer}. + * @throws CDKException if it takes too long to identify overlaps */ private static void nodeConstructor(RGraph gr, IAtomContainer ac1, IAtomContainer ac2) throws CDKException { if (ac1 instanceof IQueryAtomContainer) @@ -797,15 +802,15 @@ private static void nodeConstructor(RGraph gr, IAtomContainer ac1, IAtomContaine /** - * Build edges of the RGraphs + * Build edges of the {@link RGraph}s. * This method create the edge of the RGraph and - * calculates the incompatibility and neighbourhood + * calculates the incompatibility and neighborhood * relationships between RGraph nodes. * * @param gr the rGraph - * @param ac1 first molecule. Must not be an IQueryAtomContainer. - * @param ac2 second molecule. May be an IQueryAtomContainer. - * @throws org.openscience.cdk.exception.CDKException if it takes too long to get the overlaps + * @param ac1 first molecule. Must not be an {@link IQueryAtomContainer}. + * @param ac2 second molecule. May be an {@link IQueryAtomContainer}. + * @throws CDKException if it takes too long to get the overlaps */ private static void arcConstructor(RGraph gr, IAtomContainer ac1, IAtomContainer ac2) throws CDKException{ // each node is incompatible with himself @@ -825,7 +830,7 @@ private static void arcConstructor(RGraph gr, IAtomContainer ac1, IAtomContainer for (int i = 0; i < gr.getGraph().size(); i++) { RNode x = gr.getGraph().get(i); - // two nodes are neighbours if their adjacency + // two nodes are neighbors if their adjacency // relationship in are equivalent in G1 and G2 // else they are incompatible. for (int j = i + 1; j < gr.getGraph().size(); j++) { @@ -875,7 +880,7 @@ private static boolean hasCommonAtom(IBond a, IBond b) { } /** - * Determines if 2 bond have 1 atom in common and returns the common symbol + * Determines if 2 bond have 1 atom in common and returns the common symbol. * * @param a first bond * @param b second bond @@ -895,7 +900,7 @@ private static String getCommonSymbol(IBond a, IBond b) { } /** - * Determines if 2 bond have 1 atom in common if second is a query AtomContainer + * Determines if 2 bond have 1 atom in common if second is a query AtomContainer. * * @param a1 first bond * @param b1 second bond @@ -928,7 +933,7 @@ private static boolean queryAdjacency(IBond a1, IBond b1, IBond a2, IBond b2) { /** * Determines if 2 bond have 1 atom in common if second is a query AtomContainer - * and wheter the order of the atoms is correct (atoms match). + * and whether the order of the atoms is correct (atoms match). * * @param bond1 first bond * @param bond2 second bond @@ -973,11 +978,10 @@ private static boolean queryAdjacencyAndOrder(IBond bond1, IBond bond2, IBond qu * number of nitrogen atoms in the query is larger than that of the supergraph * it cannot be part of it. * - * @param ac1 the supergraph to be checked. Must not be an IQueryAtomContainer. - * @param ac2 the subgraph to be tested for. May be an IQueryAtomContainer. + * @param ac1 the supergraph to be checked. Must not be an {@link IQueryAtomContainer}. + * @param ac2 the subgraph to be tested for. May be an {@link IQueryAtomContainer}. * @return true if the subgraph ac2 has a chance to be a subgraph of ac1 - * @throws org.openscience.cdk.exception.CDKException if the first molecule is an instance - * of IQueryAtomContainer + * @throws CDKException if the first molecule is an instance of {@link IQueryAtomContainer} */ private static boolean testSubgraphHeuristics(IAtomContainer ac1, IAtomContainer ac2) throws CDKException { From 14e1d12d71f63ccc8243237b706e0ffdea9e42c0 Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Wed, 24 Feb 2010 22:00:49 +0100 Subject: [PATCH 3/5] Removed output to STDOUT Signed-off-by: Rajarshi Guha --- .../cdk/isomorphism/UniversalIsomorphismTesterTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/test/org/openscience/cdk/isomorphism/UniversalIsomorphismTesterTest.java b/src/test/org/openscience/cdk/isomorphism/UniversalIsomorphismTesterTest.java index 2f8bcd40fb8..923c522ab30 100644 --- a/src/test/org/openscience/cdk/isomorphism/UniversalIsomorphismTesterTest.java +++ b/src/test/org/openscience/cdk/isomorphism/UniversalIsomorphismTesterTest.java @@ -262,13 +262,6 @@ public class UniversalIsomorphismTesterTest extends CDKTestCase // CDKHueckelAromaticityDetector.detectAromaticity(mol1); Iterator atoms = mol1.atoms().iterator(); int i= 1; - while (atoms.hasNext()) { - IAtom nextAtom = atoms.next(); - System.out.println(i + ": " + nextAtom.getSymbol() + - " T:" + nextAtom.getAtomTypeName() + - " A:" + nextAtom.getFlag(CDKConstants.ISAROMATIC)); - i++; - } AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); Assert.assertTrue(CDKHueckelAromaticityDetector.detectAromaticity(mol2)); list = UniversalIsomorphismTester.getOverlaps(mol1, mol2); From 7727b72d7f3a0b55a335fcd474e1bb26009e3236 Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Wed, 24 Feb 2010 22:05:27 +0100 Subject: [PATCH 4/5] Removed last bits of implementation details from the API: now uses List<> instead of ArrayList<> Signed-off-by: Rajarshi Guha --- .../cdk/isomorphism/UniversalIsomorphismTester.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java index b9ca48a1f61..8a186ef5407 100644 --- a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java +++ b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java @@ -369,7 +369,7 @@ public static List getOverlaps(IAtomContainer g1, IAtomContainer List> rMapsList = search(g1, g2, new BitSet(), new BitSet(), true, false); // projection on G1 - ArrayList graphList = projectList(rMapsList, g1, ID1); + List graphList = projectList(rMapsList, g1, ID1); // reduction of set of solution (isomorphism and substructure // with different 'mappings' @@ -556,8 +556,8 @@ public static IAtomContainer project(List rMapList, IAtomContainer g, int * @param id the id in the RMap of the molecule g * @return a list of AtomContainer */ - public static ArrayList projectList(List> rMapsList, IAtomContainer g, int id) { - ArrayList graphList = new ArrayList(); + public static List projectList(List> rMapsList, IAtomContainer g, int id) { + List graphList = new ArrayList(); for (List rMapList : rMapsList) { IAtomContainer ac = project(rMapList, g, id); @@ -573,8 +573,9 @@ public static ArrayList projectList(List> rMapsList, * @return the list cleaned * @throws CDKException if there is a problem in obtaining subgraphs */ - private static List getMaximum(ArrayList graphList) throws CDKException { - List reducedGraphList = (List) graphList.clone(); + private static List getMaximum(List graphList) throws CDKException { + List reducedGraphList = new ArrayList(); + reducedGraphList.addAll(graphList); for (int i = 0; i < graphList.size(); i++) { IAtomContainer gi = graphList.get(i); From e1c03fbff0543113fb7b1d2be15dd32441592ada Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Fri, 26 Feb 2010 09:01:10 +0100 Subject: [PATCH 5/5] Removed unused import --- .../openscience/cdk/isomorphism/UniversalIsomorphismTester.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java index 8a186ef5407..3f29cc5bba1 100644 --- a/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java +++ b/src/main/org/openscience/cdk/isomorphism/UniversalIsomorphismTester.java @@ -36,7 +36,6 @@ import org.openscience.cdk.isomorphism.matchers.IQueryAtom; import org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer; import org.openscience.cdk.isomorphism.matchers.IQueryBond; -import org.openscience.cdk.isomorphism.matchers.QueryAtomContainer; import org.openscience.cdk.isomorphism.mcss.RGraph; import org.openscience.cdk.isomorphism.mcss.RMap; import org.openscience.cdk.isomorphism.mcss.RNode;