fragmentation bug

User 870ab5b546

02-11-2010 04:17:21

The code:


                final Molecule[] respFrags = respMol.convertToFrags();
debugPrint("Found ", respFrags.length,
" molecule(s) in response:");
if (Utils.isEmpty(respFrags)) { // something is very wrong
debugPrint("respMol is: ", respMol);
} else {
int fragNum = 0;
for (Molecule frag : respFrags) {
debugPrintMRV("Fragment ", ++fragNum, ":\n", frag);
}
}

The response MRV;


<?xml version="1.0" ?>
<cml>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18"
elementType="C C C C C C R H H C H H H H H H H Br"
mrvMap="1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0"
sgroupRef="0 0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0 0 0"
x3="1.0045666666666666 -0.4286333333333334 -1.3903333333333332 -1.0045333333333335 0.42866666666666653 1.3902666666666668 1.6263988699149219 1.0560666385609596 -0.6692003530975738 -0.5169893370069902 -1.2929444210994596 -2.353828076033667 -1.626315839563311 -1.0560688162933063 0.4912664473427639 0.6692395901437493 1.2928593593471067 3.069756399845849"
y3="-1.3730416738192242 -1.1358416738192236 -1.3103416738192237 -0.45574167381922415 -0.692841673819224 -0.5184416738192237 -1.0401555599552257 -2.4077359679415853 -1.918924280451677 0.34445827453093636 -2.3462492017359007 -0.9358883278194555 -0.7886394279515678 0.5789521933536659 -1.7405511726033835 0.09033099765570352 0.5174561749091178 -1.1711043712382465"
z3="0.96 1.3814 0.22699999999999998 -0.96 -1.3814 -0.22700000000000004 1.7910304123195164 0.6210966648061492 2.100433476405288 1.7967375489037014 -0.09782455784540439 0.5727782128162442 -1.7910629339827455 -0.6211007594713557 -1.6754851468822425 -2.10033340104944 0.0978499091592103 -0.829781585272348"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a2 a9" order="1" />
<bond atomRefs2="a2 a10" order="1" />
<bond atomRefs2="a3 a11" order="1" />
<bond atomRefs2="a3 a12" order="1" />
<bond atomRefs2="a4 a13" order="1" />
<bond atomRefs2="a4 a14" order="1" />
<bond atomRefs2="a5 a15" order="1" />
<bond atomRefs2="a5 a16" order="1" />
<bond atomRefs2="a6 a17" order="1" />
<bond atomRefs2="a6 a18" order="1" />
</bondArray>
<molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2">
<atomArray
atomID="a19 a20 a21 a22 a23 a24"
elementType="C C C C C C"
attachmentPoint="1 0 0 0 0 0"
x2="3.130163843231781 3.852201850233919 5.265841455528305 5.987596638920097 5.265841455528305 3.852201850233916"
y2="0.2900505557635391 -0.9211113067697279 -0.9230673748500757 0.2900505557635391 1.5031684863771542 1.5012124182968032"
/>
<bondArray>
<bond atomRefs2="a19 a20" order="2" />
<bond atomRefs2="a19 a24" order="1" />
<bond atomRefs2="a20 a21" order="1" />
<bond atomRefs2="a21 a22" order="2" />
<bond atomRefs2="a22 a23" order="1" />
<bond atomRefs2="a23 a24" order="2" />
</bondArray>
</molecule>
</molecule>
</MChemicalStruct>
<MNameTextBox id="o2" fontScale="10.0" halign="CENTER" valign="TOP"
autoSize="false" autoResize="true" autoAlign="true"
preferredWidth="20.838125">
<Field name="text">[(1R,2S,6S)-2-bromo-6-methylcyclohexyl]benzene</Field>
<MPoint x="-8.069541603040559" y="-3.1777359679415857" />
<MPoint x="8.174614241115286" y="-3.1777359679415866" />
<MPoint x="8.174614241115286" y="-3.9785359679415864" />
<MPoint x="-8.069541603040559" y="-3.9785359679415864" />
</MNameTextBox>
</MDocument>
</cml>

The output after importing the response into a Molecule respMol:


Before fragmenting, respMol is:
<?xml version="1.0" ?>
<cml>
<MDocument>
<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"
elementType="C C C C C C C H H C H H H H H H H Br C C C C C"
mrvMap="1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
x3="1.0045666666666666 -0.4286333333333334 -1.3903333333333332 -1.0045333333333335 0.42866666666666653 1.3902666666666668 1.6263988699149219 1.0560666385609596 -0.6692003530975738 -0.5169893370069902 -1.2929444210994596 -2.353828076033667 -1.626315839563311 -1.0560688162933063 0.4912664473427639 0.6692395901437493 1.2928593593471067 3.069756399845849 2.8345810327041794 4.081797947962453 4.145570353359819 2.936714349947198 1.6913438021515437"
y3="-1.3730416738192242 -1.1358416738192236 -1.3103416738192237 -0.45574167381922415 -0.692841673819224 -0.5184416738192237 -1.0401555599552257 -2.4077359679415853 -1.918924280451677 0.34445827453093636 -2.3462492017359007 -0.9358883278194555 -0.7886394279515678 0.5789521933536659 -1.7405511726033835 0.09033099765570352 0.5174561749091178 -1.1711043712382465 -1.767168491290387 -1.101713213940485 0.30843526712064573 1.0373061893986888 0.368401892400709"
z3="0.96 1.3814 0.22699999999999998 -0.96 -1.3814 -0.22700000000000004 1.7910304123195164 0.6210966648061492 2.100433476405288 1.7967375489037014 -0.09782455784540439 0.5727782128162442 -1.7910629339827455 -0.6211007594713557 -1.6754851468822425 -2.10033340104944 0.0978499091592103 -0.829781585272348 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a2 a9" order="1" />
<bond atomRefs2="a2 a10" order="1" />
<bond atomRefs2="a3 a11" order="1" />
<bond atomRefs2="a3 a12" order="1" />
<bond atomRefs2="a4 a13" order="1" />
<bond atomRefs2="a4 a14" order="1" />
<bond atomRefs2="a5 a15" order="1" />
<bond atomRefs2="a5 a16" order="1" />
<bond atomRefs2="a6 a17" order="1" />
<bond atomRefs2="a6 a18" order="1" />
<bond atomRefs2="a7 a19" order="A" />
<bond atomRefs2="a7 a23" order="A" />
<bond atomRefs2="a19 a20" order="A" />
<bond atomRefs2="a20 a21" order="A" />
<bond atomRefs2="a21 a22" order="A" />
<bond atomRefs2="a22 a23" order="A" />
</bondArray>
<molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2" />
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

Found 1 molecule(s) in response:
Fragment 1:
<?xml version="1.0" ?>
<cml>
<MDocument>
<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"
elementType="C C C C C C C H H C H H H H H H H Br C C C C C"
mrvMap="1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
x2="1.0045666666666666 -0.4286333333333334 -1.3903333333333332 -1.0045333333333335 0.42866666666666653 1.3902666666666668 1.6263988699149219 1.0560666385609596 -0.6692003530975738 -0.5169893370069902 -1.2929444210994596 -2.353828076033667 -1.626315839563311 -1.0560688162933063 0.4912664473427639 0.6692395901437493 1.2928593593471067 3.069756399845849 2.8345810327041794 4.081797947962453 4.145570353359819 2.936714349947198 1.6913438021515437"
y2="-1.3730416738192242 -1.1358416738192236 -1.3103416738192237 -0.45574167381922415 -0.692841673819224 -0.5184416738192237 -1.0401555599552257 -2.4077359679415853 -1.918924280451677 0.34445827453093636 -2.3462492017359007 -0.9358883278194555 -0.7886394279515678 0.5789521933536659 -1.7405511726033835 0.09033099765570352 0.5174561749091178 -1.1711043712382465 -1.767168491290387 -1.101713213940485 0.30843526712064573 1.0373061893986888 0.368401892400709"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a9" order="1" />
<bond atomRefs2="a2 a10" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a3 a11" order="1" />
<bond atomRefs2="a3 a12" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a4 a13" order="1" />
<bond atomRefs2="a4 a14" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a5 a15" order="1" />
<bond atomRefs2="a5 a16" order="1" />
<bond atomRefs2="a6 a17" order="1" />
<bond atomRefs2="a6 a18" order="1" />
<bond atomRefs2="a7 a19" order="A" />
<bond atomRefs2="a7 a23" order="A" />
<bond atomRefs2="a19 a20" order="A" />
<bond atomRefs2="a20 a21" order="A" />
<bond atomRefs2="a21 a22" order="A" />
<bond atomRefs2="a22 a23" order="A" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

Note the change from 3D to 2D.  


The output when the IUPAC name is removed from the original MRV:


Before fragmenting, respMol is:
<?xml version="1.0" ?>
<cml>
<MDocument>
<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"
elementType="C C C C C C C H H C H H H H H H H Br C C C C C"
mrvMap="1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
x3="1.0045666666666666 -0.4286333333333334 -1.3903333333333332 -1.0045333333333335 0.42866666666666653 1.3902666666666668 1.6263988699149219 1.0560666385609596 -0.6692003530975738 -0.5169893370069902 -1.2929444210994596 -2.353828076033667 -1.626315839563311 -1.0560688162933063 0.4912664473427639 0.6692395901437493 1.2928593593471067 3.069756399845849 2.8345810327041794 4.081797947962453 4.145570353359819 2.936714349947198 1.6913438021515437"
y3="-1.3730416738192242 -1.1358416738192236 -1.3103416738192237 -0.45574167381922415 -0.692841673819224 -0.5184416738192237 -1.0401555599552257 -2.4077359679415853 -1.918924280451677 0.34445827453093636 -2.3462492017359007 -0.9358883278194555 -0.7886394279515678 0.5789521933536659 -1.7405511726033835 0.09033099765570352 0.5174561749091178 -1.1711043712382465 -1.767168491290387 -1.101713213940485 0.30843526712064573 1.0373061893986888 0.368401892400709"
z3="0.96 1.3814 0.22699999999999998 -0.96 -1.3814 -0.22700000000000004 1.7910304123195164 0.6210966648061492 2.100433476405288 1.7967375489037014 -0.09782455784540439 0.5727782128162442 -1.7910629339827455 -0.6211007594713557 -1.6754851468822425 -2.10033340104944 0.0978499091592103 -0.829781585272348 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a2 a9" order="1" />
<bond atomRefs2="a2 a10" order="1" />
<bond atomRefs2="a3 a11" order="1" />
<bond atomRefs2="a3 a12" order="1" />
<bond atomRefs2="a4 a13" order="1" />
<bond atomRefs2="a4 a14" order="1" />
<bond atomRefs2="a5 a15" order="1" />
<bond atomRefs2="a5 a16" order="1" />
<bond atomRefs2="a6 a17" order="1" />
<bond atomRefs2="a6 a18" order="1" />
<bond atomRefs2="a7 a19" order="A" />
<bond atomRefs2="a7 a23" order="A" />
<bond atomRefs2="a19 a20" order="A" />
<bond atomRefs2="a20 a21" order="A" />
<bond atomRefs2="a21 a22" order="A" />
<bond atomRefs2="a22 a23" order="A" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

Found 1 molecule(s) in response:
Fragment 1:
<?xml version="1.0" ?>
<cml>
<MDocument>
<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"
elementType="C C C C C C C H H C H H H H H H H Br C C C C C"
mrvMap="1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
x3="1.0045666666666666 -0.4286333333333334 -1.3903333333333332 -1.0045333333333335 0.42866666666666653 1.3902666666666668 1.6263988699149219 1.0560666385609596 -0.6692003530975738 -0.5169893370069902 -1.2929444210994596 -2.353828076033667 -1.626315839563311 -1.0560688162933063 0.4912664473427639 0.6692395901437493 1.2928593593471067 3.069756399845849 2.8345810327041794 4.081797947962453 4.145570353359819 2.936714349947198 1.6913438021515437"
y3="-1.3730416738192242 -1.1358416738192236 -1.3103416738192237 -0.45574167381922415 -0.692841673819224 -0.5184416738192237 -1.0401555599552257 -2.4077359679415853 -1.918924280451677 0.34445827453093636 -2.3462492017359007 -0.9358883278194555 -0.7886394279515678 0.5789521933536659 -1.7405511726033835 0.09033099765570352 0.5174561749091178 -1.1711043712382465 -1.767168491290387 -1.101713213940485 0.30843526712064573 1.0373061893986888 0.368401892400709"
z3="0.96 1.3814 0.22699999999999998 -0.96 -1.3814 -0.22700000000000004 1.7910304123195164 0.6210966648061492 2.100433476405288 1.7967375489037014 -0.09782455784540439 0.5727782128162442 -1.7910629339827455 -0.6211007594713557 -1.6754851468822425 -2.10033340104944 0.0978499091592103 -0.829781585272348 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164 1.7910304123195164"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a9" order="1" />
<bond atomRefs2="a2 a10" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a3 a11" order="1" />
<bond atomRefs2="a3 a12" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a4 a13" order="1" />
<bond atomRefs2="a4 a14" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a5 a15" order="1" />
<bond atomRefs2="a5 a16" order="1" />
<bond atomRefs2="a6 a17" order="1" />
<bond atomRefs2="a6 a18" order="1" />
<bond atomRefs2="a7 a19" order="A" />
<bond atomRefs2="a7 a23" order="A" />
<bond atomRefs2="a19 a20" order="A" />
<bond atomRefs2="a20 a21" order="A" />
<bond atomRefs2="a21 a22" order="A" />
<bond atomRefs2="a22 a23" order="A" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

Note the 3D information has been retained.


I can't think of any good reason why the 3D information would be lost when the textbox is present.  Please fix.  We see the same problem in JChem 5.3.8pre1 and JChem 5.3.3.

ChemAxon e500b51457

05-11-2010 11:42:33

Hi Bob,

We need some more time to find the cause. Thank you for your patience.

Regards,
Erika.

User 870ab5b546

05-11-2010 14:46:33

Meanwhile, here is a workaround.  Call this method if a molecule is 3D and you are going to be converting it to its fragments.


    /** Removes MObjects from a molecule's document.  
* @param origMol the molecule whose MObjects are to be removed
* @return a copy of the molecule wih all extraneous objects removed
*/
public static Molecule removeObjects(Molecule origMol) {
final MDocument doc = origMol.getDocument();
Molecule newMol = origMol;
if (doc != null) {
final int numObjs = doc.getObjectCount();
for (int objNum = numObjs - 1; objNum >= 0; objNum--) {
final MObject obj = doc.getObject(objNum);
if (!(obj instanceof MChemicalStruct)) {
doc.removeObject(obj);
} // if object is anything other than a molecule
} // for each object in the MDocument
try {
final String newStr = doc.exportToFormat("mrv");
newMol = MolImporter.importMol(newStr);
} catch (MolExportException e) {
System.out.println("Caught MolExportException.");
} catch (MolFormatException e) {
System.out.println("Caught MolFormatException.");
} // try
} // if doc is null
return newMol;
} // removeObjects(Molecule)

ChemAxon e500b51457

09-11-2010 08:51:12

Hi Bob,

Thanks for the hints, we could reproduce the problem and we are working on the solution.
We will notify you as soon as the fix is ready.

Regards,
Erika.

User 870ab5b546

01-12-2010 14:52:22

Has this bug been fixed in JChem 5.4.0?

ChemAxon e500b51457

02-12-2010 10:47:39

Hi Bob,

Not yet, we will fix it in 5.4.1.

Regards,
Erika

User 870ab5b546

29-03-2011 23:22:12

Was this bug fixed in 5.4.1?  If not, will it be fixed in 5.5?

ChemAxon e500b51457

31-03-2011 13:40:20

Hi Bob,


We have fixed it, it will be available in 5.5.


Regards,


Erika