Package chemaxon.calculations
Class ChemicalNamePlugin
java.lang.Object
chemaxon.calculations.CalculatorPlugin
chemaxon.calculations.ChemicalNamePlugin
- All Implemented Interfaces:
TaggedCalculator,Licensable
Plugin for generating chemical names and identifiers.
API usage example:
// Import molecule
Molecule mol = MolImporter.importMol("CC(=O)OC1=CC=CC=C1C(O)=O");
// Create plugin
ChemicalNamePlugin plugin = new ChemicalNamePlugin();
// 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 calculator plugin example applications using Chemaxon's concurrent framework, refer to the Calculator Plugins Developer's Guide.
- Since:
- Marvin 4.1.7, 03/12/2007
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class chemaxon.calculations.CalculatorPlugin
CalculatorPlugin.HydrogenData -
Field Summary
Fields inherited from class chemaxon.calculations.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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif repeatedly running the same plugin object while getting the results on the GUI is allowed,falseotherwise.voidcheckMolecule(Molecule mol) Checks the input molecule.Returns the CAS number via public web service.Returns the calculation error information message ifCalculatorPlugin.run()returnedfalse(calculation error).Returns the preferred IUPAC name.Returns the product identifier of the plugin.Returns the result item for the specified key and index.getResultAsString(Object type, int index, Object result) Returns the specified result in String format.Returns the result molecule for display.Object[]Returns the result types.Returns the traditional IUPAC name.getTypeString(Object type) Returns a string representation of the given type.booleanReturnstrueif the plugin handles multifragment molecules,falseotherwise.booleanrun()Runs the tool.voidsetGenerateCASNumber(boolean g) Sets CAS number name generation.voidsetGeneratePreferredIUPACName(boolean g) Sets preferred IUPAC name generation.voidsetGenerateTraditionalIUPACName(boolean g) Sets traditional IUPAC name generation.protected voidsetInputMolecule(Molecule mol) Sets the input molecule.voidsetParameters(Properties params) Sets the input parameters for the plugin.voidstandardize(Molecule mol) Standardizes the molecule.Methods inherited from class chemaxon.calculations.CalculatorPlugin
addHeavyAtomLimitChecker, addInputChecker, arrangeHydrogenIncerments, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getAtomIndexMapping, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getOriginalMolecule, getpH, getPh, getQueryMoleculeErrorMessage, getRemark, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultCount, getResultDomain, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getWarningMessage, isInputMoleculeAromatized, isLicensed, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadPluginClass, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setChemicalTermsArgument, setChemicalTermsParameters, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroupsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface chemaxon.calculations.api.TaggedCalculator
tags
-
Constructor Details
-
ChemicalNamePlugin
public ChemicalNamePlugin()
-
-
Method Details
-
canRepeat
public boolean canRepeat()Description copied from class:CalculatorPluginReturnstrueif repeatedly running the same plugin object while getting the results on the GUI is allowed,falseotherwise. For internal use.- Overrides:
canRepeatin classCalculatorPlugin- Returns:
trueif allowed,falseotherwise
-
checkMolecule
Description copied from class:CalculatorPluginChecks 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:
checkMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule
-
getCASNumber
Returns the CAS number via public web service.- Returns:
- the CAS number
- Throws:
CalculatorPluginException- if name generation fail- See Also:
-
getErrorMessage
Description copied from class:CalculatorPluginReturns the calculation error information message ifCalculatorPlugin.run()returnedfalse(calculation error). The default implementation returns the empty string.- Overrides:
getErrorMessagein classCalculatorPlugin- Returns:
- the calculation error information message
-
getPreferredIUPACName
Returns the preferred IUPAC name.- Returns:
- the preferred IUPAC name
- Throws:
CalculatorPluginException- if name generation fail- See Also:
-
getProductName
Description copied from class:CalculatorPluginReturns the product identifier of the plugin. For internal use only!- Specified by:
getProductNamein classCalculatorPlugin
-
getResult
Returns the result item for the specified key and index.- Overrides:
getResultin classCalculatorPlugin- Parameters:
type- is the result typeindex- is the result index- Returns:
- the result item for the specified key and index
- Throws:
CalculatorPluginException- if the result cannot be returned- See Also:
-
getResultAsString
public String getResultAsString(Object type, int index, Object result) throws CalculatorPluginException Returns the specified result in String format.- Overrides:
getResultAsStringin classCalculatorPlugin- Parameters:
type- is the result typeindex- is the result indexresult- is the result item- Returns:
- the specified result in String format
- Throws:
CalculatorPluginException- if an invalid result item is given
-
getResultMolecule
Description copied from class:CalculatorPluginReturns 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 (MPropHandler.convertToString(MPropertyContainer, String)).- Overrides:
getResultMoleculein classCalculatorPlugin- Returns:
- the result molecule
- Throws:
CalculatorPluginException- on error
-
getResultTypes
Returns the result types.- Overrides:
getResultTypesin classCalculatorPlugin- Returns:
- the result types
-
getTraditionalName
Returns the traditional IUPAC name.- Returns:
- the traditional IUPAC name
- Throws:
CalculatorPluginException- if name generation fail- See Also:
-
getTypeString
Description copied from class:CalculatorPluginReturns a string representation of the given type. The default implementation returnstype.toString().- Overrides:
getTypeStringin classCalculatorPlugin- Parameters:
type- is the type object- Returns:
- the type string
-
handlesMultiFragmentMolecules
public boolean handlesMultiFragmentMolecules()Returnstrueif the plugin handles multifragment molecules,falseotherwise. In the latter case the plugin takes the fragment with more atoms if a multifragment molecule is given as input. Returnstrueif parameter "single" is set to "false",falseotherwise (default:false).- Overrides:
handlesMultiFragmentMoleculesin classCalculatorPlugin- Returns:
- true if the plugin handles multifragment molecules, false otherwise
-
run
public boolean run()Description copied from class:CalculatorPluginRuns the tool.- Specified by:
runin classCalculatorPlugin- Returns:
- true if the calculation was successful, false on calculation problems
- See Also:
-
setGenerateCASNumber
public void setGenerateCASNumber(boolean g) Sets CAS number name generation. CAS number is fetched using a public web service.- Parameters:
g- iftruethen CAS number is generated- Since:
- Marvin 5.0
- See Also:
-
setGeneratePreferredIUPACName
public void setGeneratePreferredIUPACName(boolean g) Sets preferred IUPAC name generation.- Parameters:
g- iftruethen preferred IUPAC name is generated- Since:
- Marvin 5.0
- See Also:
-
setGenerateTraditionalIUPACName
public void setGenerateTraditionalIUPACName(boolean g) Sets traditional IUPAC name generation.- Parameters:
g- iftruethen traditional IUPAC name is generated- Since:
- Marvin 5.0
- See Also:
-
setParameters
Description copied from class:CalculatorPluginSets the input parameters for the plugin.- Overrides:
setParametersin classCalculatorPlugin- Parameters:
params- is the parameter table- Throws:
CalculatorPluginException- on error
-
standardize
Standardizes the molecule. Overrides the default standardization.- Overrides:
standardizein classCalculatorPlugin- Parameters:
mol- is the molecule to be standardized
-
setInputMolecule
Description copied from class:CalculatorPluginSets the input molecule.- Specified by:
setInputMoleculein classCalculatorPlugin- Parameters:
mol- is the input molecule- Throws:
CalculatorPluginException- on error
-