public class SmilesMatcher extends Object implements SmilesMatcherInterface
The original SMILES description can been found at the SMILES Home Page. Specification for this implementation can be found in package.html.
public methods:
int areEqual -- checks a SMILES string against a reference (-1 for error; 0 for no finds; >0 for number of finds)
BitSet[] find -- finds one or more occurances of a SMILES or SMARTS string within a SMILES string
int[][] getCorrelationMaps -- returns correlated arrays of atoms
String getLastError -- returns any error that was last encountered.
String getMolecularFormula -- returns the MF of a SMILES or SMARTS string
String getRelationship -- returns isomeric relationship
String getSmiles -- returns a standard SMILES string or a
Jmol BIOSMILES string with comment header.
BitSet getSubstructureSet -- returns a single BitSet with all found atoms included
in Jmol script:
string2.find("SMILES", string1)
string2.find("SMARTS", string1)
e.g.
print "CCCC".find("SMILES", "C[C]")
select search("smartsString")
All bioSMARTS strings begin with ~ (tilde).
Modifier and Type | Field and Description |
---|---|
private static int |
MODE_ARRAY |
private static int |
MODE_ATROP |
private static int |
MODE_BITSET |
private static int |
MODE_MAP |
Constructor and Description |
---|
SmilesMatcher() |
Modifier and Type | Method and Description |
---|---|
int |
areEqual(String smiles1,
String smiles2) |
boolean |
areEqualTest(String smiles,
SmilesSearch search)
for JUnit test, mainly
|
String |
cleanSmiles(String smiles) |
int[][] |
find(String pattern,
String target,
int flags)
Searches for all matches of a pattern within a SMILES string.
|
private Object |
findPriv(String pattern,
SmilesSearch search,
int flags,
int mode) |
String |
getAtropisomerKeys(String pattern,
Node[] atoms,
int ac,
BS bsSelected,
BS bsAromatic,
int flags)
called by SmilesParser to get nn in ^nn- base on match to actual structure
|
int[][] |
getCorrelationMaps(String pattern,
Node[] atoms,
int atomCount,
BS bsSelected,
int flags)
Rather than returning bitsets, this method returns the sets of matching
atoms in array form so that a direct atom-atom correlation can be made.
|
String |
getLastException() |
void |
getMMFF94AtomTypes(String[] smarts,
Node[] atoms,
int ac,
BS bsSelected,
javajs.util.Lst<BS> ret,
javajs.util.Lst<BS>[] vRings)
called by ForceFieldMMFF.setAtomTypes only
|
String |
getMolecularFormula(String pattern,
boolean isSmarts) |
String |
getRelationship(String smiles1,
String smiles2) |
String |
getSmiles(Node[] atoms,
int ac,
BS bsSelected,
String bioComment,
int flags)
internal to Jmol -- called by org.jmol.Viewer.getSmiles
|
BS |
getSubstructureSet(String pattern,
Node[] atoms,
int ac,
BS bsSelected,
int flags)
Returns a bitset matching the pattern within a set of Jmol atoms.
|
BS[] |
getSubstructureSetArray(String pattern,
Node[] atoms,
int ac,
BS bsSelected,
BS bsAromatic,
int flags)
Returns a vector of bitsets indicating which atoms match the pattern.
|
private Object |
matchPriv(String pattern,
Node[] atoms,
int ac,
BS bsSelected,
BS bsAromatic,
boolean doTestAromatic,
int flags,
int mode) |
String |
polyhedronToSmiles(Node center,
int[][] faces,
int atomCount,
javajs.util.P3[] points,
int flags,
String details)
Generate a topological SMILES string from a set of faces
|
String |
reverseChirality(String smiles)
Note, this may be incompatible with [$(select(..))]
THIS IS NOT DEPENDABLE.
|
private static final int MODE_BITSET
private static final int MODE_ARRAY
private static final int MODE_MAP
private static final int MODE_ATROP
public String getLastException()
getLastException
in interface SmilesMatcherInterface
public String getMolecularFormula(String pattern, boolean isSmarts) throws Exception
getMolecularFormula
in interface SmilesMatcherInterface
Exception
public String getSmiles(Node[] atoms, int ac, BS bsSelected, String bioComment, int flags) throws Exception
getSmiles
in interface SmilesMatcherInterface
Exception
public int areEqual(String smiles1, String smiles2) throws Exception
areEqual
in interface SmilesMatcherInterface
Exception
public boolean areEqualTest(String smiles, SmilesSearch search) throws Exception
smiles
- search
- Exception
public int[][] find(String pattern, String target, int flags) throws Exception
find
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.target
- flags
- Exception
public String getRelationship(String smiles1, String smiles2) throws Exception
getRelationship
in interface SmilesMatcherInterface
Exception
public String reverseChirality(String smiles)
reverseChirality
in interface SmilesMatcherInterface
public BS getSubstructureSet(String pattern, Node[] atoms, int ac, BS bsSelected, int flags) throws Exception
getSubstructureSet
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- ac
- bsSelected
- Exception
public void getMMFF94AtomTypes(String[] smarts, Node[] atoms, int ac, BS bsSelected, javajs.util.Lst<BS> ret, javajs.util.Lst<BS>[] vRings) throws Exception
getMMFF94AtomTypes
in interface SmilesMatcherInterface
Exception
public BS[] getSubstructureSetArray(String pattern, Node[] atoms, int ac, BS bsSelected, BS bsAromatic, int flags) throws Exception
getSubstructureSetArray
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- ac
- bsSelected
- bsAromatic
- Exception
public String getAtropisomerKeys(String pattern, Node[] atoms, int ac, BS bsSelected, BS bsAromatic, int flags) throws Exception
pattern
- atoms
- ac
- bsSelected
- bsAromatic
- flags
- Exception
public String polyhedronToSmiles(Node center, int[][] faces, int atomCount, javajs.util.P3[] points, int flags, String details) throws Exception
polyhedronToSmiles
in interface SmilesMatcherInterface
faces
- atomCount
- Exception
public int[][] getCorrelationMaps(String pattern, Node[] atoms, int atomCount, BS bsSelected, int flags) throws Exception
getCorrelationMaps
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- bsSelected
- Exception
private Object findPriv(String pattern, SmilesSearch search, int flags, int mode) throws Exception
Exception
private Object matchPriv(String pattern, Node[] atoms, int ac, BS bsSelected, BS bsAromatic, boolean doTestAromatic, int flags, int mode) throws Exception
Exception
public String cleanSmiles(String smiles)
cleanSmiles
in interface SmilesMatcherInterface