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_BITSET |
private static int |
MODE_MAP |
Constructor and Description |
---|
SmilesMatcher() |
Modifier and Type | Method and Description |
---|---|
boolean |
areEqual(String smiles,
SmilesSearch molecule)
for JUnit test, mainly
|
int |
areEqual(String smiles1,
String smiles2) |
private int |
countStereo(String s) |
private BS[] |
find(String pattern,
SmilesSearch search,
boolean isSmarts,
boolean matchAllAtoms,
boolean firstMatchOnly) |
BS[] |
find(String pattern,
String smiles,
boolean isSmarts,
boolean firstMatchOnly)
Searches for all matches of a pattern within a SMILES string.
|
int[][] |
getCorrelationMaps(String pattern,
JmolNode[] atoms,
int atomCount,
BS bsSelected,
boolean isSmarts,
boolean firstMatchOnly)
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() |
String |
getMolecularFormula(String pattern,
boolean isSmarts) |
String |
getRelationship(String smiles1,
String smiles2) |
String |
getSmiles(JmolNode[] atoms,
int atomCount,
BS bsSelected,
boolean asBioSmiles,
boolean allowUnmatchedRings,
boolean addCrossLinks,
String comment) |
BS |
getSubstructureSet(String pattern,
JmolNode[] atoms,
int atomCount,
BS bsSelected,
boolean isSmarts,
boolean firstMatchOnly)
Returns a bitset matching the pattern within atoms.
|
BS[] |
getSubstructureSetArray(String pattern,
JmolNode[] atoms,
int atomCount,
BS bsSelected,
BS bsAromatic,
boolean isSmarts,
boolean firstMatchOnly)
Returns a vector of bitsets indicating which atoms match the pattern.
|
void |
getSubstructureSets(String[] smarts,
JmolNode[] atoms,
int atomCount,
int flags,
BS bsSelected,
javajs.util.List<BS> ret,
javajs.util.List<BS>[] vRings) |
private Object |
match(String pattern,
JmolNode[] atoms,
int atomCount,
BS bsSelected,
BS bsAromatic,
boolean isSmarts,
boolean matchAllAtoms,
boolean firstMatchOnly,
int mode) |
String |
reverseChirality(String smiles) |
private static final int MODE_BITSET
private static final int MODE_ARRAY
private static final int MODE_MAP
public String getLastException()
getLastException
in interface SmilesMatcherInterface
public String getMolecularFormula(String pattern, boolean isSmarts)
getMolecularFormula
in interface SmilesMatcherInterface
public String getSmiles(JmolNode[] atoms, int atomCount, BS bsSelected, boolean asBioSmiles, boolean allowUnmatchedRings, boolean addCrossLinks, String comment)
getSmiles
in interface SmilesMatcherInterface
public int areEqual(String smiles1, String smiles2)
areEqual
in interface SmilesMatcherInterface
public boolean areEqual(String smiles, SmilesSearch molecule)
smiles
- molecule
- public BS[] find(String pattern, String smiles, boolean isSmarts, boolean firstMatchOnly)
find
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.smiles
- isSmarts
- TRUE for SMARTS strings, FALSE for SMILES stringsfirstMatchOnly
- public String getRelationship(String smiles1, String smiles2)
getRelationship
in interface SmilesMatcherInterface
public String reverseChirality(String smiles)
reverseChirality
in interface SmilesMatcherInterface
public BS getSubstructureSet(String pattern, JmolNode[] atoms, int atomCount, BS bsSelected, boolean isSmarts, boolean firstMatchOnly)
getSubstructureSet
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- atomCount
- bsSelected
- isSmarts
- firstMatchOnly
- public void getSubstructureSets(String[] smarts, JmolNode[] atoms, int atomCount, int flags, BS bsSelected, javajs.util.List<BS> ret, javajs.util.List<BS>[] vRings)
getSubstructureSets
in interface SmilesMatcherInterface
public BS[] getSubstructureSetArray(String pattern, JmolNode[] atoms, int atomCount, BS bsSelected, BS bsAromatic, boolean isSmarts, boolean firstMatchOnly)
getSubstructureSetArray
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- atomCount
- bsSelected
- bsAromatic
- isSmarts
- firstMatchOnly
- public int[][] getCorrelationMaps(String pattern, JmolNode[] atoms, int atomCount, BS bsSelected, boolean isSmarts, boolean firstMatchOnly)
getCorrelationMaps
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- atomCount
- bsSelected
- isSmarts
- firstMatchOnly
- private BS[] find(String pattern, SmilesSearch search, boolean isSmarts, boolean matchAllAtoms, boolean firstMatchOnly)
private Object match(String pattern, JmolNode[] atoms, int atomCount, BS bsSelected, BS bsAromatic, boolean isSmarts, boolean matchAllAtoms, boolean firstMatchOnly, int mode)
private int countStereo(String s)