Skip to content

Commit 8a325e6

Browse files
committed
Rename AND1, AND2, to RAC1, RAC2 and OR1, OR2 to REL1, REL2 etc.
1 parent 9810c26 commit 8a325e6

File tree

9 files changed

+59
-56
lines changed

9 files changed

+59
-56
lines changed

base/interfaces/src/main/java/org/openscience/cdk/interfaces/IStereoElement.java

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@
7676
* racemic and unknown enantiomers. In V2000 MOLfile if the chiral flag is 0 it indicates the structure is a mixture
7777
* of enantiomers. V3000 extended this concept to not only encode mixtures (and enantiomer) but also unknown
7878
* stereochemistry (or enantiomer) and to be per chiral centre allow representation of any epimers.
79-
* Reading an MDLV2000 molfile a chiral flag of 0 is equivalent to setting all stereocentres to {@link #GRP_AND1}.
79+
* Reading an MDLV2000 molfile a chiral flag of 0 is equivalent to setting all stereocentres to {@link #GRP_RAC1}.
8080
* This information can also be encoded in CXSMILES. By default all stereocentres are {@link #GRP_ABS}.
8181
*
8282
* The stereo group information is stored in the high bytes of the stereo configuration. You can access the basic
8383
* information as follows:
8484
* <pre>{@code
8585
* int grpconfig = stereo.getGroupInfo();
86-
* if (grpconfig & IStereoElement.GRP_AND1) {
87-
* // group is AND1
88-
* } else if (config & IStereoElement.GRP_OR1) {
86+
* if (grpconfig & IStereoElement.GRP_RAC1) {
87+
* // group is RAC1
88+
* } else if (config & IStereoElement.GRP_REL1) {
8989
* // group is OR1
9090
* }
9191
* }</pre>
@@ -222,34 +222,37 @@ public interface IStereoElement<F extends IChemObject, C extends IChemObject>
222222
int GRP_NUM_MASK = 0xfc_0000;
223223
int GRP_NUM_SHIFT = 18; // Integer.numberOfTrailingZeros(0xfc_0000);
224224

225-
/** Stereo group type ABS (absolute) */
226-
int GRP_ABS = 0x00_0000;
227-
/** Stereo group type AND (and enantiomer) */
228-
int GRP_AND = 0x01_0000;
229-
/** Stereo group type OR (or enantiomer) */
230-
int GRP_OR = 0x02_0000;
231-
232-
/** Convenience field for testing if the stereo is group AND1 (&amp;1). */
233-
int GRP_AND1 = GRP_AND | (1 << GRP_NUM_SHIFT);
234-
/** Convenience field for testing if the stereo is group AND2 (&amp;2). */
235-
int GRP_AND2 = GRP_AND | (2 << GRP_NUM_SHIFT);
236-
/** Convenience field for testing if the stereo is group AND3 (&amp;3). */
237-
int GRP_AND3 = GRP_AND | (3 << GRP_NUM_SHIFT);
238-
/** Convenience field for testing if the stereo is group AND4 (&amp;4). */
239-
int GRP_AND4 = GRP_AND | (4 << GRP_NUM_SHIFT);
240-
/** Convenience field for testing if the stereo is group AND5 (&amp;5). */
241-
int GRP_AND5 = GRP_AND | (5 << GRP_NUM_SHIFT);
225+
/** Absolute stereo group, the exact stereo configuration of this atom is known. */
226+
int GRP_ABS = 0x00_0000;
227+
/** Racemic stereo group type, the stereo configuration of this atom is a mixture of R/S. An atom can be */
228+
int GRP_RAC = 0x01_0000;
229+
/**
230+
* Relative stereo group type, the stereo configuration of this atom is unknown but is relative to another
231+
* atom in the same group.
232+
*/
233+
int GRP_REL = 0x02_0000;
234+
235+
/** Convenience field for testing if the stereo is group RAC1 (&amp;1). */
236+
int GRP_RAC1 = GRP_RAC | (1 << GRP_NUM_SHIFT);
237+
/** Convenience field for testing if the stereo is group RAC2 (&amp;2). */
238+
int GRP_RAC2 = GRP_RAC | (2 << GRP_NUM_SHIFT);
239+
/** Convenience field for testing if the stereo is group RAC3 (&amp;3). */
240+
int GRP_RAC3 = GRP_RAC | (3 << GRP_NUM_SHIFT);
241+
/** Convenience field for testing if the stereo is group RAC4 (&amp;4). */
242+
int GRP_RAC4 = GRP_RAC | (4 << GRP_NUM_SHIFT);
243+
/** Convenience field for testing if the stereo is group RAC5 (&amp;5). */
244+
int GRP_RAC5 = GRP_RAC | (5 << GRP_NUM_SHIFT);
242245

243246
/** Convenience field for testing if the stereo is group OR1 (&amp;1). */
244-
int GRP_OR1 = GRP_OR | (1 << GRP_NUM_SHIFT);
247+
int GRP_REL1 = GRP_REL | (1 << GRP_NUM_SHIFT);
245248
/** Convenience field for testing if the stereo is group OR2 (&amp;2). */
246-
int GRP_OR2 = GRP_OR | (2 << GRP_NUM_SHIFT);
249+
int GRP_REL2 = GRP_REL | (2 << GRP_NUM_SHIFT);
247250
/** Convenience field for testing if the stereo is group OR3 (&amp;3). */
248-
int GRP_OR3 = GRP_OR | (3 << GRP_NUM_SHIFT);
251+
int GRP_REL3 = GRP_REL | (3 << GRP_NUM_SHIFT);
249252
/** Convenience field for testing if the stereo is group OR4 (&amp;4). */
250-
int GRP_OR4 = GRP_OR | (4 << GRP_NUM_SHIFT);
253+
int GRP_REL4 = GRP_REL | (4 << GRP_NUM_SHIFT);
251254
/** Convenience field for testing if the stereo is group OR5 (&amp;5). */
252-
int GRP_OR5 = GRP_OR | (5 << GRP_NUM_SHIFT);
255+
int GRP_REL5 = GRP_REL | (5 << GRP_NUM_SHIFT);
253256

254257
/**
255258
* The focus atom or bond at the 'centre' of the stereo-configuration.

display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ private void addStereoGroupAnnotations(IAtomContainer container) {
389389
// generate the label &1, or1
390390
String label = null;
391391
switch ((groupInfo & IStereoElement.GRP_TYPE_MASK)) {
392-
case IStereoElement.GRP_AND:
392+
case IStereoElement.GRP_RAC:
393393
label = "&";
394394
break;
395-
case IStereoElement.GRP_OR:
395+
case IStereoElement.GRP_REL:
396396
label = "or";
397397
break;
398398
case IStereoElement.GRP_ABS:
@@ -435,9 +435,9 @@ else if (ref_grp != elem.getGroupInfo())
435435
}
436436
}
437437
switch ((ref_grp & IStereoElement.GRP_TYPE_MASK)) {
438-
case IStereoElement.GRP_AND:
438+
case IStereoElement.GRP_RAC:
439439
return "and enantiomer";
440-
case IStereoElement.GRP_OR:
440+
case IStereoElement.GRP_REL:
441441
return "or enantiomer";
442442
}
443443
return null;

storage/ctab/src/main/java/org/openscience/cdk/io/MDLV2000Reader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ private IAtomContainer readAtomContainer(IAtomContainer molecule) throws CDKExce
549549
if (chiral == 0) {
550550
for (IStereoElement<?,?> se : outputContainer.stereoElements()) {
551551
if (se.getConfigClass() == IStereoElement.TH) {
552-
se.setGroupInfo(IStereoElement.GRP_AND1);
552+
se.setGroupInfo(IStereoElement.GRP_RAC1);
553553
}
554554
}
555555
}

storage/ctab/src/main/java/org/openscience/cdk/io/MDLV3000Reader.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ public IAtomContainer readConnectionTable(IChemObjectBuilder builder) throws CDK
233233
if (!chiral) {
234234
int max = 0;
235235
for (Integer val : stereoflags.values()) {
236-
if ((val&IStereoElement.GRP_TYPE_MASK) == IStereoElement.GRP_AND) {
236+
if ((val&IStereoElement.GRP_TYPE_MASK) == IStereoElement.GRP_RAC) {
237237
int num = val >>> IStereoElement.GRP_NUM_SHIFT;
238238
if (num > max)
239239
max = num;
240240
}
241241
}
242-
defaultRacGrp = IStereoElement.GRP_AND | (((max + 1) << IStereoElement.GRP_NUM_SHIFT));
242+
defaultRacGrp = IStereoElement.GRP_RAC | (((max + 1) << IStereoElement.GRP_NUM_SHIFT));
243243
}
244244

245245
for (IStereoElement<?, ?> se : readData.stereoElements()) {
@@ -260,7 +260,7 @@ else if (!chiral)
260260
// Tetrahedral stereo as AND1 (&1)
261261
for (IStereoElement<?, ?> se : readData.stereoElements()) {
262262
if (se.getConfigClass() == IStereoElement.TH) {
263-
se.setGroupInfo(IStereoElement.GRP_AND1);
263+
se.setGroupInfo(IStereoElement.GRP_RAC1);
264264
}
265265
}
266266
}
@@ -330,9 +330,9 @@ private void readCollection(IAtomContainer mol, Map<Integer,Integer> flags) thro
330330
if (command.startsWith("END COLLECTION"))
331331
break;
332332
else if (command.startsWith("MDLV30/STERAC")) {
333-
parseStereoGroup(flags, command, IStereoElement.GRP_AND);
333+
parseStereoGroup(flags, command, IStereoElement.GRP_RAC);
334334
} else if (command.startsWith("MDLV30/STEREL")) {
335-
parseStereoGroup(flags, command, IStereoElement.GRP_OR);
335+
parseStereoGroup(flags, command, IStereoElement.GRP_REL);
336336
} else if (command.startsWith("MDLV30/STEABS")) {
337337
parseStereoGroup(flags, command, IStereoElement.GRP_ABS);
338338
}

storage/ctab/src/test/java/org/openscience/cdk/io/MDLV2000ReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@ public void testNoChiralFlag() throws Exception {
19921992
Iterable<IStereoElement> iter = mol.stereoElements();
19931993
assertTrue(iter.iterator().hasNext());
19941994
for (IStereoElement<?,?> se : iter) {
1995-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
1995+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
19961996
}
19971997
}
19981998
}

storage/ctab/src/test/java/org/openscience/cdk/io/MDLV3000ReaderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public void testNoChiralFlag() throws Exception {
208208
Iterable<IStereoElement> iter = mol.stereoElements();
209209
assertTrue(iter.iterator().hasNext());
210210
for (IStereoElement<?,?> se : iter) {
211-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
211+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
212212
}
213213
}
214214
}
@@ -290,7 +290,7 @@ public void testStereoRac1() throws Exception {
290290
Iterable<IStereoElement> iter = mol.stereoElements();
291291
assertTrue(iter.iterator().hasNext());
292292
for (IStereoElement<?,?> se : iter) {
293-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
293+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
294294
}
295295
}
296296
}
@@ -330,7 +330,7 @@ public void testStereoRel1() throws Exception {
330330
try (MDLV3000Reader mdlr = new MDLV3000Reader(new StringReader(input))) {
331331
IAtomContainer mol = mdlr.read(bldr.newAtomContainer());
332332
for (IStereoElement<?,?> se : mol.stereoElements()) {
333-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_OR1));
333+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_REL1));
334334
}
335335
}
336336
}

storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,11 @@ else if (iter.nextIf("tu:")) {
470470
}
471471
break;
472472
case '&': // &1, &2 etc
473-
if (!processStereoGrps(state, iter, IStereoElement.GRP_AND))
473+
if (!processStereoGrps(state, iter, IStereoElement.GRP_RAC))
474474
return -1;
475475
break;
476476
case 'o': // o1, o2 etc
477-
if (!processStereoGrps(state, iter, IStereoElement.GRP_OR))
477+
if (!processStereoGrps(state, iter, IStereoElement.GRP_REL))
478478
return -1;
479479
break;
480480
case 'a': // abs etc

storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private void handleFragmentGrouping(IReaction rxn, CxSmilesState cxstate) {
415415
for (IStereoElement<?, ?> e : mol.stereoElements()) {
416416
// maybe also Al and AT?
417417
if (e.getConfigClass() == IStereoElement.TH) {
418-
e.setGroupInfo(IStereoElement.GRP_AND1);
418+
e.setGroupInfo(IStereoElement.GRP_RAC1);
419419
}
420420
}
421421
}
@@ -770,15 +770,15 @@ else if (chemObj instanceof IAtomContainer)
770770
for (IStereoElement<?, ?> e : ((IAtomContainer) chemObj).stereoElements()) {
771771
// maybe also Al and AT?
772772
if (e.getConfigClass() == IStereoElement.TH) {
773-
e.setGroupInfo(IStereoElement.GRP_AND1);
773+
e.setGroupInfo(IStereoElement.GRP_RAC1);
774774
}
775775
}
776776
} else if (chemObj instanceof IReaction) {
777777
for (IAtomContainer mol : ReactionManipulator.getAllAtomContainers((IReaction) chemObj)) {
778778
for (IStereoElement<?, ?> e : mol.stereoElements()) {
779779
// maybe also Al and AT?
780780
if (e.getConfigClass() == IStereoElement.TH) {
781-
e.setGroupInfo(IStereoElement.GRP_AND1);
781+
e.setGroupInfo(IStereoElement.GRP_RAC1);
782782
}
783783
}
784784
}

storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesParserTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ public void hydrogenAndCoordinationBondingSkipped() {
251251
CxSmilesState state = new CxSmilesState();
252252
assertThat(CxSmilesParser.processCx(cxsmilayers, state), is(not(-1)));
253253
Map<Integer,Integer> expected = new HashMap<>();
254-
expected.put(0, IStereoElement.GRP_AND1);
255-
expected.put(1, IStereoElement.GRP_AND1);
254+
expected.put(0, IStereoElement.GRP_RAC1);
255+
expected.put(1, IStereoElement.GRP_RAC1);
256256
assertThat(state.stereoGrps, is(expected));
257257
}
258258

@@ -261,8 +261,8 @@ public void hydrogenAndCoordinationBondingSkipped() {
261261
CxSmilesState state = new CxSmilesState();
262262
assertThat(CxSmilesParser.processCx(cxsmilayers, state), is(not(-1)));
263263
Map<Integer,Integer> expected = new HashMap<>();
264-
expected.put(0, IStereoElement.GRP_OR1);
265-
expected.put(1, IStereoElement.GRP_OR1);
264+
expected.put(0, IStereoElement.GRP_REL1);
265+
expected.put(1, IStereoElement.GRP_REL1);
266266
assertThat(state.stereoGrps, is(expected));
267267
}
268268

@@ -271,9 +271,9 @@ public void hydrogenAndCoordinationBondingSkipped() {
271271
CxSmilesState state = new CxSmilesState();
272272
assertThat(CxSmilesParser.processCx(cxsmilayers, state), is(not(-1)));
273273
Map<Integer,Integer> expected = new HashMap<>();
274-
expected.put(0, IStereoElement.GRP_OR1);
275-
expected.put(1, IStereoElement.GRP_OR1);
276-
expected.put(6, IStereoElement.GRP_AND5);
274+
expected.put(0, IStereoElement.GRP_REL1);
275+
expected.put(1, IStereoElement.GRP_REL1);
276+
expected.put(6, IStereoElement.GRP_RAC5);
277277
assertThat(state.stereoGrps, is(expected));
278278
}
279279

@@ -299,7 +299,7 @@ public void hydrogenAndCoordinationBondingSkipped() {
299299
for (IStereoElement<?,?> se : iter) {
300300
IAtom focus = (IAtom)se.getFocus();
301301
if (focus.getIndex() == 2) {
302-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
302+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
303303
} else {
304304
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_ABS));
305305
}
@@ -312,7 +312,7 @@ public void hydrogenAndCoordinationBondingSkipped() {
312312
Iterable<IStereoElement> iter = mol.stereoElements();
313313
assertTrue(iter.iterator().hasNext());
314314
for (IStereoElement<?,?> se : iter) {
315-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
315+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
316316
}
317317
}
318318

@@ -330,7 +330,7 @@ public void hydrogenAndCoordinationBondingSkipped() {
330330
Iterable<IStereoElement> iter = mol.stereoElements();
331331
assertTrue(iter.iterator().hasNext());
332332
for (IStereoElement<?, ?> se : iter) {
333-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
333+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
334334
}
335335
}
336336
}
@@ -349,7 +349,7 @@ public void hydrogenAndCoordinationBondingSkipped() {
349349
Iterable<IStereoElement> iter = mol.stereoElements();
350350
assertTrue(iter.iterator().hasNext());
351351
for (IStereoElement<?, ?> se : iter) {
352-
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_AND1));
352+
assertThat(se.getGroupInfo(), is(IStereoElement.GRP_RAC1));
353353
}
354354
}
355355
}

0 commit comments

Comments
 (0)