|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchemaxon.marvin.util.MarvinModule
chemaxon.marvin.modules.AutoMapper
public class AutoMapper
AutoMapper
finds the best mapping from reactant side atoms
to product side atoms of a reaction. The term mapping refers to the association of
of reactant side atoms to product side atoms.
AutoMapper
supports various mapping styles that are compatible with
other vendors mappng approaches.
By default only
changing atoms are mapped, this mapping style is the CHEMAXON
style.
The reaction to be mapped is passed as an RxnMolecule
and it may contain
initial atom maps. These predefined atom maps are preserved by AutoMapper
.
Simple usage example:
AutoMapper mapper = new AutoMapper(); Molecule mol = MolImporter.importMol( "C1CCCCC1=O>>C1COC2(CCCCC2)O1" ); RxnMolecule rm = RxnMolecule.getReaction( mol ); mapper.map( rm ); System.out.println( mol.toFormat( "smiles" ) );
Field Summary | |
---|---|
static int |
BEST
slowest maping but better quality mapping |
static int |
CHANGING
Only those atoms are mapped that have chaning bond. |
static int |
CHEMAXON
Reaction is mapped according to ChemAxon's style. |
static int |
COMPLETE
all atoms in the reaction are mapped |
static int |
DAYLIGHT
Daylight style mapping, orphan/widow atoms are not mapped. |
static double |
DEFAULT_COMPLEXITY_THRESHOLD
maximum number of steps allowed in non-mcs matching |
static int |
DEFAULT_MAPPING_STRATEGY
golden middle |
static int |
DEFAULT_MAPPING_STYLE
By default, changing atoms are mapped. |
static long |
DEFAULT_STEP_LIMIT
by default there is no limitation on the number of steps performed |
static int |
EITHER
Mapping style of the input reaction is ambigous |
static int |
FASTEST
heuristic mode, fast but less accurate |
static int |
MATCHING
Only matching atoms are mapped. |
static int |
ORPHANS
missing orphan/widow atom maps are added only |
static int |
STANDARD
good balance between speed and accuracy |
static int |
STOP_BADARGSINMODFUNC
bad paramters passed to modfunc() |
static int |
STOP_FOUND
mapping stopped with an optimal solution |
static int |
STOP_NOTFOUND
no solution found |
static int |
STOP_STEPLIMIT
mapping stopped because maximum allowed step count reached, no optimal solution found |
static int |
STOP_TIMELIMIT
maximum allowed time exceeded, no optimum solution has been found |
static int |
STOP_UNKONW
mapping stopped for an unknown reason |
static int |
UNKNOWN
Mapping style of a pre-mapped reaction cannot be determined |
static int |
UNMAPPED
Reaction is not mapped |
Fields inherited from class chemaxon.marvin.util.MarvinModule |
---|
moduleLoadingCounterLock |
Constructor Summary | |
---|---|
AutoMapper()
Creates a new instance of AutoMapper. |
Method Summary | |
---|---|
static void |
clearMaps(RxnMolecule mol)
Clears atom maps. |
protected void |
dump()
Engineering function. |
java.lang.String |
getDiagnosticMessage(int diagLevel)
Returns a short text message that discribes the outcome of the last search. |
int |
getlastStopCause()
Returns the code of the last termination status. |
int |
getMapCount()
Get number of solution maps found. |
int |
guessMappingStyle(RxnMolecule reaction)
Guesses mapping style of the input reaction. |
static void |
main(java.lang.String[] args)
For engineering purposes only. |
static void |
map(Molecule mol,
int mappingStyle)
Maps the input molecule according to the given mapping style. |
int |
map(RxnMolecule reaction)
Convenience function that unifies setReaction() and
setMap() in one method. |
int |
map(RxnMolecule reaction,
boolean mapAlways)
Convenience function that unifies setReaction() and
setMap() in one method. |
static void |
mapReaction(RxnMolecule reaction)
Convenience function that unifies setReaction() and
setMap() in one method. |
java.lang.Object |
modfunc(java.lang.Object arg)
Mandatory method to be implemented by Marvin modules. |
void |
setComplexityThreshold(float newThreshold)
Sets the complexity threshold. |
void |
setForbiddenMap(int mapId)
The given atom map id should not be assigned to any atom. |
void |
setIgnoreH(boolean ignoreH)
Turns hydrogen mapping on or off. |
void |
setMap(int mapId)
Sets atom-atom maps in the RxnMolecule passed in
according to the mapId map. |
void |
setMappingMode(int mappingMode)
Deprecated. Use setMappingStyle(int) instead. |
void |
setMappingStrategy(int newStrategy)
Sets the mapping strategy. |
void |
setMappingStyle(int mappingStyle)
Sets the mapping style to be used in consequent reaction mappings. |
boolean |
setOption(java.lang.String parameterName,
java.lang.String parameterValue)
Sets any options using string parameter names and string values. |
void |
setReaction(RxnMolecule rm)
Sets the current reaction to be mapped. |
void |
setStepCountLimit(long maxNumberOfSteps)
Sets the maximum number of atomic search steps allowed. |
void |
setTimeLimit(long maxMilliseconds)
Sets the maximum allowed total search time. |
Methods inherited from class chemaxon.marvin.util.MarvinModule |
---|
getSomething, isModuleLoadingInProgress, load, load, load, loadClass, loadClass, shutdownLoader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ORPHANS
public static final int COMPLETE
public static final int DAYLIGHT
public static final int CHANGING
public static final int UNKNOWN
public static final int UNMAPPED
public static final int EITHER
public static final int CHEMAXON
CHANGING
.
public static final int MATCHING
public static final int DEFAULT_MAPPING_STYLE
public static final int FASTEST
public static final int STANDARD
public static final int BEST
public static final int DEFAULT_MAPPING_STRATEGY
public static final double DEFAULT_COMPLEXITY_THRESHOLD
public static final long DEFAULT_STEP_LIMIT
public static final int STOP_UNKONW
public static final int STOP_FOUND
public static final int STOP_STEPLIMIT
public static final int STOP_NOTFOUND
public static final int STOP_TIMELIMIT
public static final int STOP_BADARGSINMODFUNC
modfunc()
Constructor Detail |
---|
public AutoMapper()
AutoMapper
object for each reaction to be
mapped. Reusing a previously created AutoMapper
objects
is beneficial in terms of memory allocations thus memory size and running
times.
Method Detail |
---|
public static void map(Molecule mol, int mappingStyle) throws chemaxon.marvin.modules.AutoMapperException
mol
- molecule to be mappedmappingStyle
- specifies which kind of atoms are mapped and how (all, changing only etc.)
chemaxon.marvin.modules.AutoMapperException
MATCHING
,
CHANGING
,
ORPHANS
,
COMPLETE
public void setMappingStyle(int mappingStyle)
mappingStyle
- specifies which kind of atoms are mapped (all, changing only etc.)MATCHING
,
CHANGING
,
ORPHANS
,
COMPLETE
public void setMappingMode(int mappingMode)
mappingMode
- the mapping styleMATCHING
,
CHANGING
,
ORPHANS
,
COMPLETE
public void setMappingStrategy(int newStrategy)
newStrategy
- mapping strategy to be applied in subsequent mappingspublic void setIgnoreH(boolean ignoreH)
ignoreH
- if true, hydrogen atoms are not mapped.public void setComplexityThreshold(float newThreshold)
newThreshold
- new complexity threshold valuepublic void setStepCountLimit(long maxNumberOfSteps)
maxNumberOfSteps
- maximum number of allowed elementary search stepspublic void setTimeLimit(long maxMilliseconds)
maxMilliseconds
- maximum allowed mapping tim ei n millisecondspublic boolean setOption(java.lang.String parameterName, java.lang.String parameterValue)
set*()
methods in one method. setMappingStyle
and setTimeLimit
are available via this convenience method.
parameterName
- name of parameter to be changed, identical to the orignal set*
method name without the "set" prefixparameterValue
- new value of the specified parameter
public void setReaction(RxnMolecule rm) throws chemaxon.marvin.modules.AutoMapperException
MAX_MAP_STORED
) of solutions.
Note, that the reaction to be automapped can already have some atoms
mapped upfron calling this method. These are preserved during
automapping. However, this mapping has to idempotent (which means that
values should range from 1 to n on both sides and each and every value
has to be mapped to one value only).
rm
- reaction to be automapped, not cloned
chemaxon.marvin.modules.AutoMapperException
- when input reazction is too big (has more
than MAX_FRAGMENT reactant or product fragments)public int getlastStopCause()
STOP_UNKONW
,
STOP_FOUND
,
STOP_NOTFOUND
,
STOP_STEPLIMIT
,
STOP_TIMELIMIT
public java.lang.String getDiagnosticMessage(int diagLevel)
diagLevel
- detail of explanatoin: 0, no explanation; 1, reports running time; 1<, running time and "last stop cause"
public int guessMappingStyle(RxnMolecule reaction)
1. Is the input molecule mapped? 1.1 No -> UNMAPPED 1.2 Yes (go to 2.) 2. Remove existing maps from the clone the input molecule 3. Automap the clone (full) 4. Compare the original mapping to the mapping of the clone (pairwise): 4.1 There is at least a non matching pair -> UNKNOWN mapping 4.2 Allpairs are matching (go to 5.) 5. Is there an orphan atom in the clone (atom without pair) 5.1 Yes. Are they mapped? 5.1.1 All mapped in the original molecule -> CHEMAXON mapping 5.1.2 None of them are mapped in the original molecule -> DAYLIGHT mapping 5.1.3 Some -> UNKNOWN mapping 5.2 No. Are there any unmapped atom in the original molecule? 5.3.1 No. -> EITHER mapping 5.3.2 Yes -> CHEMAXON mapping
reaction
- input reaction
CHEMAXON
, DAYLIGHT
, UNKNOWN
, COMPLETE
,
UNMAPPED
public java.lang.Object modfunc(java.lang.Object arg)
setOption(String,String)
)
map
, setForbiddenMap
, setOption
.
corresponding arguements: map
takes and RxnMolecule
, setForbiddenMap
akes
one atom index (referring to the reaction molecule), setOption
uses various string parameters as
described in setOption(String,String)
.
Actions strings and their corresponding arguments are passed in an Object array, see parameter descriptiopn below.
modfunc
in class chemaxon.marvin.util.MarvinModule
arg
- it is interpreted as an array of Objects, the first element of this array is the name of the command
(see description above), succeeding array elements are the arguments of the commandpublic void setForbiddenMap(int mapId)
setReacition()
, map
and mapReaction
in order to take effect.
mapId
- map index not to be assigned to any atompublic int map(RxnMolecule reaction) throws chemaxon.marvin.modules.AutoMapperException
setReaction()
and
setMap()
in one method. The parameters molecule is
both input and output variable: on output all of its atoms are
mapped. Atom maps that exists on input are preserved.
This method does not clear forbidden map indices set by
setForbiddenMap()
.
reaction
- the reaction molecule to be mapped
chemaxon.marvin.modules.AutoMapperException
- when no valid map was found or the input
reaction consists of too many fragments (see setReaction( final RxnMolecule rm )
)public int map(RxnMolecule reaction, boolean mapAlways) throws chemaxon.marvin.modules.AutoMapperException
setReaction()
and
setMap()
in one method. The parameters molecule is
both input and output variable: on output all of its atoms are
mapped. Atom maps that exists on input are preserved.
This method does not clear forbidden map indices set by
setForbiddenMap()
.
reaction
- the reaction molecule to be mappedmapAlways
- if set to false, maps are only added to original reaction if an optimal solution was found;
otherwise maps are always added (if any solution is found at all)
chemaxon.marvin.modules.AutoMapperException
- when no valid map was found or the input
reaction consists of too many fragments (see setReaction( final RxnMolecule rm )
)public static void mapReaction(RxnMolecule reaction) throws chemaxon.marvin.modules.AutoMapperException
setReaction()
and
setMap()
in one method. The parameters molecule is
both input and output variable: on output all of its atoms are
mapped. Atom maps that exists on input are preserved.
This method does not clear forbidden map indices set by
setForbiddenMap()
.
reaction
- the reaction molecule to be mapped
chemaxon.marvin.modules.AutoMapperException
- when no valid map was found or the input
reaction consists of too many fragments (see setReaction( final RxnMolecule rm )
)public int getMapCount()
MAX_MAP_STORED
best mappings.
public void setMap(int mapId)
RxnMolecule
passed in
setReaction( final
RxnMolecule rm )
according to the mapId
map.
mapId
- index of a map, between and getMapCount() - 1
protected void dump()
public static void clearMaps(RxnMolecule mol)
mol
- is the reaction whose atom maps are clearedpublic static void main(java.lang.String[] args)
args
- either one filename of reaction molecules or empty
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |