Package chemaxon.marvin.calculations
Class IUPACNamingPlugin
- java.lang.Object
-
- chemaxon.marvin.plugin.CalculatorPlugin
-
- chemaxon.marvin.calculations.IUPACNamingPlugin
-
- All Implemented Interfaces:
chemaxon.license.Licensable
@PublicAPI public class IUPACNamingPlugin extends CalculatorPlugin
IUPAC name generator plugin.API usage example:
// read input molecule MolImporter mi = new MolImporter("test.mol"); Molecule mol = mi.read(); mi.close(); // create plugin IUPACNamingPlugin plugin = new IUPACNamingPlugin(); // set the input molecule plugin.setMolecule(mol); // run the calculation plugin.run(); // get results String preferredIUPACName = plugin.getPreferredIUPACName(); String traditionalName = plugin.getTraditionalName(); String casNumber = plugin.getCASNumber(); // do something with the result ...
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
- Since:
- Marvin 4.1.7, 03/12/2007
- See Also:
Molecule.toFormat(String)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class chemaxon.marvin.plugin.CalculatorPlugin
CalculatorPlugin.HydrogenData
-
-
Field Summary
-
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
Constructors Constructor Description IUPACNamingPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRepeat()
Returnstrue
if repeatedly running the same plugin object while getting the results on the GUI is allowed,false
otherwise.void
checkMolecule(Molecule mol)
Checks the input molecule.String
getCASNumber()
Returns the CAS number via public web service.String
getErrorMessage()
Returns the calculation error information message ifCalculatorPlugin.run()
returnedfalse
(calculation error).String
getPreferredIUPACName()
Returns the preferred IUPAC name.String
getProductName()
Returns the product identifier of the plugin as given byLicenseManager
.Object
getResult(Object type, int index)
Returns the result item for the specified key and index.String
getResultAsString(Object type, int index, Object result)
Returns the specified result in String format.Molecule
getResultMolecule()
Returns the result molecule for display.Object[]
getResultTypes()
Returns the result types.String
getTraditionalName()
Returns the traditional IUPAC name.String
getTypeString(Object type)
Returns a string representation of the given type.boolean
handlesMultiFragmentMolecules()
Returnstrue
if the plugin handles multifragment molecules,false
otherwise.boolean
run()
Runs the tool.void
setGenerateCASNumber(boolean g)
Sets CAS number name generation.void
setGeneratePreferredIUPACName(boolean g)
Sets preferred IUPAC name generation.void
setGenerateTraditionalIUPACName(boolean g)
Sets traditional IUPAC name generation.protected void
setInputMolecule(Molecule mol)
Sets the input molecule.void
setParameters(Properties params)
Sets the input parameters for the plugin.void
standardize(Molecule mol)
Standardizes the molecule.-
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
addHeavyAtomLimitChecker, addInputChecker, arrangeHydrogenIncerments, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getOriginalMolecule, getpH, getPluginResource, getQueryMoleculeErrorMessage, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultCount, getResultDomain, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getWarningMessage, isInputMoleculeAromatized, isLicensed, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
-
-
-
-
Method Detail
-
canRepeat
public boolean canRepeat()
Description copied from class:CalculatorPlugin
Returnstrue
if repeatedly running the same plugin object while getting the results on the GUI is allowed,false
otherwise. For internal use.- Overrides:
canRepeat
in classCalculatorPlugin
- Returns:
true
if allowed,false
otherwise
-
checkMolecule
public void checkMolecule(Molecule mol)
Description copied from class:CalculatorPlugin
Checks the input molecule. Throws exception if the molecule is not accepted as input molecule, otherwise does nothing (simply returns). The default implementation refuses query molecules, molecules with SRU S-groups, molecules with multicenter S-groups and molecules with coordinate bonds.- Overrides:
checkMolecule
in classCalculatorPlugin
- Parameters:
mol
- is the input molecule
-
getCASNumber
public String getCASNumber() throws PluginException
Returns the CAS number via public web service.- Returns:
- the CAS number
- Throws:
PluginException
- if name generation fail- See Also:
setGenerateCASNumber(boolean)
-
getErrorMessage
public String getErrorMessage()
Description copied from class:CalculatorPlugin
Returns the calculation error information message ifCalculatorPlugin.run()
returnedfalse
(calculation error). The default implementation returns the empty string.- Overrides:
getErrorMessage
in classCalculatorPlugin
- Returns:
- the calculation error information message
-
getPreferredIUPACName
public String getPreferredIUPACName() throws PluginException
Returns the preferred IUPAC name.- Returns:
- the preferred IUPAC name
- Throws:
PluginException
- if name generation fail- See Also:
setGeneratePreferredIUPACName(boolean)
-
getProductName
public String getProductName()
Returns the product identifier of the plugin as given byLicenseManager
.- Specified by:
getProductName
in classCalculatorPlugin
- Returns:
- The identifier
LicenseManager.STRUCTURE_TO_NAME
-
getResult
public Object getResult(Object type, int index) throws PluginException
Returns the result item for the specified key and index.- Overrides:
getResult
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- 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 String getResultAsString(Object type, int index, Object result) throws PluginException
Returns the specified result in String format.- Overrides:
getResultAsString
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result item- Returns:
- the specified result in String format
- Throws:
PluginException
- if an invalid result item is given
-
getResultMolecule
public Molecule getResultMolecule() throws PluginException
Returns the result molecule for display. Atomic results are stored in atom extra labels (MolAtom.getExtraLabel()
). Molecular results are stored in molecule properties with keys being the result types (Molecule.getProperty(String)
).- Overrides:
getResultMolecule
in classCalculatorPlugin
- Returns:
- the result molecule
- Throws:
PluginException
- on error
-
getResultTypes
public Object[] getResultTypes()
Returns the result types.- Overrides:
getResultTypes
in classCalculatorPlugin
- Returns:
- the result types
-
getTraditionalName
public String getTraditionalName() throws PluginException
Returns the traditional IUPAC name.- Returns:
- the traditional IUPAC name
- Throws:
PluginException
- if name generation fail- See Also:
setGenerateTraditionalIUPACName(boolean)
-
getTypeString
public String getTypeString(Object type)
Returns a string representation of the given type. The default implementation returnstype.toString()
.- Overrides:
getTypeString
in classCalculatorPlugin
- Parameters:
type
- is the type object- Returns:
- the type string
-
handlesMultiFragmentMolecules
public boolean handlesMultiFragmentMolecules()
Returnstrue
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. Returnstrue
if parameter "single" is set to "false",false
otherwise (default:false
).- Overrides:
handlesMultiFragmentMolecules
in classCalculatorPlugin
- Returns:
- true if the plugin handles multifragment molecules, false otherwise
-
run
public boolean run()
Runs the tool.- Specified by:
run
in classCalculatorPlugin
- Returns:
- true if the calculation was successful, false on calculation problems
- See Also:
CalculatorPlugin.getErrorMessage()
-
setGenerateCASNumber
public void setGenerateCASNumber(boolean g)
Sets CAS number name generation. CAS number is fetched using a public web service.- Parameters:
g
- iftrue
then CAS number is generated- Since:
- Marvin 5.0
- See Also:
getCASNumber()
-
setGeneratePreferredIUPACName
public void setGeneratePreferredIUPACName(boolean g)
Sets preferred IUPAC name generation.- Parameters:
g
- iftrue
then preferred IUPAC name is generated- Since:
- Marvin 5.0
- See Also:
getPreferredIUPACName()
-
setGenerateTraditionalIUPACName
public void setGenerateTraditionalIUPACName(boolean g)
Sets traditional IUPAC name generation.- Parameters:
g
- iftrue
then traditional IUPAC name is generated- Since:
- Marvin 5.0
- See Also:
getTraditionalName()
-
setParameters
public void setParameters(Properties params) throws PluginException
Sets the input parameters for the plugin.- Overrides:
setParameters
in classCalculatorPlugin
- Parameters:
params
- is the parameter table- Throws:
PluginException
- on error
-
standardize
public void standardize(Molecule mol)
Standardizes the molecule. Overrides the default standardization.- Overrides:
standardize
in classCalculatorPlugin
- Parameters:
mol
- is the molecule to be standardized
-
setInputMolecule
protected void setInputMolecule(Molecule mol) throws PluginException
Sets the input molecule.- Specified by:
setInputMolecule
in classCalculatorPlugin
- Parameters:
mol
- is the input molecule- Throws:
PluginException
- on error
-
-