|
|||||||||
| 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 ...
}
}
// OR
// 3. Print out some random enumerated structures
for (int i = 0; i < 10; i++) {
Molecule m = plugin.getRandomStructure();
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 (default). |
| 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, 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 of the number of all enumerated structures, no arithmetic overflow because counts in BigInteger. |
boolean |
getAlignScaffold()
Gets the scaffold aligning mode |
Molecule[] |
getAromatizedStructures()
Returns the enumerated structures in aromatized form. |
int |
getColoring()
Returns the hit coloring options. |
boolean |
getEnumIDNeeded()
Tests whether unique Markush enumeration ID should be generated |
protected 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. |
Molecule |
getRandomStructure()
Returns a randomly selected enumerated structure |
Molecule[] |
getRandomStructures(int n)
Returns the given number of randomly selected enumerated structures. |
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 if arithmetical overflow (exceeds Long.MAX_VALUE). |
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 |
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 |
setEnumIDNeeded(boolean value)
Indicates whether unique Markush enumeration ID should be generated |
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 |
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
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. Implement this only if you want to sell your plugin and
protect it with a license key. The default implementation always returns true which means that
the plugin is free: no license key is required. This method returns only information about the licensing,
license checking has to be implemented separately.
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 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()
public boolean isRandomEnumeration()
true if random enumeration is requested.
true if random enumeration is requestedpublic void setEnumIDNeeded(boolean value)
value - true, if ID generation is neededpublic boolean getEnumIDNeeded()
public void setFilter(MolFilter filter)
FILTER_VALENCE (accepts the molecules with no valence error).
Set this to null to get all enumerated structures.
filter - the molecule filter or null for no filteringMolFilterprotected 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.
max - is the maximum number of structures to be generatedpublic void setAlignScaffold(boolean value)
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)
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.
PluginException - on expansion error
public int countEnumerationsMagnitude()
throws PluginException
BigInteger.
PluginException - on expansion errorpublic long getStructureCount()
-1 if arithmetical overflow (exceeds Long.MAX_VALUE).
Returns the number of structures to be returned in case of random enumeration.
#setRandomMode(),
setMaxStructureCount(long),
ExpansionCounter.countExpansionsLarge(),
ExpansionCounter.countExpansionsMagnitude()public int getLimitedStructureCount()
getStructureCount()
and the specified maximum (see setMaxStructureCount(long)).
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 getRandomStructure()
public Molecule[] getRandomStructures(int n)
n - the number of random molecules to return
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
protected 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 | ||||||||