|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.MarkushEnumerationPlugin
public class MarkushEnumerationPlugin
Plugin class for enumerating Markush molecules.
Input: a Markush structure.
Output: the number of possible enumerations; the enumerated molecules.
API usage examples:
// read input molecule
MolImporter mi = new MolImporter("testMarkush.mrv");
Molecule mol = mi.read();
mi.close();
// create plugin
MarkushEnumerationPlugin plugin = new MarkushEnumerationPlugin();
// set target molecule
plugin.setMolecule(mol);
// run the calculation
plugin.run();
// 1. Get results one by one
Molecule m = plugin.getNextStructure();
while (m != null) {
System.out.println(m.toFormat("smiles"));
// using molecule ...
// ...
// getting next enumerated molecule
m = plugin.getNextStructure();
}
// OR
// 2. Get results in an array
long size = plugin.getStructureCount();
if (size != -1 && size <= Integer.MAX_VALUE) {
Molecule[] enumerated = plugin.getStructures();
for (int i = 0; i < enumerated.length; i++) {
System.out.println(enumerated[i].toFormat("smiles"));
// using molecules ...
}
}
// read input molecule
MolImporter mi = new MolImporter("testMarkush.mrv");
Molecule mol = mi.read();
mi.close();
// create plugin
MarkushEnumerationPlugin plugin = new MarkushEnumerationPlugin();
// set random enumeration
plugin.setRandomEnumeration();
// set the number of random structures to generate
plugin.setMaxStructureCount(10);
// set target molecule
plugin.setMolecule(mol);
// run the calculation
plugin.run();
for (int i = 0; i < 10; i++) {
Molecule m = plugin.getNextStructure();
System.out.println(m.toFormat("smiles"));
// using molecule ...
}
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
| Field Summary | |
|---|---|
static int |
COLORING_ALL
Constant for setting all coloring options, currently scaffold and R-groups. |
static int |
COLORING_NONE
Constant for no hit coloring. |
static int |
COLORING_RGROUPS
Constant for R-group coloring. |
static int |
COLORING_SCAFFOLD
Constant for scaffold coloring. |
static MolFilter |
FILTER_VALENCE
Filter constant: valence filter. |
| Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
|---|
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED |
| Constructor Summary | |
|---|---|
MarkushEnumerationPlugin()
Constructor. |
|
| Method Summary | |
|---|---|
void |
checkMolecule(Molecule mol)
Checks the input molecule. |
java.math.BigInteger |
countEnumerations()
Returns the number of all enumerated structures, no arithmetic overflow because counts in BigInteger. |
int |
countEnumerationsMagnitude()
Returns the magnitude (the number of decimal "digits") of the number of all enumerated structures. |
boolean |
getAlignScaffold()
Gets the scaffold aligning mode |
Molecule[] |
getAromatizedStructures()
Returns the enumerated structures in aromatized form. |
int |
getColoring()
Returns the hit coloring options. |
boolean |
getEnumCodeNeeded()
Tests whether unique Markush enumeration code should be generated |
java.lang.String |
getLibrarySizeString()
Returns the string representation of the Markush library size. |
int |
getLimitedStructureCount()
Returns the number of structures to be generated. |
Molecule |
getNextAromatizedStructure()
Returns the next enumerated structure. |
Molecule |
getNextStructure()
Returns the next enumerated structure, or null if no more structures. |
java.lang.String |
getProductName()
Returns the product identifier of the plugin as given by LicenseManager. |
java.lang.String |
getRemark()
Returns a warning message in case of arithmetical overflow (the number of enumerated structures exceeds Long.MAX_VALUE),
null otherwise. |
java.lang.Object |
getResult(java.lang.Object type,
int index)
Returns the result item for the specified key and index. |
java.lang.Object |
getResult(java.lang.Object type,
java.lang.String arg)
Returns the enumerated structures. |
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. |
Molecule |
getResultMolecule()
Returns the result molecule for display. |
chemaxon.marvin.plugin.PluginMDocSource |
getResultSource()
Returns the result as a document source object. |
java.lang.Object[] |
getResultTypes()
Returns the result types. |
long |
getStructureCount()
Returns the number of all enumerated structures, -1 in case of arithmetical overflow
(if the number would exceed Long.MAX_VALUE). |
java.lang.String |
getStructureID()
Returns the structure ID used in Markush code (enumeration ID) generation. |
Molecule[] |
getStructures()
Returns the enumerated structures. |
java.lang.String |
getTypeString(java.lang.Object type)
Returns a string representation of the given type. |
boolean |
handlesMultiFragmentMolecules()
Returns true if the plugin handles multifragment molecules,
false otherwise. |
boolean |
hasMoreStructures()
Returns true if there are more structures. |
boolean |
isApproximateCount()
Returns true if count is approximate due to multiple position bonds with
multicenters of variable size, false otherwise. |
protected boolean |
isCleanNeeded()
Returns true if clean is needed for GUI display. |
protected boolean |
isFiltered()
Return true if molecule filter is set. |
boolean |
isHomologyEnumerated()
Indicates if homology groups are enumerated or not. |
boolean |
isLicensed()
Returns true if the plugin is licensed. |
boolean |
isRandomEnumeration()
Returns true if random enumeration is requested. |
boolean |
run()
Creates enumerated structures. |
void |
setAlignScaffold(boolean value)
Sets the scaffold aligning mode. |
void |
setColoring(int coloring)
Sets hit coloring options. |
void |
setEnumCodeNeeded(boolean value)
Indicates whether unique Markush enumeration code should be generated. |
void |
setEnumerateHomology(boolean enumerate)
Sets if homology groups should be enumerated or not. |
void |
setFilter(MolFilter filter)
Sets the molecule filter. |
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule. |
void |
setLicenseEnvironment(java.lang.String env)
Sets license environment to be stored. |
void |
setMaxStructureCount(long max)
Sets the maximum number of structures to be generated. |
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin. |
void |
setRandomEnumeration()
Sets random enumeration. |
void |
setStructureID(java.lang.String id)
Sets structure ID to be used in Markush code generation. |
void |
standardize(Molecule mol)
Prevents default standardization: does nothing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final MolFilter FILTER_VALENCE
setFilter(chemaxon.util.MolFilter)
in order to reject molecules with valence errors.
setFilter(chemaxon.util.MolFilter)public static final int COLORING_NONE
public static final int COLORING_SCAFFOLD
public static final int COLORING_RGROUPS
public static final int COLORING_ALL
| Constructor Detail |
|---|
public MarkushEnumerationPlugin()
| Method Detail |
|---|
public boolean isLicensed()
CalculatorPlugintrue if the plugin is licensed. The license checking
is based on the product name, returned by CalculatorPlugin.getProductName().
isLicensed in interface chemaxon.license.LicensableisLicensed in class CalculatorPlugintrue if the plugin is licensedpublic void setLicenseEnvironment(java.lang.String env)
CalculatorPlugin
setLicenseEnvironment in interface chemaxon.license.LicensablesetLicenseEnvironment in class CalculatorPluginenv - environment String to be stored and passed to the LicenseHandler in the isLicensed methodpublic java.lang.String getProductName()
LicenseManager.
getProductName in class CalculatorPluginLicenseManager.MARKUSH_ENUM_PLUGINpublic boolean handlesMultiFragmentMolecules()
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.
Returns true if parameter "single" is set to "false",
false otherwise (default: false).
handlesMultiFragmentMolecules in class CalculatorPlugin
public void setParameters(java.util.Properties params)
throws PluginException
setParameters in class CalculatorPluginparams - is the parameter table
PluginException - on errorpublic void setRandomEnumeration()
CalculatorPlugin.setMolecule(chemaxon.struc.Molecule).
Set also the number of requested structures in setMaxStructureCount(long),
otherwise only one randomly enumerated structure will be generated.
public boolean isRandomEnumeration()
true if random enumeration is requested.
true if random enumeration is requestedpublic void setEnumerateHomology(boolean enumerate)
public boolean isHomologyEnumerated()
public void setEnumCodeNeeded(boolean value)
value - true, if code generation is neededpublic boolean getEnumCodeNeeded()
public void setStructureID(java.lang.String id)
null for no structure ID (default).
Calling this method with non-null argument will automatically switch on
Markush code generation.
id - the tag name or the IDsetEnumCodeNeeded(boolean)public java.lang.String getStructureID()
setStructureID(java.lang.String)public void setFilter(MolFilter filter)
null (get all enumerated structures).
filter - the molecule filter or null for no filteringMolFilter,
FILTER_VALENCEprotected boolean isFiltered()
true if molecule filter is set.
true if molecule filter is setpublic boolean isApproximateCount()
true if count is approximate due to multiple position bonds with
multicenters of variable size, false otherwise.
true if count is approximatepublic void setMaxStructureCount(long max)
-1 for unlimited.
Default: unlimited for the sequential case, 1 for the random case.
Must be called before setting the molecule
in CalculatorPlugin.setMolecule(chemaxon.struc.Molecule).
max - is the maximum number of structures to be generatedsetRandomEnumeration()public void setAlignScaffold(boolean value)
CalculatorPlugin.setMolecule(chemaxon.struc.Molecule).
value - if true, tries to align scaffold in enumerated structures
as it was in the original Markush structurepublic boolean getAlignScaffold()
public void setColoring(int coloring)
CalculatorPlugin.setMolecule(chemaxon.struc.Molecule).
coloring - COLORING_SCAFFOLD, COLORING_RGROUPS,
COLORING_NONE, or COLORING_ALLpublic int getColoring()
COLORING_NONE,
COLORING_SCAFFOLD,
COLORING_RGROUPS,
COLORING_ALLprotected boolean isCleanNeeded()
true if clean is needed for GUI display.
true if clean is needed for GUI display
public void checkMolecule(Molecule mol)
throws PluginException
checkMolecule in class CalculatorPluginmol - is the input molecule
PluginException - with error message for the user if the molecule is refused
protected void setInputMolecule(Molecule mol)
throws PluginException
setInputMolecule in class CalculatorPluginmol - is the input molecule
PluginException - on error
public boolean run()
throws PluginException
run in class CalculatorPlugintrue
PluginException - on errorCalculatorPlugin.getErrorMessage()
public java.math.BigInteger countEnumerations()
throws PluginException
BigInteger.
In case when the result does not exceed Long.MAX_VALUE,
the number of enumerates is also returned by getStructureCount().
PluginException - on expansion errorgetLimitedStructureCount(),
getStructureCount(),
countEnumerationsMagnitude()
public int countEnumerationsMagnitude()
throws PluginException
BigInteger.
PluginException - on expansion errorgetLimitedStructureCount(),
getStructureCount(),
countEnumerations()public long getStructureCount()
-1 in case of arithmetical overflow
(if the number would exceed Long.MAX_VALUE).
To handle the case of arithmetical overflow, call
countEnumerations() or countEnumerationsMagnitude().
Returns the number of structures to be returned in case of random enumeration.
setRandomEnumeration(),
setMaxStructureCount(long),
getLimitedStructureCount(),
countEnumerations(),
countEnumerationsMagnitude()public int getLimitedStructureCount()
getStructureCount()
and the specified maximum (see setMaxStructureCount(long)).
Returns the number of structures to be returned in case of random enumeration.
setRandomEnumeration(),
setMaxStructureCount(long),
getStructureCount()public boolean hasMoreStructures()
true if there are more structures.
true if there are more structurespublic Molecule getNextStructure()
null if no more structures.
public Molecule getNextAromatizedStructure()
public Molecule[] getStructures()
throws PluginException
PluginException - if too many structures
public Molecule[] getAromatizedStructures()
throws PluginException
PluginException - if too many structures
public chemaxon.marvin.plugin.PluginMDocSource getResultSource()
throws PluginException
getResultSource in class CalculatorPluginPluginException - on errorpublic java.lang.Object[] getResultTypes()
getResultTypes in class CalculatorPluginpublic int getResultDomain(java.lang.Object type)
getResultDomain in class CalculatorPlugintype - is the result type
getResultTypes()public int getResultCount(java.lang.Object type)
getResultCount in class CalculatorPlugintype - is the result type
getResultTypes()public java.lang.String getTypeString(java.lang.Object type)
getTypeString in class CalculatorPlugintype - is the type object
public java.lang.Object getResult(java.lang.Object type,
int index)
throws PluginException
getResult in class CalculatorPlugintype - is the result typeindex - is the result index
PluginException - if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.Object getResult(java.lang.Object type,
java.lang.String arg)
throws PluginException
getResult in class CalculatorPlugintype - is the result type ("structures")arg - is the atom string as a '-'-separated list
PluginException - on errorCalculatorPlugin.getResultTypes()
public java.lang.String getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
getResultAsString in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is givenpublic java.lang.String getRemark()
Long.MAX_VALUE),
null otherwise.
getRemark in class CalculatorPlugin
public java.lang.String getLibrarySizeString()
throws PluginException
null in case of random enumeration.
PluginException
public Molecule getResultMolecule()
throws PluginException
MolAtom.getExtraLabel()).
Molecular results are stored in molecule properties
with keys being the result types
(Molecule.getProperty(String)).
getResultMolecule in class CalculatorPluginPluginException - on errorpublic void standardize(Molecule mol)
standardize in class CalculatorPluginmol - is the molecule to be standardized
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||