exception when performing API MolSearch against polymer

User f05f6b8c05

09-03-2011 02:21:58

Hi,


When we run the attached java code against the attached mol file, we see the below exception.  Is there a way to run the query as to prevent this problem?


We are using java version "1.5.0_17" and JChem 5.4.1.1.


Many thanks for any guidance.


Cheers,


Andrew




 


chemaxon.sss.search.SearchException: An error occured during search:java.lang.ArrayIndexOutOfBoundsException: -1


  Query:Cl


  Target:


<?xml version="1.0" ?>


<cml>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray


          atomID="a1 a2 a3 a4 a5 a6 a7"


          elementType="* C C * C O O"


          formalCharge="0 0 0 0 0 -1 0"


          sgroupRef="0 sg1 sg1 0 sg1 sg1 sg1"


          x2="0.32999999999999874 -0.44000000000000083 0.33000000000000007 1.87 -0.4399999999999995 0.33000000000000096 -1.9799999999999995"


          y2="2.8578838324886475 1.5242047106606114 0.1905255888325761 0.19052558883257698 -1.1431535329954596 -2.4768326548234953 -1.1431535329954596"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a3 a5" order="1" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a5 a6" order="1" />


        <bond atomRefs2="a5 a7" order="2" />


      </bondArray>


      <molecule id="sg1" role="SruSgroup" title="n" molID="m2"


         atomRefs="a2 a3 a5 a6 a7 a8" correspondence="" bondList="" connect="ht">


        <MBracket type="SQUARE" orientation="SINGLE">


          <MPoint x="-2.7499999999999996" y="3.017190917350883" />


          <MPoint x="-2.3649999999999993" y="3.017190917350883" />


          <MPoint x="-2.3649999999999993" y="-3.2468326548234954" />


          <MPoint x="-2.7499999999999996" y="-3.2468326548234954" />


        </MBracket>


        <MBracket type="SQUARE" orientation="SINGLE">


          <MPoint x="6.82" y="-3.2468326548234954" />


          <MPoint x="6.4350000000000005" y="-3.2468326548234954" />


          <MPoint x="6.4350000000000005" y="3.017190917350883" />


          <MPoint x="6.82" y="3.017190917350883" />


        </MBracket>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>


</cml>


 


 


Caused by:


-1


        at chemaxon.sss.search.MolSearch.getWrapperSearchException(MolSearch.java:697)


        at chemaxon.sss.search.MolSearch.findFirstHit(MolSearch.java:732)


        at chemaxon.sss.search.MolSearch.findAllHits(MolSearch.java:795)


        at chemaxon.sss.search.Search.findAll(Search.java:649)


        at polyprob.<init>(polyprob.java:53)


        at polyprob.main(polyprob.java:18)


Caused by: java.lang.ArrayIndexOutOfBoundsException: -1


        at chemaxon.sss.search.BracketComparator.setAtomsSgData(BracketComparator.java:239)


        at chemaxon.sss.search.BracketComparator.initSgroupData(BracketComparator.java:184)


        at chemaxon.sss.search.bracket.PolymerMatcher.removeStarAtoms(PolymerMatcher.java:245)


        at chemaxon.sss.search.bracket.PolymerMatcher.transform(PolymerMatcher.java:224)


        at chemaxon.sss.search.StructureSearch.transformPolymers(StructureSearch.java:1612)


        at chemaxon.sss.search.StructureSearch.transformPolymers(StructureSearch.java:1596)


        at chemaxon.sss.search.StructureSearch.handlePolymers(StructureSearch.java:1582)


        at chemaxon.sss.search.StructureSearch.initSearch(StructureSearch.java:1477)


        at chemaxon.sss.search.StructureSearch.findFirst0(StructureSearch.java:6308)


        at chemaxon.sss.search.StructureSearch.findFirstHit(StructureSearch.java:6297)


        at chemaxon.sss.search.MolSearch.findNextEnumeratedHit(MolSearch.java:1024)


        at chemaxon.sss.search.MolSearch.findNextFilteredHit(MolSearch.java:877)


        at chemaxon.sss.search.MolSearch.findFirstHit(MolSearch.java:724)


        ... 4 more


ChemAxon a3d59b832c

09-03-2011 10:09:39

Hi Andrew,


 


It seems that the call convertToFrags() creates an inconsistent molecule. Probably it does not handle the brackets properly. My colleagues will check this function.


 


In the meantime, I suggest to use the search type:


 


so.setSearchType(SearchConstants.FULL_FRAGMENT);


 


on the original molecule. It would match to complete fragments only.


 


Best regards,


Szabolcs

User f05f6b8c05

11-03-2011 11:55:49

Hi,


Thanks for the quick reply (and work-around suggestion) .. please let us know when/if the problematic function is fixed.


Best,


Andrew

ChemAxon a202a732bf

20-09-2011 07:39:10

Hi Andrew,


I am happy to inform you that in Marvin 5.6 released few days ago the method Molecule.convertToFrags() works correctly, the returned fragments will be
consistent molecules.


I would like to mention that this method separates the S-group in the molecule given in 'poly.mol' into two fragments and removes the disconnected repeating unit S-group (to keep the same functioning as before). If in cases like this you would like to keep separate fragments contained in the same S-groups in one fragment without removing the S-group, then please use instead of


Molecule frags[] = ((Molecule)mol.clone()).convertToFrags();


the following code:


Molecule clonedMolecule = (Molecule)mol.clone();

clonedMolecule.setGUIContracted(false);

Molecule frags[] = clonedMolecule.findFrags(Molecule.class, MoleculeGraph.FRAG_KEEPING_SGROUPS);


Best regards,


Zsuzsa

User f05f6b8c05

09-10-2011 21:58:41

Thanks very much for the update!