chemaxon.marvin.calculations
Class StereoisomerPlugin

java.lang.Object
  extended by chemaxon.marvin.plugin.CalculatorPlugin
      extended by chemaxon.marvin.calculations.StereoisomerPlugin
All Implemented Interfaces:
chemaxon.license.Licensable

public class StereoisomerPlugin
extends CalculatorPlugin

Plugin class for stereoisomer calculation. * Data types:

API usage example:

    // read input molecule
    MolImporter mi = new MolImporter("test.mol");
    Molecule mol = mi.read();
    mi.close();

    // create plugin
    StereoisomerPlugin plugin = new StereoisomerPlugin();

    // set target molecule
    plugin.setMolecule(mol);
    
    // set parameters for calculation
    plugin.setStereoisomerismType(StereoisomerPlugin.TETRAHEDRAL);  
    plugin.setMaxNumberOfStereoisomers(2048);     // if not set all stereoisomers are generated

    // run the calculation
    plugin.run();

    // get results
    Molecule[] stereoisomers = plugin.getStereoisomers();
    int stereoisomerCount = plugin.getStereoisomerCount();
    Molecule m;
    for (int i = 0; i < stereoisomerCount; ++i) {
        m = stereoisomers[i];   // same as m = plugin.getStereoisomer(i);
        // do something with molecule ...
    }

    // do something with the results ...
 

Note: Stereoisomer plugin does not handle enhanced stereo information. Enhanced stereo information is cleared before generating the stereoisomers.

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Since:
Marvin 4.1 03/07/2006
Version:
5.7, 04/26/2011
Author:
Zsolt Mohacsi

Nested Class Summary
 
Nested classes/interfaces inherited from class chemaxon.marvin.plugin.CalculatorPlugin
CalculatorPlugin.HydrogenData
 
Field Summary
static int BOTH
           
static int DOUBLE_BOND
           
static int TETRAHEDRAL
           
 
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, explicitHydrogens, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, KEEP_HYDROGENS, keepHydrogens, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED, TRUE
 
Constructor Summary
StereoisomerPlugin()
           
 
Method Summary
 void checkMolecule(Molecule mol)
          Checks the input molecule.
 int chiralCenterCount()
          Calculates the number of tetrahedral stereogenic centers.
 java.lang.String getProductName()
          Returns the product identifier of the plugin as given by LicenseManager.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the result item for the specified key and index.
 java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result)
          Returns the specified result in String format.
 int getResultCount(java.lang.Object type)
          Returns the number of result items for the given result key.
 int getResultDomain(java.lang.Object type)
          Returns the calculation domain.
 chemaxon.marvin.plugin.PluginMDocSource getResultSource()
          Returns the result as a document source object.
 java.lang.Object[] getResultTypes()
          Returns the result types.
 Molecule getStereoisomer(int index)
          Returns a stereoisomer.
 int getStereoisomerCount()
          Returns the number of different stereoisomers.
 Molecule[] getStereoisomers()
          Returns the stereoisomers in a Molecule[] array.
 java.lang.String getTypeString(java.lang.Object type)
          Returns a string representation of the given type.
 java.lang.String getWarningMessage()
          Returns a warning message if there are no stereoisomers, null otherwise.
 boolean handlesMultiFragmentMolecules()
          Returns true if the plugin handles multifragment molecules, false otherwise.
 boolean isChiralCenter(int a)
          Determines if an atom can be a tetrahedral stereogenic center.
 boolean isIn3D()
          Returns true if structures are returned in 3D.
 boolean run()
          Runs the plugin.
 void setCheck3DStereo(boolean c)
          Sets the 3D stereo conformation checking of the structure.
 void setIn3D(boolean b)
          Sets to display the molecule in 3D.
protected  void setInputMolecule(Molecule mol)
          Sets the input molecule.
 void setMaxNumberOfStereoisomers(int n)
          Sets the maxinum number of stereoisomers to be generated.
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void setProgressMonitor(chemaxon.common.util.MProgressMonitor pmon)
          Sets a progress monitor to be used in run() to display progress status.
 void setProtectDoubleBondStereo(boolean protect)
          Sets double bond stereo protection: if true then the stereo configuration of double bonds with preset stereo information will not be changed.
 void setProtectTetrahedralStereo(boolean protect)
          Sets the protection of tetrahedral stereo centers: if true then stereo configuration of tetrahedral stereo centers with preset stereo information will not be changed.
 void setStereoisomerismType(int itype)
          Sets which type of stereoiseomers should be generated.
 void standardize(Molecule mol)
          Clears enhanced stereo information.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
arrangeHydrogenIncerments, canRepeat, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getErrorMessage, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getpH, getPluginResource, getQueryMoleculeErrorMessage, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecule, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, isInputMoleculeAromatized, isLicensed, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, standardizeIonicGroups, standardizeNeutralGroups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TETRAHEDRAL

public static final int TETRAHEDRAL
See Also:
Constant Field Values

DOUBLE_BOND

public static final int DOUBLE_BOND
See Also:
Constant Field Values

BOTH

public static final int BOTH
See Also:
Constant Field Values
Constructor Detail

StereoisomerPlugin

public StereoisomerPlugin()
Method Detail

getProductName

public java.lang.String getProductName()
Returns the product identifier of the plugin as given by LicenseManager.

Specified by:
getProductName in class CalculatorPlugin
Returns:
The identifier LicenseManager.ISOMERS_PLUGIN_GROUP

handlesMultiFragmentMolecules

public boolean handlesMultiFragmentMolecules()
Returns true if the plugin handles multifragment molecules, false otherwise. In the latter case the plugin takes the fragment with more atoms if a multifragment molecule is given as input.

Overrides:
handlesMultiFragmentMolecules in class CalculatorPlugin
Returns:
true if the plugin handles multifragment molecules, false otherwise

setProgressMonitor

public void setProgressMonitor(chemaxon.common.util.MProgressMonitor pmon)
Sets a progress monitor to be used in run() to display progress status. Short calculations may ignore the observer object. The default implementation does nothing.

Overrides:
setProgressMonitor in class CalculatorPlugin
Parameters:
pmon - is the progress observer object, may be null

setParameters

public void setParameters(java.util.Properties params)
                   throws PluginException
Sets the input parameters for the plugin. Parameters and value ranges:

Overrides:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error

isIn3D

public boolean isIn3D()
Returns true if structures are returned in 3D.

Returns:
true if structures are returned in 3D
Since:
Marvin 5.0

setProtectTetrahedralStereo

public void setProtectTetrahedralStereo(boolean protect)
Sets the protection of tetrahedral stereo centers: if true then stereo configuration of tetrahedral stereo centers with preset stereo information will not be changed. Default: false.

Parameters:
protect - is true if preset tetrahedral stereo centers should be protected
Since:
Marvin 5.2.3

setProtectDoubleBondStereo

public void setProtectDoubleBondStereo(boolean protect)
Sets double bond stereo protection: if true then the stereo configuration of double bonds with preset stereo information will not be changed. Default: false.

Parameters:
protect - is true if preset double bond stereo information should be protected
Since:
Marvin 5.2.3

checkMolecule

public void checkMolecule(Molecule mol)
                   throws PluginException
Checks the input molecule. Throws exception if the molecule is RxnMolecule or if the molecule contains R-groups.

Overrides:
checkMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - with error message for the user if the molecule is refused

setInputMolecule

protected void setInputMolecule(Molecule mol)
                         throws PluginException
Sets the input molecule.

Specified by:
setInputMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - on error

isChiralCenter

public boolean isChiralCenter(int a)
Determines if an atom can be a tetrahedral stereogenic center.

Parameters:
a - index of the atom
Returns:
true if the atom is stereogenic.

chiralCenterCount

public int chiralCenterCount()
Calculates the number of tetrahedral stereogenic centers. This function identifies two chiral centers in 1,4-dimethylcyclohexane, which does not contain asymmetric atoms.

Returns:
number of tetrahedral stereogenic center atoms

setMaxNumberOfStereoisomers

public void setMaxNumberOfStereoisomers(int n)
Sets the maxinum number of stereoisomers to be generated. If not set the plugin generates all stereoisomers of the molecule. It is recommended to use when there are too much stereoisomers to fit to the memory.

Parameters:
n - is the number of stereoisomers to be generated

setStereoisomerismType

public void setStereoisomerismType(int itype)
Sets which type of stereoiseomers should be generated. Available values:

Parameters:
itype - is the stereoisomerism type (represented by an integer constant)

setCheck3DStereo

public void setCheck3DStereo(boolean c)
Sets the 3D stereo conformation checking of the structure.

Parameters:
c - if true structure is checked for a valid stereo conformation.

setIn3D

public void setIn3D(boolean b)
Sets to display the molecule in 3D.

Parameters:
b - if true structure is displayed in 3D

getResultSource

public chemaxon.marvin.plugin.PluginMDocSource getResultSource()
                                                        throws PluginException
Returns the result as a document source object. This is useful for displaying the molecules in a viewer dynamically as they become available instead of collecting all results before display.

Overrides:
getResultSource in class CalculatorPlugin
Returns:
the document source interface
Throws:
PluginException - on error
Since:
Marvin 5.0

getStereoisomerCount

public int getStereoisomerCount()
Returns the number of different stereoisomers.

Returns:
the number of different stereoisomers

getStereoisomer

public Molecule getStereoisomer(int index)
Returns a stereoisomer.

Parameters:
index - is the index of the stereoisomer
Returns:
a stereoisomer

getStereoisomers

public Molecule[] getStereoisomers()
Returns the stereoisomers in a Molecule[] array.

Returns:
stereoisomers

run

public boolean run()
            throws PluginException
Runs the plugin.

Specified by:
run in class CalculatorPlugin
Returns:
true if the calculation was successful, false if unsuccesful
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getErrorMessage()

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the result types.

Overrides:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getTypeString

public java.lang.String getTypeString(java.lang.Object type)
Returns a string representation of the given type.

Overrides:
getTypeString in class CalculatorPlugin
Parameters:
type - is the type object
Returns:
the type string

getResultDomain

public int getResultDomain(java.lang.Object type)
Returns the calculation domain.

Overrides:
getResultDomain in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
the calculation domain
See Also:
getResultTypes()

getResultCount

public int getResultCount(java.lang.Object type)
Returns the number of result items for the given result key.

Overrides:
getResultCount in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
the number of result items
See Also:
getResultTypes()

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  int index)
                           throws PluginException
Returns the result item for the specified key and index.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
Returns:
the result item for the specified key and index
Throws:
PluginException - if the result cannot be returned
See Also:
CalculatorPlugin.getResultTypes()

getResultAsString

public java.lang.String getResultAsString(java.lang.Object type,
                                          int index,
                                          java.lang.Object result)
                                   throws PluginException
Returns the specified result in String format.

Overrides:
getResultAsString in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
result - is the result item
Returns:
the specified result in String format
Throws:
PluginException - if an invalid result item is given

getWarningMessage

public java.lang.String getWarningMessage()
Returns a warning message if there are no stereoisomers, null otherwise.

Overrides:
getWarningMessage in class CalculatorPlugin
Returns:
a warning message if stereoisomer calculation aborted

standardize

public void standardize(Molecule mol)
Clears enhanced stereo information.

Overrides:
standardize in class CalculatorPlugin
Parameters:
mol - is the molecule to be standardized