User 870ab5b546
12-12-2006 18:45:17
The code:
(See this post for definitions of the methods in getSearchMolecule().) The student molecule:
The author molecule:
The log:
???
Code: |
studentMolecule = getSearchMolecule(studentXml, true); // hydrogenize authorMolecule = getSearchMolecule(authorXml, false); // don't hydro. MolSearch searchObject = setupSearchObject(); try { print("hasSubstructure: looking for first occurrence of " + "author string in student response"); searchResult = searchObject.findFirst(); ... public MolSearch setupSearchObject() { MolSearch searchObject = new MolSearch(); searchObject.setSearchType(SearchConstants.SUBSTRUCTURE); searchObject.setQuery(authorMolecule); searchObject.setTarget(studentMolecule); return searchObject; } // setupSearchObject() ... public Molecule getSearchMolecule(String xml, boolean hydrogenizeIt) throws MolFormatException { MolImporter importer = new MolImporter(); Molecule molecule = importer.importMol(xml); molecule.ungroupSgroups(); molecule.aromatize(); if (hydrogenizeIt) molecule = ChemUtils.addImplicitHnoClone(molecule); molecule = MechSet.normalizeRadicals(molecule); molecule = MolFunctions.replaceHnoClone(molecule); return molecule; } // getSearchMolecule(String, boolean) |
(See this post for definitions of the methods in getSearchMolecule().) The student molecule:
Code: |
<?xml version="1.0" ?> <MDocument> <MPolyline id="o1" color="#000000" headLength="0.8" headWidth="0.5"> <MPoint x="-1.6843750476837158" y="2.40625" /> <MRectanglePoint pos="7" rectRef="o2" /> </MPolyline> <MRectangle id="o2" color="#000000"> <MPoint x="0.38499999046325684" y="5.149374961853027" /> <MPoint x="9.143750190734863" y="5.149374961853027" /> <MPoint x="9.143750190734863" y="-0.24062499403953552" /> <MPoint x="0.38499999046325684" y="-0.24062499403953552" /> </MRectangle> <MRectangle id="o3" color="#000000"> <MPoint x="-9.7212495803833" y="5.245625019073486" /> <MPoint x="-1.6843750476837158" y="5.245625019073486" /> <MPoint x="-1.6843750476837158" y="-0.2887499928474426" /> <MPoint x="-9.7212495803833" y="-0.2887499928474426" /> </MRectangle> <MEFlow id="o4" color="#000000" arcAngle="-150.0" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a4 m1.a7" /> <MAtomSetPoint atomRefs="m1.a7 m1.a2" weights="0.25 0.75" /> </MEFlow> <MChemicalStruct> <molecule molID="m1"> <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29" elementType="C C C C C C C C C C C C C C H H H H H H H H H H H H H H H" formalCharge="0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" x2="-8.036875247955322 -6.7031961261272865 -5.369517004299251 -4.035837882471215 -2.7021587606431794 -4.035837882471215 -4.035837882471215 1.8768748283386234 3.210553950166659 4.544233071994695 5.877912193822731 7.211591315650766 5.877912193822731 3.210553950166659 -8.806875247955322 -6.703196126127287 -5.369517004299251 -3.472158760643179 -2.495837882471215 -4.035837882471215 -2.495837882471215 2.6468748283386234 0.5431957065105879 4.544233071994695 7.981591315650766 8.545270437478802 4.3379121938227305 1.670553950166659 3.210553950166659" y2="1.9731249809265137 2.7431249809265137 1.9731249809265137 2.7431249809265137 1.9731249809265137 1.2031249809265137 4.283124980926514 2.0693749332427966 2.8393749332427967 2.0693749332427966 2.8393749332427967 2.0693749332427966 1.2993749332427966 4.379374933242797 3.3068041027545494 4.283124980926514 3.5131249809265137 0.639445859098478 1.2031249809265137 -0.3368750190734864 4.283124980926514 0.7356958114147611 1.2993749332427966 0.5293749332427966 3.4030540550708324 1.2993749332427966 1.2993749332427964 4.379374933242797 5.919374933242797" /> <bondArray> <bond atomRefs2="a1 a2" order="1" /> <bond atomRefs2="a2 a3" order="1" /> <bond atomRefs2="a3 a4" order="1" /> <bond atomRefs2="a4 a5" order="1" /> <bond atomRefs2="a4 a6" order="1" /> <bond atomRefs2="a4 a7" order="1" /> <bond atomRefs2="a8 a9" order="1" /> <bond atomRefs2="a9 a10" order="1" /> <bond atomRefs2="a10 a11" order="1" /> <bond atomRefs2="a11 a12" order="1" /> <bond atomRefs2="a11 a13" order="1" /> <bond atomRefs2="a9 a14" order="1" /> <bond atomRefs2="a1 a15" order="1" /> <bond atomRefs2="a2 a16" order="1" /> <bond atomRefs2="a3 a17" order="1" /> <bond atomRefs2="a5 a18" order="1" /> <bond atomRefs2="a6 a19" order="1" /> <bond atomRefs2="a6 a20" order="1" /> <bond atomRefs2="a7 a21" order="1" /> <bond atomRefs2="a8 a22" order="1" /> <bond atomRefs2="a8 a23" order="1" /> <bond atomRefs2="a10 a24" order="1" /> <bond atomRefs2="a12 a25" order="1" /> <bond atomRefs2="a12 a26" order="1" /> <bond atomRefs2="a13 a27" order="1" /> <bond atomRefs2="a14 a28" order="1" /> <bond atomRefs2="a14 a29" order="1" /> </bondArray> </molecule> </MChemicalStruct> </MDocument> |
The author molecule:
Code: |
<?xml version="1.0" ?> <MDocument> <MEFlow id="o1" arcAngle="-150.0" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a1 m1.a2" /> <MAtomSetPoint atomRefs="m1.a2 m1.a4" weights="0.25 0.75" /> </MEFlow> <MChemicalStruct> <molecule molID="m1"> <atomArray atomID="a1 a2 a3 a4" elementType="C C C C" formalCharge="0 0 0 1" mrvQueryProps="0 A: 0 0" x2="-13.766666412353516 -12.226666412353515 -14.058333396911621 -12.518333396911622" y2="2.3333332538604736 2.3333332538604736 -0.5249999761581421 -0.5249999761581421" /> <bondArray> <bond atomRefs2="a1 a2" order="1" /> <bond atomRefs2="a3 a4" order="1" /> </bondArray> </molecule> </MChemicalStruct> </MDocument> |
The log:
Code: |
MechSubStructSearch::hasSubstructure: setting up search object MechSubStructSearch::hasSubstructure: looking for first occurrence of author string in student response MechSubstructure: exception thrown, msg = -1 java.lang.ArrayIndexOutOfBoundsException: -1 at chemaxon.sss.search.StructureSearch.initMolecule(StructureSearch.java:1873) at chemaxon.sss.search.StructureSearch.initSearch(StructureSearch.java:1430) at chemaxon.sss.search.StructureSearch.findFirst0(StructureSearch.java:5163) at chemaxon.sss.search.StructureSearch.findFirst(StructureSearch.java:5156) at chemaxon.sss.search.MolSearch.findNextEnumerated(MolSearch.java:1114) at chemaxon.sss.search.MolSearch.findNextFiltered(MolSearch.java:1004) at chemaxon.sss.search.MolSearch.findFirst(MolSearch.java:896) at com.prenhall.epoch.mechanisms.MechSubStructSearch.hasSubstructure(MechSubStructSearch.java:87) |
???