|
47 | 47 | import org.openscience.cdk.sgroup.Sgroup; |
48 | 48 | import org.openscience.cdk.silent.PseudoAtom; |
49 | 49 | import org.openscience.cdk.silent.SilentChemObjectBuilder; |
| 50 | +import org.openscience.cdk.smiles.SmiFlavor; |
50 | 51 | import org.openscience.cdk.smiles.SmilesGenerator; |
51 | 52 | import org.openscience.cdk.smiles.SmilesParser; |
52 | 53 | import org.openscience.cdk.stereo.TetrahedralChirality; |
@@ -1289,6 +1290,18 @@ public void testSgroupSuppressionSRUCrossingBond() throws Exception { |
1289 | 1290 | "CCC[H] |Sg:n:2:n:ht|"); |
1290 | 1291 | } |
1291 | 1292 |
|
| 1293 | + @Test |
| 1294 | + public void keepStereoGroup() throws Exception { |
| 1295 | + assertRemoveH("C[C@]([H])(O)CC |o1:1|", |
| 1296 | + "C[C@H](O)CC |o1:1|"); |
| 1297 | + } |
| 1298 | + |
| 1299 | + @Test |
| 1300 | + public void keepStereoGroup2() throws Exception { |
| 1301 | + assertAddH("C[C@H](O)CC |o1:1|", |
| 1302 | + "C([C@](O[H])(C(C([H])([H])[H])([H])[H])[H])([H])([H])[H] |o1:1|"); |
| 1303 | + } |
| 1304 | + |
1292 | 1305 | @Test |
1293 | 1306 | public void molecularWeight() throws InvalidSmilesException, IOException { |
1294 | 1307 | SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); |
@@ -1331,7 +1344,16 @@ static void assertRemoveH(String smiIn, String smiExp) throws Exception { |
1331 | 1344 | SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); |
1332 | 1345 | IAtomContainer m = smipar.parseSmiles(smiIn); |
1333 | 1346 |
|
1334 | | - String smiAct = new SmilesGenerator().create(AtomContainerManipulator.removeHydrogens(m)); |
| 1347 | + String smiAct = new SmilesGenerator(SmiFlavor.Default).create(AtomContainerManipulator.removeHydrogens(m)); |
| 1348 | + |
| 1349 | + assertThat(smiAct, is(smiExp)); |
| 1350 | + } |
| 1351 | + |
| 1352 | + static void assertAddH(String smiIn, String smiExp) throws Exception { |
| 1353 | + SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); |
| 1354 | + IAtomContainer m = smipar.parseSmiles(smiIn); |
| 1355 | + AtomContainerManipulator.convertImplicitToExplicitHydrogens(m); |
| 1356 | + String smiAct = new SmilesGenerator(SmiFlavor.Default).create(m); |
1335 | 1357 |
|
1336 | 1358 | assertThat(smiAct, is(smiExp)); |
1337 | 1359 | } |
|
0 commit comments