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.