|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmol.smiles.SmilesMatcher
public class SmilesMatcher
Originating author: Nicholas Vervelle A class to handle a variety of SMILES/SMARTS-related functions, including: -- determining if two SMILES strings are equivalent -- determining the molecular formula of a SMILES or SMARTS string -- searching for specific runs of atoms in a 3D model -- searching for specific runs of atoms in a SMILES description -- generating valid (though not canonical) SMILES and bioSMILES strings -- getting atom-atom correlation maps to be used with biomolecular alignment methods
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 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).
Field Summary | |
---|---|
private static int |
MODE_ARRAY
|
private static int |
MODE_BITSET
|
private static int |
MODE_MAP
|
Constructor Summary | |
---|---|
SmilesMatcher()
|
Method Summary | |
---|---|
boolean |
areEqual(String smiles,
SmilesSearch molecule)
for JUnit test, mainly |
int |
areEqual(String smiles1,
String smiles2)
|
private BitSet[] |
find(String pattern,
SmilesSearch search,
boolean isSmarts,
boolean matchAllAtoms,
boolean firstMatchOnly)
|
BitSet[] |
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,
BitSet 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 |
getSmiles(JmolNode[] atoms,
int atomCount,
BitSet bsSelected,
boolean asBioSmiles,
boolean allowUnmatchedRings,
boolean addCrossLinks,
String comment)
|
BitSet |
getSubstructureSet(String pattern,
JmolNode[] atoms,
int atomCount,
BitSet bsSelected,
boolean isSmarts,
boolean firstMatchOnly)
Returns a bitset matching the pattern within atoms. |
BitSet[] |
getSubstructureSetArray(String pattern,
JmolNode[] atoms,
int atomCount,
BitSet bsSelected,
BitSet bsAromatic,
boolean isSmarts,
boolean firstMatchOnly)
Returns a vector of bitsets indicating which atoms match the pattern. |
private Object |
match(String pattern,
JmolNode[] atoms,
int atomCount,
BitSet bsSelected,
BitSet bsAromatic,
boolean isSmarts,
boolean matchAllAtoms,
boolean firstMatchOnly,
int mode)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int MODE_BITSET
private static final int MODE_ARRAY
private static final int MODE_MAP
Constructor Detail |
---|
public SmilesMatcher()
Method Detail |
---|
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, BitSet 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 BitSet[] 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 BitSet getSubstructureSet(String pattern, JmolNode[] atoms, int atomCount, BitSet bsSelected, boolean isSmarts, boolean firstMatchOnly)
getSubstructureSet
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- atomCount
- bsSelected
- isSmarts
- firstMatchOnly
-
public BitSet[] getSubstructureSetArray(String pattern, JmolNode[] atoms, int atomCount, BitSet bsSelected, BitSet 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, BitSet bsSelected, boolean isSmarts, boolean firstMatchOnly)
getCorrelationMaps
in interface SmilesMatcherInterface
pattern
- SMILES or SMARTS pattern.atoms
- atomCount
- bsSelected
- isSmarts
- firstMatchOnly
-
private BitSet[] find(String pattern, SmilesSearch search, boolean isSmarts, boolean matchAllAtoms, boolean firstMatchOnly)
private Object match(String pattern, JmolNode[] atoms, int atomCount, BitSet bsSelected, BitSet bsAromatic, boolean isSmarts, boolean matchAllAtoms, boolean firstMatchOnly, int mode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |