From cae0258d3962d258cd4d83eb5b3ac25aade4d109 Mon Sep 17 00:00:00 2001 From: John May Date: Wed, 24 Aug 2016 08:12:17 +0100 Subject: [PATCH] Use american spelling of flavour. --- .../org/openscience/cdk/smiles/CDKToBeam.java | 22 ++--- .../cdk/smiles/CxSmilesGenerator.java | 16 ++-- .../{SmiFlavour.java => SmiFlavor.java} | 4 +- .../cdk/smiles/SmilesGenerator.java | 90 +++++++++---------- .../openscience/cdk/smiles/CDKToBeamTest.java | 26 +++--- .../cdk/smiles/CxSmilesGeneratorTest.java | 10 +-- .../openscience/cdk/smiles/CxSmilesTest.java | 48 +++++----- .../cdk/smiles/SmilesGeneratorTest.java | 2 +- 8 files changed, 109 insertions(+), 109 deletions(-) rename storage/smiles/src/main/java/org/openscience/cdk/smiles/{SmiFlavour.java => SmiFlavor.java} (99%) diff --git a/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java b/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java index 570c011f8e5..0fd8fd7f70a 100644 --- a/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java +++ b/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java @@ -94,7 +94,7 @@ final class CDKToBeam { /** Create a isomeric and aromatic converter. */ CDKToBeam() { - this(SmiFlavour.AtomicMass | SmiFlavour.AtomAtomMap | SmiFlavour.UseAromaticSymbols); + this(SmiFlavor.AtomicMass | SmiFlavor.AtomAtomMap | SmiFlavor.UseAromaticSymbols); } CDKToBeam(int flavour) { @@ -144,15 +144,15 @@ static Graph toBeamGraph(IAtomContainer ac, int flavour) throws CDKException { } // configure stereo-chemistry by encoding the stereo-elements - if (SmiFlavour.isSet(flavour, SmiFlavour.Stereo)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.Stereo)) { for (IStereoElement se : ac.stereoElements()) { - if (SmiFlavour.isSet(flavour, SmiFlavour.StereoTetrahedral) && + if (SmiFlavor.isSet(flavour, SmiFlavor.StereoTetrahedral) && se instanceof ITetrahedralChirality) { addTetrahedralConfiguration((ITetrahedralChirality) se, gb, indices); - } else if (SmiFlavour.isSet(flavour, SmiFlavour.StereoCisTrans) && + } else if (SmiFlavor.isSet(flavour, SmiFlavor.StereoCisTrans) && se instanceof IDoubleBondStereochemistry) { addGeometricConfiguration((IDoubleBondStereochemistry) se, flavour, gb, indices); - } else if (SmiFlavour.isSet(flavour, SmiFlavour.StereoExTetrahedral) && + } else if (SmiFlavor.isSet(flavour, SmiFlavor.StereoExTetrahedral) && se instanceof ExtendedTetrahedral) { addExtendedTetrahedralConfiguration((ExtendedTetrahedral) se, gb, indices); } @@ -175,7 +175,7 @@ static Graph toBeamGraph(IAtomContainer ac, int flavour) throws CDKException { */ static Atom toBeamAtom(final IAtom a, final int flavour) { - final boolean aromatic = SmiFlavour.isSet(flavour, SmiFlavour.UseAromaticSymbols) && a.getFlag(CDKConstants.ISAROMATIC); + final boolean aromatic = SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && a.getFlag(CDKConstants.ISAROMATIC); final Integer charge = a.getFormalCharge(); final String symbol = checkNotNull(a.getSymbol(), "An atom had an undefined symbol"); @@ -195,7 +195,7 @@ static Atom toBeamAtom(final IAtom a, final int flavour) { if (charge != null) ab.charge(charge); // use the mass number to specify isotope? - if (SmiFlavour.isSet(flavour, SmiFlavour.AtomicMass)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.AtomicMass)) { Integer massNumber = a.getMassNumber(); if (massNumber != null) { // XXX: likely causing some overhead but okay for now @@ -210,7 +210,7 @@ static Atom toBeamAtom(final IAtom a, final int flavour) { } Integer atomClass = a.getProperty(ATOM_ATOM_MAPPING); - if (SmiFlavour.isSet(flavour, SmiFlavour.AtomAtomMap) && atomClass != null) { + if (SmiFlavor.isSet(flavour, SmiFlavor.AtomAtomMap) && atomClass != null) { ab.atomClass(atomClass); } @@ -248,7 +248,7 @@ static Edge toBeamEdge(IBond b, int flavour, Map indices) throws */ private static Bond toBeamEdgeLabel(IBond b, int flavour) throws CDKException { - if (SmiFlavour.isSet(flavour, SmiFlavour.UseAromaticSymbols) && b.getFlag(CDKConstants.ISAROMATIC)) return Bond.AROMATIC; + if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && b.getFlag(CDKConstants.ISAROMATIC)) return Bond.AROMATIC; if (b.getOrder() == null) throw new CDKException("A bond had undefined order, possible query bond?"); @@ -264,7 +264,7 @@ private static Bond toBeamEdgeLabel(IBond b, int flavour) throws CDKException { case QUADRUPLE: return Bond.QUADRUPLE; default: - if (!SmiFlavour.isSet(flavour, SmiFlavour.UseAromaticSymbols) && b.getFlag(CDKConstants.ISAROMATIC)) + if (!SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && b.getFlag(CDKConstants.ISAROMATIC)) throw new CDKException("Cannot write Kekulé SMILES output due to aromatic bond with unset bond order - molecule should be Kekulized"); throw new CDKException("Unsupported bond order: " + order); } @@ -283,7 +283,7 @@ private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, in IBond[] bs = dbs.getBonds(); // don't try to set a configuration on aromatic bonds - if (SmiFlavour.isSet(flavour, SmiFlavour.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return; + if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return; int u = indices.get(db.getAtom(0)); int v = indices.get(db.getAtom(1)); diff --git a/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesGenerator.java b/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesGenerator.java index 8b50e26b3f6..fb0b6e50973 100644 --- a/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesGenerator.java +++ b/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesGenerator.java @@ -70,7 +70,7 @@ private static int compare(Comparator comp, List a, List a, List b) { } // Atom Labels - if (SmiFlavour.isSet(opts, SmiFlavour.CxAtomLabel) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxAtomLabel) && state.atomLabels != null && !state.atomLabels.isEmpty()) { if (sb.length() > 2) @@ -162,7 +162,7 @@ public int compare(List a, List b) { } // Atom Values - if (SmiFlavour.isSet(opts, SmiFlavour.CxAtomValue) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxAtomValue) && state.atomValues != null && !state.atomValues.isEmpty()) { if (sb.length() > 2) @@ -183,7 +183,7 @@ public int compare(List a, List b) { } // 2D/3D Coordinates - if (SmiFlavour.isSet(opts, SmiFlavour.CxCoordinates) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxCoordinates) && state.atomCoords != null && !state.atomCoords.isEmpty()) { DecimalFormat fmt = new DecimalFormat("#.##"); if (sb.length() > 2) sb.append(','); @@ -204,7 +204,7 @@ public int compare(List a, List b) { } // Multicenter/Positional variation bonds - if (SmiFlavour.isSet(opts, SmiFlavour.CxMulticenter) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxMulticenter) && state.positionVar != null && !state.positionVar.isEmpty()) { if (sb.length() > 2) sb.append(','); @@ -237,7 +237,7 @@ public int compare(Map.Entry> a, // *CCO* |$_AP1;;;;_AP2$,Sg:n:1,2,3::ht| - if (SmiFlavour.isSet(opts, SmiFlavour.CxPolymer) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxPolymer) && state.sgroups != null && !state.sgroups.isEmpty()) { List sgroups = new ArrayList<>(state.sgroups); @@ -270,7 +270,7 @@ public int compare(PolymerSgroup a, PolymerSgroup b) { } // [C]1[CH][CH]CCC1 |^1:1,2,^3:0| - if (SmiFlavour.isSet(opts, SmiFlavour.CxRadical) && + if (SmiFlavor.isSet(opts, SmiFlavor.CxRadical) && state.atomRads != null && !state.atomRads.isEmpty()) { Map> radinv = new TreeMap<>(); for (Map.Entry e : state.atomRads.entrySet()) { diff --git a/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavour.java b/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavor.java similarity index 99% rename from storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavour.java rename to storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavor.java index 5541493be07..2f599ffa6aa 100644 --- a/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavour.java +++ b/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmiFlavor.java @@ -30,9 +30,9 @@ /** * Flags for customising SMILES generation. */ -public final class SmiFlavour { +public final class SmiFlavor { - private SmiFlavour() { + private SmiFlavor() { } /** diff --git a/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesGenerator.java b/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesGenerator.java index c5e4f8d0f03..a9f5fcd7257 100644 --- a/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesGenerator.java +++ b/storage/smiles/src/main/java/org/openscience/cdk/smiles/SmilesGenerator.java @@ -74,19 +74,19 @@ * produces the same SMILES. Isotope and stereochemistry is encoded. * * - * To output a given flavour the flags in {@link SmiFlavour} are used: + * To output a given flavour the flags in {@link SmiFlavor} are used: * *
- * SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Isomeric);
+ * SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Isomeric);
  * 
- * {@link SmiFlavour} provides more fine grained control, for example, - * for the following is equivalent to {@link SmiFlavour#Isomeric}: + * {@link SmiFlavor} provides more fine grained control, for example, + * for the following is equivalent to {@link SmiFlavor#Isomeric}: *
- * SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Stereo |
- *                                              SmiFlavour.AtomicMass);
+ * SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Stereo |
+ *                                              SmiFlavor.AtomicMass);
  * 
* Bitwise logic can be used such that we can remove options: - * {@link SmiFlavour#Isomeric} ^ {@link SmiFlavour#AtomicMass} + * {@link SmiFlavor#Isomeric} ^ {@link SmiFlavor#AtomicMass} * will generate isomeric SMILES without atomic mass. * * @@ -95,10 +95,10 @@ * are then created by invoking {@link #create(IAtomContainer)}. *
  * IAtomContainer  ethanol = ...;
- * SmilesGenerator sg      = new SmilesGenerator(SmiFlavour.Generic);
+ * SmilesGenerator sg      = new SmilesGenerator(SmiFlavor.Generic);
  * String          smi     = sg.create(ethanol); // CCO, C(C)O, C(O)C, or OCC
  *
- * SmilesGenerator sg      = new SmilesGenerator(SmiFlavour.Unique);
+ * SmilesGenerator sg      = new SmilesGenerator(SmiFlavor.Unique);
  * String          smi     = sg.create(ethanol); // only CCO
  * 
* @@ -121,11 +121,11 @@ * IAtomContainer benzene = ...; * * // 'benzene' molecule has no arom flags, we always get Kekulé output - * SmilesGenerator sg = new SmilesGenerator(SmiFlavour.Generic); + * SmilesGenerator sg = new SmilesGenerator(SmiFlavor.Generic); * String smi = sg.create(benzene); // C1=CC=CC=C1 * - * SmilesGenerator sg = new SmilesGenerator(SmiFlavour.Generic | - * SmiFlavour.UseAromaticSymbols); + * SmilesGenerator sg = new SmilesGenerator(SmiFlavor.Generic | + * SmiFlavor.UseAromaticSymbols); * String smi = sg.create(benzene); // C1=CC=CC=C1 flags not set! * * // Note, in practice we'd use an aromaticity algorithm @@ -135,11 +135,11 @@ * a.setIsAromatic(true); * * // 'benzene' molecule now has arom flags, we always get aromatic SMILES if we request it - * SmilesGenerator sg = new SmilesGenerator(SmiFlavour.Generic); + * SmilesGenerator sg = new SmilesGenerator(SmiFlavor.Generic); * String smi = sg.create(benzene); // C1=CC=CC=C1 * - * SmilesGenerator sg = new SmilesGenerator(SmiFlavour.Generic | - * SmiFlavour.UseAromaticSymbols); + * SmilesGenerator sg = new SmilesGenerator(SmiFlavor.Generic | + * SmiFlavor.UseAromaticSymbols); * String smi = sg.create(benzene); // c1ccccc1 * *

@@ -179,8 +179,8 @@ * The CXSMILES layer is appended after the SMILES so that parser which don't interpret it * can ignore it. *

- * The two aggregate flavours are {@link SmiFlavour#CxSmiles} and {@link SmiFlavour#CxSmilesWithCoords}. - * As with other flavours, fine grain control is possible {@see SmiFlavour}. + * The two aggregate flavours are {@link SmiFlavor#CxSmiles} and {@link SmiFlavor#CxSmilesWithCoords}. + * As with other flavours, fine grain control is possible {@see SmiFlavor}. *

* * the unique SMILES generation uses a fast equitable labelling procedure * and as such there are some structures which may not be unique. The number @@ -208,7 +208,7 @@ public final class SmilesGenerator { /** * Create the generic SMILES generator. * @see #generic() - * @deprecated use {@link #SmilesGenerator(int)} configuring with {@link SmiFlavour}. + * @deprecated use {@link #SmilesGenerator(int)} configuring with {@link SmiFlavor}. */ @Deprecated public SmilesGenerator() { @@ -216,14 +216,14 @@ public SmilesGenerator() { } /** - * Create a SMILES generator with the specified {@link SmiFlavour}. + * Create a SMILES generator with the specified {@link SmiFlavor}. * *

-     * SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Stereo |
-     *                                              SmiFlavour.Canonical);
+     * SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Stereo |
+     *                                              SmiFlavor.Canonical);
      * 
* - * @param flavour SMILES flavour flags {@see SmiFlavour} + * @param flavour SMILES flavour flags {@see SmiFlavor} */ public SmilesGenerator(int flavour) { this.flavour = flavour; @@ -234,14 +234,14 @@ public SmilesGenerator(int flavour) { * The preferred way of doing this is now to use the {@link #SmilesGenerator(int)} constructor: * *
-     * SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.UseAromaticSymbols);
+     * SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.UseAromaticSymbols);
      * 
* * @return a generator for aromatic SMILES - * @deprecated configure with {@link SmiFlavour} + * @deprecated configure with {@link SmiFlavor} */ public SmilesGenerator aromatic() { - return new SmilesGenerator(this.flavour | SmiFlavour.UseAromaticSymbols); + return new SmilesGenerator(this.flavour | SmiFlavor.UseAromaticSymbols); } /** @@ -257,11 +257,11 @@ public SmilesGenerator aromatic() { * * * @return a generator for SMILES with atom classes - * @deprecated configure with {@link SmiFlavour} + * @deprecated configure with {@link SmiFlavor} */ @Deprecated public SmilesGenerator withAtomClasses() { - return new SmilesGenerator(this.flavour | SmiFlavour.AtomAtomMap); + return new SmilesGenerator(this.flavour | SmiFlavor.AtomAtomMap); } /** @@ -273,7 +273,7 @@ public SmilesGenerator withAtomClasses() { * @return a new arbitrary SMILES generator */ public static SmilesGenerator generic() { - return new SmilesGenerator(SmiFlavour.Generic); + return new SmilesGenerator(SmiFlavor.Generic); } /** @@ -284,7 +284,7 @@ public static SmilesGenerator generic() { * @return a new isomeric SMILES generator */ public static SmilesGenerator isomeric() { - return new SmilesGenerator(SmiFlavour.Isomeric); + return new SmilesGenerator(SmiFlavor.Isomeric); } /** @@ -294,7 +294,7 @@ public static SmilesGenerator isomeric() { * @return a new unique SMILES generator */ public static SmilesGenerator unique() { - return new SmilesGenerator(SmiFlavour.Unique); + return new SmilesGenerator(SmiFlavor.Unique); } /** @@ -306,7 +306,7 @@ public static SmilesGenerator unique() { * @return a new absolute SMILES generator */ public static SmilesGenerator absolute() { - return new SmilesGenerator(SmiFlavour.Absolute); + return new SmilesGenerator(SmiFlavor.Absolute); } /** @@ -441,14 +441,14 @@ public static String create(IAtomContainer molecule, int flavour, int[] order) t Graph g = CDKToBeam.toBeamGraph(molecule, flavour); // apply the canonical labelling - if (SmiFlavour.isSet(flavour, SmiFlavour.Canonical)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.Canonical)) { // determine the output order int[] labels = labels(flavour, molecule); g = g.permute(labels).resonate(); - if (SmiFlavour.isSet(flavour, SmiFlavour.StereoCisTrans)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.StereoCisTrans)) { // FIXME: required to ensure canonical double bond labelling g.sort(new Graph.VisitHighOrderFirst()); @@ -471,7 +471,7 @@ public static String create(IAtomContainer molecule, int flavour, int[] order) t canorder[i] = order[labels[i]]; System.arraycopy(canorder, 0, order, 0, order.length); - if (SmiFlavour.isSet(flavour, SmiFlavour.CxSmilesWithCoords)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.CxSmilesWithCoords)) { smiles += CxSmilesGenerator.generate(getCxSmilesState(flavour, molecule), flavour, null, order); } @@ -480,7 +480,7 @@ public static String create(IAtomContainer molecule, int flavour, int[] order) t } else { String smiles = g.toSmiles(order); - if (SmiFlavour.isSet(flavour, SmiFlavour.CxSmilesWithCoords)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.CxSmilesWithCoords)) { smiles += CxSmilesGenerator.generate(getCxSmilesState(flavour, molecule), flavour, null, order); } @@ -564,9 +564,9 @@ public String create(IReaction reaction, int[] ordering) throws CDKException { } // we need to make sure we generate without the CXSMILES layers - String smi = create(reactantPart, flavour &~ SmiFlavour.CxSmilesWithCoords, reactantOrder) + ">" + - create(agentPart, flavour &~ SmiFlavour.CxSmilesWithCoords, agentOrder) + ">" + - create(productPart, flavour &~ SmiFlavour.CxSmilesWithCoords, productOrder); + String smi = create(reactantPart, flavour &~ SmiFlavor.CxSmilesWithCoords, reactantOrder) + ">" + + create(agentPart, flavour &~ SmiFlavor.CxSmilesWithCoords, agentOrder) + ">" + + create(productPart, flavour &~ SmiFlavor.CxSmilesWithCoords, productOrder); // copy ordering back to unified array and adjust values int agentBeg = reactantOrder.length; @@ -580,7 +580,7 @@ public String create(IReaction reaction, int[] ordering) throws CDKException { for (int i = agentEnd; i < prodEnd; i++) ordering[i] += agentEnd; - if (SmiFlavour.isSet(flavour, SmiFlavour.CxSmilesWithCoords)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.CxSmilesWithCoords)) { IAtomContainer unified = reaction.getBuilder().newInstance(IAtomContainer.class); unified.add(reactantPart); unified.add(agentPart); @@ -593,7 +593,7 @@ public String create(IReaction reaction, int[] ordering) throws CDKException { int[] components = null; // extra state info on fragment grouping, specific to reactions - if (SmiFlavour.isSet(flavour, SmiFlavour.CxFragmentGroup)) { + if (SmiFlavor.isSet(flavour, SmiFlavor.CxFragmentGroup)) { cxstate.fragGroups = new ArrayList<>(); @@ -667,8 +667,8 @@ public void setUseAromaticityFlag(boolean useAromaticityFlag) { */ private static int[] labels(int flavour, final IAtomContainer molecule) throws CDKException { // FIXME: use SmiOpt.InChiLabelling - long[] labels = SmiFlavour.isSet(flavour, SmiFlavour.Isomeric) ? inchiNumbers(molecule) - : Canon.label(molecule, GraphUtil.toAdjList(molecule)); + long[] labels = SmiFlavor.isSet(flavour, SmiFlavor.Isomeric) ? inchiNumbers(molecule) + : Canon.label(molecule, GraphUtil.toAdjList(molecule)); int[] cpy = new int[labels.length]; for (int i = 0; i < labels.length; i++) cpy[i] = (int) labels[i] - 1; @@ -756,13 +756,13 @@ private static CxSmilesState getCxSmilesState(int flavour, IAtomContainer mol) { Point2d p2 = atom.getPoint2d(); Point3d p3 = atom.getPoint3d(); - if (SmiFlavour.isSet(flavour, SmiFlavour.Cx2dCoordinates) && p2 != null) { + if (SmiFlavor.isSet(flavour, SmiFlavor.Cx2dCoordinates) && p2 != null) { state.atomCoords.add(new double[]{p2.x, p2.y, 0}); state.coordFlag = true; - } else if (SmiFlavour.isSet(flavour, SmiFlavour.Cx3dCoordinates) && p3 != null) { + } else if (SmiFlavor.isSet(flavour, SmiFlavor.Cx3dCoordinates) && p3 != null) { state.atomCoords.add(new double[]{p3.x, p3.y, p3.z}); state.coordFlag = true; - } else if (SmiFlavour.isSet(flavour, SmiFlavour.CxCoordinates)) { + } else if (SmiFlavor.isSet(flavour, SmiFlavor.CxCoordinates)) { state.atomCoords.add(new double[3]); } } diff --git a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CDKToBeamTest.java b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CDKToBeamTest.java index d6b8c96fcf8..725f1fbd2cb 100644 --- a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CDKToBeamTest.java +++ b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CDKToBeamTest.java @@ -289,7 +289,7 @@ public void benzene_kekule() throws Exception { @Test public void benzene() throws Exception { IAtomContainer ac = TestMoleculeFactory.makeBenzene(); - Graph g = convert(ac, true, SmiFlavour.UseAromaticSymbols); + Graph g = convert(ac, true, SmiFlavor.UseAromaticSymbols); assertThat(g.toSmiles(), is("c1ccccc1")); } @@ -301,7 +301,7 @@ public void imidazole_kekule() throws Exception { @Test public void imidazole() throws Exception { - Graph g = convert(TestMoleculeFactory.makeImidazole(), true, SmiFlavour.UseAromaticSymbols); + Graph g = convert(TestMoleculeFactory.makeImidazole(), true, SmiFlavor.UseAromaticSymbols); assertThat(g.toSmiles(), is("c1[nH]cnc1")); } @@ -317,7 +317,7 @@ public void C13_isomeric() throws Exception { IAtom a = new Atom("C"); a.setMassNumber(13); ac.addAtom(a); - Graph g = convert(ac, SmiFlavour.AtomicMass); + Graph g = convert(ac, SmiFlavor.AtomicMass); assertThat(g.atom(0).isotope(), is(13)); assertThat(g.toSmiles(), is("[13CH4]")); } @@ -385,7 +385,7 @@ public void e_1_2_difluoroethene() throws Exception { ac.addStereoElement(new DoubleBondStereochemistry(ac.getBond(1), new IBond[]{ac.getBond(0), ac.getBond(2)}, OPPOSITE)); - Graph g = convert(ac, SmiFlavour.StereoCisTrans); + Graph g = convert(ac, SmiFlavor.StereoCisTrans); assertThat(g.toSmiles(), is("F/C=C/F")); } @@ -408,7 +408,7 @@ public void z_1_2_difluoroethene() throws Exception { ac.addStereoElement(new DoubleBondStereochemistry(ac.getBond(1), new IBond[]{ac.getBond(0), ac.getBond(2)}, TOGETHER)); - Graph g = convert(ac, SmiFlavour.StereoCisTrans); + Graph g = convert(ac, SmiFlavor.StereoCisTrans); assertThat(g.toSmiles(), is("F/C=C\\F")); } @@ -439,7 +439,7 @@ public void _2R_butan_2_ol() throws Exception { ac.getAtom(5), // H }, CLOCKWISE)); - Graph g = convert(ac, SmiFlavour.StereoTetrahedral); + Graph g = convert(ac, SmiFlavor.StereoTetrahedral); assertThat(g.toSmiles(), is("CC[C@@](C)(O)[H]")); } @@ -470,7 +470,7 @@ public void _2S_butan_2_ol() throws Exception { ac.getAtom(5), // H }, ANTI_CLOCKWISE)); - Graph g = convert(ac, SmiFlavour.StereoTetrahedral); + Graph g = convert(ac, SmiFlavor.StereoTetrahedral); assertThat(g.toSmiles(), is("CC[C@](C)(O)[H]")); } @@ -497,7 +497,7 @@ public void z_1_2_difluoroethene_aromatic() throws Exception { ac.addStereoElement(new DoubleBondStereochemistry(ac.getBond(1), new IBond[]{ac.getBond(0), ac.getBond(2)}, TOGETHER)); - Graph g = convert(ac, SmiFlavour.UseAromaticSymbols); + Graph g = convert(ac, SmiFlavor.UseAromaticSymbols); assertThat(g.toSmiles(), is("F[CH]:[CH]F")); } @@ -517,7 +517,7 @@ public void writeAtomClass() throws Exception { ac.getAtom(0).setProperty(CDKConstants.ATOM_ATOM_MAPPING, 3); ac.getAtom(1).setProperty(CDKConstants.ATOM_ATOM_MAPPING, 1); ac.getAtom(2).setProperty(CDKConstants.ATOM_ATOM_MAPPING, 2); - assertThat(convert(ac, SmiFlavour.AtomAtomMap).toSmiles(), is("[CH3:3][CH2:1][OH:2]")); + assertThat(convert(ac, SmiFlavor.AtomAtomMap).toSmiles(), is("[CH3:3][CH2:1][OH:2]")); } @Test @@ -537,7 +537,7 @@ public void r_penta_2_3_diene_impl_h() throws Exception { m.getAtom(3), m.getAtom(4)}, ANTI_CLOCKWISE); m.setStereoElements(Collections.singletonList(element)); - assertThat(convert(m, SmiFlavour.Stereo).toSmiles(), is("CC=[C@]=CC")); + assertThat(convert(m, SmiFlavor.Stereo).toSmiles(), is("CC=[C@]=CC")); } @Test @@ -557,7 +557,7 @@ public void s_penta_2_3_diene_impl_h() throws Exception { m.getAtom(3), m.getAtom(4)}, CLOCKWISE); m.setStereoElements(Collections.singletonList(element)); - assertThat(convert(m, SmiFlavour.Stereo).toSmiles(), is("CC=[C@@]=CC")); + assertThat(convert(m, SmiFlavor.Stereo).toSmiles(), is("CC=[C@@]=CC")); } @Test @@ -588,7 +588,7 @@ public void r_penta_2_3_diene_expl_h() throws Exception { m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); - assertThat(convert(m, SmiFlavour.Stereo).toSmiles(), is("CC(=[C@@]=C(C)[H])[H]")); + assertThat(convert(m, SmiFlavor.Stereo).toSmiles(), is("CC(=[C@@]=C(C)[H])[H]")); } } @@ -621,7 +621,7 @@ public void s_penta_2_3_diene_expl_h() throws Exception { m.getAtom(atoms[i][1]), m.getAtom(atoms[i][2]), m.getAtom(atoms[i][3])}, stereos[i]); m.setStereoElements(Collections.singletonList(element)); - assertThat(convert(m, SmiFlavour.Stereo).toSmiles(), is("CC(=[C@]=C(C)[H])[H]")); + assertThat(convert(m, SmiFlavor.Stereo).toSmiles(), is("CC(=[C@]=C(C)[H])[H]")); } } diff --git a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesGeneratorTest.java b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesGeneratorTest.java index d98073662fa..6da0f8cbe56 100644 --- a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesGeneratorTest.java +++ b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesGeneratorTest.java @@ -37,7 +37,7 @@ public class CxSmilesGeneratorTest { @Test public void emptyCXSMILES() { CxSmilesState state = new CxSmilesState(); - assertThat(CxSmilesGenerator.generate(state, SmiFlavour.CxSmiles, new int[0], new int[0]), + assertThat(CxSmilesGenerator.generate(state, SmiFlavor.CxSmiles, new int[0], new int[0]), is("")); } @@ -47,7 +47,7 @@ public void multicenter() { state.positionVar = new HashMap<>(); state.positionVar.put(0, Arrays.asList(4, 5, 6, 7)); state.positionVar.put(2, Arrays.asList(4, 6, 5, 7)); - assertThat(CxSmilesGenerator.generate(state, SmiFlavour.CxMulticenter, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), + assertThat(CxSmilesGenerator.generate(state, SmiFlavor.CxMulticenter, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), is(" |m:5:0.1.2.3,7:0.1.2.3|")); } @@ -57,7 +57,7 @@ public void coords2d() { state.atomCoords = Arrays.asList(new double[]{0, 1.5, 0}, new double[]{0, 3, 0}, new double[]{1.5, 1.5, 0}); - assertThat(CxSmilesGenerator.generate(state, SmiFlavour.CxCoordinates, new int[0], new int[]{1, 2, 0}), + assertThat(CxSmilesGenerator.generate(state, SmiFlavor.CxCoordinates, new int[0], new int[]{1, 2, 0}), is(" |(1.5,1.5,;,1.5,;,3,)|")); } @@ -67,7 +67,7 @@ public void sgroups() { state.sgroups = new ArrayList<>(1); state.sgroups.add(new CxSmilesState.PolymerSgroup("n", Arrays.asList(2,3), "n", "ht")); state.sgroups.add(new CxSmilesState.PolymerSgroup("n", Arrays.asList(5), "m", "ht")); - assertThat(CxSmilesGenerator.generate(state, SmiFlavour.CxPolymer, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), + assertThat(CxSmilesGenerator.generate(state, SmiFlavor.CxPolymer, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), is(" |Sg:n:2:m:ht,Sg:n:4,5:n:ht|")); } @@ -78,7 +78,7 @@ public void radicals() { state.atomRads.put(2, CxSmilesState.Radical.Monovalent); state.atomRads.put(6, CxSmilesState.Radical.Monovalent); state.atomRads.put(4, CxSmilesState.Radical.Divalent); - assertThat(CxSmilesGenerator.generate(state, SmiFlavour.CxSmiles, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), + assertThat(CxSmilesGenerator.generate(state, SmiFlavor.CxSmiles, new int[0], new int[]{7, 6, 5, 4, 3, 2, 1, 0}), is(" |^1:1,5,^2:3|")); } diff --git a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesTest.java b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesTest.java index fe04ecdd9de..49ad6e5a833 100644 --- a/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesTest.java +++ b/storage/smiles/src/test/java/org/openscience/cdk/smiles/CxSmilesTest.java @@ -230,7 +230,7 @@ public void atomValues() throws InvalidSmilesException { mol.getAtom(2).setImplicitHydrogenCount(0); mol.addBond(0, 1, IBond.Order.SINGLE); mol.addBond(1, 2, IBond.Order.SINGLE); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxAtomLabel); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxAtomLabel); String smi = smigen.create(mol); assertThat(smi, is("CC* |$;;R1$|")); } @@ -245,8 +245,8 @@ public void atomValues() throws InvalidSmilesException { mol.getAtom(2).setImplicitHydrogenCount(0); mol.addBond(0, 1, IBond.Order.SINGLE); mol.addBond(1, 2, IBond.Order.SINGLE); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Canonical | - SmiFlavour.CxAtomLabel); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Canonical | + SmiFlavor.CxAtomLabel); String smi = smigen.create(mol); assertThat(smi, is("*CC |$R1$|")); } @@ -255,8 +255,8 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("c1ccccc1.*Cl |m:6:0.1.2.3.4.5|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.UseAromaticSymbols | - SmiFlavour.CxMulticenter); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.UseAromaticSymbols | + SmiFlavor.CxMulticenter); String smi = smigen.create(mol); assertThat(smi, is("c1ccccc1.*Cl |m:6:0.1.2.3.4.5|")); } @@ -265,9 +265,9 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("c1ccccc1.*Cl |m:6:0.1.2.3.4.5|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.UseAromaticSymbols | - SmiFlavour.CxMulticenter | - SmiFlavour.Canonical); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.UseAromaticSymbols | + SmiFlavor.CxMulticenter | + SmiFlavor.Canonical); String smi = smigen.create(mol); assertThat(smi, is("*Cl.c1ccccc1 |m:0:2.3.4.5.6.7|")); } @@ -277,7 +277,7 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("CCCOCCO |Sg:n:1,2,3::ht|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxPolymer); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxPolymer); String smi = smigen.create(mol); assertThat(smi, is("CCCOCCO |Sg:n:1,2,3:n:ht|")); } @@ -286,8 +286,8 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("CCCOCCO |Sg:n:1,2,3::ht|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Canonical | - SmiFlavour.CxPolymer); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Canonical | + SmiFlavor.CxPolymer); String smi = smigen.create(mol); assertThat(smi, is("OCCOCCC |Sg:n:3,4,5:n:ht|")); } @@ -296,7 +296,7 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("CCO |(,,;1,1,;2,2,)|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxCoordinates); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxCoordinates); String smi = smigen.create(mol); assertThat(smi, is("CCO |(,,;1,1,;2,2,)|")); } @@ -305,8 +305,8 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("CCO |(,,;1,1,;2,2,)|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Canonical | - SmiFlavour.CxCoordinates); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Canonical | + SmiFlavor.CxCoordinates); String smi = smigen.create(mol); assertThat(smi, is("OCC |(2,2,;1,1,;,,)|")); } @@ -324,7 +324,7 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("CCO"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxCoordinates); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxCoordinates); String smi = smigen.create(mol); assertThat(smi, is("CCO")); } @@ -333,7 +333,7 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("[C]1C[CH][CH]OC1 |^1:2,3,^2:0|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxRadical); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxRadical); String smi = smigen.create(mol); assertThat(smi, is("[C]1C[CH][CH]OC1 |^1:2,3,^2:0|")); } @@ -342,8 +342,8 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("[C]1C[CH][CH]OC1 |^1:2,3,^2:0|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxRadical | - SmiFlavour.Canonical); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxRadical | + SmiFlavor.Canonical); String smi = smigen.create(mol); assertThat(smi, is("[C]1CO[CH][CH]C1 |^1:3,4,^2:0|")); } @@ -352,8 +352,8 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IReaction rxn = smipar.parseReactionSmiles("CC(C)c1ccccc1.ClC([*])=O>ClCCl.[Al+3].[Cl-].[Cl-].[Cl-]>CC(C)c1ccc(cc1)C([*])=O |$;;;;;;;;;;;R1;;;;;;;;;;;;;;;;;;;R1;$,f:3.4.5.6|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxAtomLabel | - SmiFlavour.CxFragmentGroup); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxAtomLabel | + SmiFlavor.CxFragmentGroup); assertThat(smigen.create(rxn), is("CC(C)C1=CC=CC=C1.ClC(*)=O>ClCCl.[Al+3].[Cl-].[Cl-].[Cl-]>CC(C)C1=CC=C(C=C1)C(*)=O |f:3.4.5.6,$;;;;;;;;;;;R1;;;;;;;;;;;;;;;;;;;R1$|")); } @@ -363,9 +363,9 @@ public void atomValues() throws InvalidSmilesException { SmilesParser smipar = new SmilesParser(bldr); IReaction rxn1 = smipar.parseReactionSmiles("CC(C)c1ccccc1.ClC([*])=O>[Al+3].[Cl-].[Cl-].[Cl-].ClCCl>CC(C)c1ccc(cc1)C([*])=O |$;;;;;;;;;;;R1;;;;;;;;;;;;;;;;;;;R1;$,f:2.3.4.5|"); IReaction rxn2 = smipar.parseReactionSmiles("ClC([*])=O.CC(C)c1ccccc1>[Al+3].[Cl-].[Cl-].[Cl-].ClCCl>CC(C)c1ccc(cc1)C([*])=O |$;;R1;;;;;;;;;;;;;;;;;;;;;;;;;;;;R1;$,f:2.3.5.4|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.CxAtomLabel | - SmiFlavour.CxFragmentGroup | - SmiFlavour.Canonical); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxAtomLabel | + SmiFlavor.CxFragmentGroup | + SmiFlavor.Canonical); assertThat(smigen.create(rxn1), is(smigen.create(rxn2))); } @@ -374,7 +374,7 @@ public void atomValues() throws InvalidSmilesException { IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance(); SmilesParser smipar = new SmilesParser(bldr); IAtomContainer mol = smipar.parseSmiles("c1ccccc1O |$_AV:0;1;2;3;4;5;6$|"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Canonical | SmiFlavour.CxAtomValue); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Canonical | SmiFlavor.CxAtomValue); assertThat(smigen.create(mol), is("OC=1C=CC=CC1 |$_AV:6;5;0;1;2;3;4$|")); } diff --git a/storage/smiles/src/test/java/org/openscience/cdk/smiles/SmilesGeneratorTest.java b/storage/smiles/src/test/java/org/openscience/cdk/smiles/SmilesGeneratorTest.java index 340686d8ec1..d81950e0e40 100644 --- a/storage/smiles/src/test/java/org/openscience/cdk/smiles/SmilesGeneratorTest.java +++ b/storage/smiles/src/test/java/org/openscience/cdk/smiles/SmilesGeneratorTest.java @@ -1223,7 +1223,7 @@ public void assignDbStereo() throws Exception { IReaction r1 = smipar.parseReactionSmiles("CC(C)C1=CC=CC=C1.C(CC(=O)Cl)CCl>[Al+3].[Cl-].[Cl-].[Cl-].C(Cl)Cl>CC(C)C1=CC=C(C=C1)C(=O)CCCCl"); IReaction r2 = smipar.parseReactionSmiles("C(CC(=O)Cl)CCl.CC(C)C1=CC=CC=C1>[Al+3].[Cl-].[Cl-].[Cl-].C(Cl)Cl>CC(C)C1=CC=C(C=C1)C(=O)CCCCl"); IReaction r3 = smipar.parseReactionSmiles("CC(C)C1=CC=CC=C1.C(CC(=O)Cl)CCl>C(Cl)Cl.[Al+3].[Cl-].[Cl-].[Cl-]>CC(C)C1=CC=C(C=C1)C(=O)CCCCl"); - SmilesGenerator smigen = new SmilesGenerator(SmiFlavour.Canonical); + SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.Canonical); assertThat(smigen.create(r1), is(smigen.create(r2))); assertThat(smigen.create(r2), is(smigen.create(r3))); }