From: <mig...@us...> - 2008-03-05 11:02:32
|
Revision: 10326 http://cdk.svn.sourceforge.net/cdk/?rev=10326&view=rev Author: miguelrojasch Date: 2008-03-05 03:02:27 -0800 (Wed, 05 Mar 2008) Log Message: ----------- Applied patch 10305 from the miguelrojasch/reaction branch: 'update the isomorphism to QueryAtomContainerCreator.createSymbolAndBondOrderQueryContainer to distinguish between aromatics compounds' Modified Paths: -------------- trunk/cdk/src/main/org/openscience/cdk/tools/StructureResonanceGenerator.java trunk/cdk/src/test/org/openscience/cdk/tools/StructureResonanceGeneratorTest.java Modified: trunk/cdk/src/main/org/openscience/cdk/tools/StructureResonanceGenerator.java =================================================================== --- trunk/cdk/src/main/org/openscience/cdk/tools/StructureResonanceGenerator.java 2008-03-05 11:01:12 UTC (rev 10325) +++ trunk/cdk/src/main/org/openscience/cdk/tools/StructureResonanceGenerator.java 2008-03-05 11:02:27 UTC (rev 10326) @@ -231,24 +231,18 @@ * @return True, if the atomContainer is contained */ private boolean existAC(IAtomContainerSet set, IAtomContainer atomContainer) { -// atomContainer = setID(atomContainer); for(int i = 0 ; i < atomContainer.getAtomCount(); i++) atomContainer.getAtom(i).setID(""+atomContainer.getAtomNumber(atomContainer.getAtom(i))); QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolChargeIDQueryContainer(atomContainer); for(int i = 0 ; i < set.getAtomContainerCount(); i++){ -// IAtomContainer ac = setID(set.getAtomContainer(i)); IAtomContainer ss = set.getAtomContainer(i); for(int j = 0 ; j < ss.getAtomCount(); j++) ss.getAtom(j).setID(""+ss.getAtomNumber(ss.getAtom(j))); -// QueryAtomContainer qAC = QueryAtomContainerCreator.createSymbolChargeIDQueryContainer(ac); -// QueryAtomContainer qAC = QueryAtomContainerCreator.createAnyAtomContainer(atomContainer,false); try { if(UniversalIsomorphismTester.isIsomorph(ss,qAC)){ -// logger.debug("exist"); -// SmilesGenerator sg = new SmilesGenerator(); -// System.out.println(sg.createSMILES((IMolecule) atomContainer)); -// System.out.println(sg.createSMILES((IMolecule) ss)); - return true; + QueryAtomContainer qAC2 = QueryAtomContainerCreator.createSymbolAndBondOrderQueryContainer(atomContainer); + if(UniversalIsomorphismTester.isIsomorph(ss,qAC2)) + return true; } } catch (CDKException e1) { System.err.println(e1); Modified: trunk/cdk/src/test/org/openscience/cdk/tools/StructureResonanceGeneratorTest.java =================================================================== --- trunk/cdk/src/test/org/openscience/cdk/tools/StructureResonanceGeneratorTest.java 2008-03-05 11:01:12 UTC (rev 10325) +++ trunk/cdk/src/test/org/openscience/cdk/tools/StructureResonanceGeneratorTest.java 2008-03-05 11:02:27 UTC (rev 10326) @@ -51,7 +51,6 @@ import org.openscience.cdk.reaction.type.RearrangementLonePairReaction; import org.openscience.cdk.reaction.type.RearrangementRadicalReaction; import org.openscience.cdk.reaction.type.SharingLonePairReaction; -import org.openscience.cdk.smiles.SmilesGenerator; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; /** @@ -772,7 +771,7 @@ StructureResonanceGenerator gRI = new StructureResonanceGenerator(); IMoleculeSet resonanceStructures = gRI.getStructures(molecule); - Assert.assertEquals(4,resonanceStructures.getAtomContainerCount()); + Assert.assertEquals(5,resonanceStructures.getAtomContainerCount()); } /** * @@ -808,8 +807,7 @@ AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); LonePairElectronChecker lpChecker = new LonePairElectronChecker(); lpChecker.saturate(molecule); - SmilesGenerator sg = new SmilesGenerator(); - System.out.println(sg.createSMILES(molecule)); + Assert.assertEquals(18, molecule.getAtomCount()); StructureResonanceGenerator gRI = new StructureResonanceGenerator(); @@ -821,10 +819,7 @@ gRI.setReactions(newReactionList); IMoleculeSet resonanceStructures = gRI.getStructures(molecule); - -// SmilesGenerator sg = new SmilesGenerator(); - for(int i = 0; i < resonanceStructures.getMoleculeCount(); i++) - System.out.println(sg.createSMILES((IMolecule) resonanceStructures.getMolecule(i))); + Assert.assertEquals(2,resonanceStructures.getAtomContainerCount()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |