@TestClass(value="org.openscience.cdk.smiles.SmilesParserTest") public class SmilesParser extends Object
try { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IMolecule m = sp.parseSmiles("c1ccccc1"); } catch (InvalidSmilesException ise) { }
This parser does not parse stereochemical information, but the following features are supported: reaction smiles, partitioned structures, charged atoms, implicit hydrogen count, '*' and isotope information.
See for further information.
Constructor and Description |
---|
SmilesParser(IChemObjectBuilder builder)
Constructor for the SmilesParser object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isPreservingAromaticity()
Gets the (default false) setting to preserve aromaticity as provided in the Smiles itself.
|
IReaction |
parseReactionSmiles(String smiles)
Parse a reaction SMILES.
|
IMolecule |
parseSmiles(String smiles)
Parses a SMILES string and returns a Molecule object.
|
void |
setPreservingAromaticity(boolean preservingAromaticity)
Makes the Smiles parser set aromaticity as provided in the Smiles itself, without detecting it.
|
public SmilesParser(IChemObjectBuilder builder)
builder
- IChemObjectBuilder used to create the IMolecules from@TestMethod(value="testReaction,testReactionWithAgents") public IReaction parseReactionSmiles(String smiles) throws InvalidSmilesException
smiles
- The SMILES string to parseIReaction
InvalidSmilesException
- if the string cannot be parsedparseSmiles(String)
@TestMethod(value="testAromaticSmiles,testSFBug1296113") public IMolecule parseSmiles(String smiles) throws InvalidSmilesException
smiles
- A SMILES stringInvalidSmilesException
- thrown when the SMILES string is invalidpublic void setPreservingAromaticity(boolean preservingAromaticity)
preservingAromaticity
- boolean to indicate if aromaticity is to be preserved.public boolean isPreservingAromaticity()