Package org.jmol.smiles
Class SmilesGenerator
java.lang.Object
org.jmol.smiles.SmilesGenerator
Double bond, allene, square planar and tetrahedral stereochemistry only
not octahedral or trigonal bipyramidal.
No attempt at canonicalization -- unnecessary for model searching.
see SmilesMatcher and package.html for details
Bob Hanson, Jmol 12.0.RC17 2010.06.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private SimpleNode[]
private boolean
private javajs.util.Lst<javajs.util.BS>
private SimpleNode[]
private Node[]
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private javajs.util.BS
private int
private int
0 H all implicit 0x1000 CH2 explicit 0x2000 CH2 and CH3 explicitprivate int
(package private) boolean
private boolean
private int
private boolean
private boolean
private boolean
private boolean
private int
private int
private boolean
javajs.util.P3
private SimpleNode
private SimpleNode[]
private int
private int
private javajs.util.Lst<javajs.util.BS>
private SmilesMatcher
private SmilesStereo
private boolean
private VTemp
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addBracketedBioName
(javajs.util.SB sb, Node atom, String atomName, boolean addComment) private String
addStereoCheck
(int level, int atomIndex, SimpleNode atom, String s, javajs.util.BS bsDone) checks a group and either adds a new group to the growing check string or returns nullprivate Node
checkFirstAtom
(Node atom) Don't start with H or central cumulene (in case there is symmetry)private String
checkStereoPairs
(SimpleNode atom, int atomIndex, SimpleNode[] stereo, int stereoFlag, boolean isFirst) private void
dumpRingKeys
(javajs.util.SB sb, Map<String, Object[]> ht) private void
get aromaticity, ringSets, and aromaticRings fields so that we can assign / and \ and also provide inter-aromatic single bondprivate String
getBioSmiles
(javajs.util.BS bsSelected, String comment, int flags) private String
getBondOrder
(Edge bondPrev, int atomIndex, int prevIndex, boolean isAromatic) private char
getBondStereochemistry
(Edge bond, SimpleNode atomFrom) Retrieves the saved character based on the index of the bond.private String
getRingCache
(int i0, int i1, Map<String, Object[]> ht) protected static String
getRingKey
(int i0, int i1) private String
getRingPointer
(int i) (package private) String
getSmiles
(SmilesMatcher sm, Node[] atoms, int ac, javajs.util.BS bsSelected, String comment, int flags) The main entry point from SmilesMatcherprivate Node
getSmilesAt
(javajs.util.SB sb, SimpleNode atom, boolean allowConnectionsToOutsideWorld, boolean allowBranches, boolean forceBrackets) private String
getSmilesComponent
(Node atom, javajs.util.BS bs, boolean allowBioResidues, boolean allowConnectionsToOutsideWorld, boolean forceBrackets) creates a valid SMILES string from a model.private boolean
isExplicitOnly
(SimpleNode atom) private boolean
isSameAromaticRing
(int a1, int a2) private void
Creates global BitSets bsBondsUp and bsBondsDown.private static SimpleNode
setStereoTemp
(SimpleNode atom, SimpleNode[] stereo, SimpleNode a, float z) Create a dummy atom at the position of an atom at the end of a wedge or hash.private String
sortInorganic
(SimpleNode atom, javajs.util.Lst<Edge> v, VTemp vTemp) We must sort the bond vector such that a diaxial pair is first and last.(package private) void
sortPolyBonds
(SimpleNode atom, SimpleNode refAtom, javajs.util.P3 center) private void
swapArray
(SimpleNode[] a, int i0, int i1, int i2) swap slices of an array [i0 i1) with [i1 i2)
-
Field Details
-
atoms
-
ac
private int ac -
bsSelected
private javajs.util.BS bsSelected -
bsAromatic
private javajs.util.BS bsAromatic -
flags
private int flags -
explicitHydrogen
private int explicitHydrogen0 H all implicit 0x1000 CH2 explicit 0x2000 CH2 and CH3 explicit -
ringSets
private javajs.util.Lst<javajs.util.BS> ringSets -
vTemp
-
nPairs
private int nPairs -
nPairsMax
private int nPairsMax -
bsBondsUp
private javajs.util.BS bsBondsUp -
bsBondsDn
private javajs.util.BS bsBondsDn -
bsToDo
private javajs.util.BS bsToDo -
bsIgnoreHydrogen
private javajs.util.BS bsIgnoreHydrogen -
prevAtom
-
prevSp2Atoms
-
alleneStereo
-
htRingsSequence
-
htRings
-
bsRingKeys
private javajs.util.BS bsRingKeys -
bsIncludingH
private javajs.util.BS bsIncludingH -
topologyOnly
private boolean topologyOnly -
getAromatic
boolean getAromatic -
addAtomComment
private boolean addAtomComment -
noBioComment
private boolean noBioComment -
aromaticDouble
private boolean aromaticDouble -
noStereo
private boolean noStereo -
openSMILES
private boolean openSMILES -
polySmilesCenter
public javajs.util.P3 polySmilesCenter -
smilesStereo
-
isPolyhedral
private boolean isPolyhedral -
aromaticRings
private javajs.util.Lst<javajs.util.BS> aromaticRings -
sm
-
iHypervalent
private int iHypervalent -
is2D
private boolean is2D -
haveSmilesAtoms
private boolean haveSmilesAtoms -
ptAtom
private int ptAtom -
ptSp2Atom0
private int ptSp2Atom0 -
atemp
-
chainCheck
private int chainCheck
-
-
Constructor Details
-
SmilesGenerator
public SmilesGenerator()
-
-
Method Details
-
getSmiles
String getSmiles(SmilesMatcher sm, Node[] atoms, int ac, javajs.util.BS bsSelected, String comment, int flags) throws InvalidSmilesException The main entry point from SmilesMatcher- Parameters:
sm
-atoms
-ac
-bsSelected
-comment
-flags
-- Returns:
- SMILES
- Throws:
InvalidSmilesException
-
getBioSmiles
private String getBioSmiles(javajs.util.BS bsSelected, String comment, int flags) throws InvalidSmilesException - Throws:
InvalidSmilesException
-
addBracketedBioName
-
getSmilesComponent
private String getSmilesComponent(Node atom, javajs.util.BS bs, boolean allowBioResidues, boolean allowConnectionsToOutsideWorld, boolean forceBrackets) throws InvalidSmilesException creates a valid SMILES string from a model. TODO: stereochemistry other than square planar and tetrahedral- Parameters:
atom
-bs
-allowBioResidues
-allowConnectionsToOutsideWorld
-forceBrackets
-- Returns:
- SMILES
- Throws:
InvalidSmilesException
-
checkFirstAtom
Don't start with H or central cumulene (in case there is symmetry)- Parameters:
atom
-- Returns:
- starting node atom
-
generateRingData
get aromaticity, ringSets, and aromaticRings fields so that we can assign / and \ and also provide inter-aromatic single bond- Throws:
InvalidSmilesException
-
getBondStereochemistry
Retrieves the saved character based on the index of the bond. bsBondsUp and bsBondsDown are global fields.- Parameters:
bond
-atomFrom
-- Returns:
- the correct character '/', '\\', '\0' (meaning "no stereochemistry")
-
setBondDirections
private void setBondDirections()Creates global BitSets bsBondsUp and bsBondsDown. Noniterative. -
getSmilesAt
private Node getSmilesAt(javajs.util.SB sb, SimpleNode atom, boolean allowConnectionsToOutsideWorld, boolean allowBranches, boolean forceBrackets) -
isExplicitOnly
-
swapArray
swap slices of an array [i0 i1) with [i1 i2)- Parameters:
a
-i0
-i1
-i2
-
-
getBondOrder
- Parameters:
bondPrev
-atomIndex
-prevIndex
-isAromatic
-- Returns:
- "-", "=", "#", "$", or ""
-
isSameAromaticRing
private boolean isSameAromaticRing(int a1, int a2) -
sortPolyBonds
-
sortInorganic
We must sort the bond vector such that a diaxial pair is first and last. Then we assign stereochemistry based on what is left. The assignment is not made if there are no diaxial groups or with octahedral if there are fewer than three or trigonal bipyramidal with no axial ligands.- Parameters:
atom
-v
-vTemp
-- Returns:
- "@" or "@@" or ""
-
checkStereoPairs
private String checkStereoPairs(SimpleNode atom, int atomIndex, SimpleNode[] stereo, int stereoFlag, boolean isFirst) -
setStereoTemp
private static SimpleNode setStereoTemp(SimpleNode atom, SimpleNode[] stereo, SimpleNode a, float z) Create a dummy atom at the position of an atom at the end of a wedge or hash. In the case where we need a fourth atom, add this atom in a way that roughly puts the center atom at the center of geometry of the four atoms.- Parameters:
atom
-stereo
-a
-z
-- Returns:
- the new atom
-
addStereoCheck
private String addStereoCheck(int level, int atomIndex, SimpleNode atom, String s, javajs.util.BS bsDone) checks a group and either adds a new group to the growing check string or returns null- Parameters:
level
-atomIndex
-atom
-s
-bsDone
-- Returns:
- null if duplicate
-
getRingCache
-
getRingPointer
-
dumpRingKeys
-
getRingKey
-