Class StandardizerWrappers
- java.lang.Object
-
- com.chemaxon.overlap.io.StandardizerWrappers
-
@Beta @PublicAPI public final class StandardizerWrappers extends Object
Provide utility methods forStandardizerWrapper
.Please note that the
ThreadLocal
based thread safety fix might lead to unexpected memory leaks when worker threads invoking the provided wrappers are pooled. To mitigate this problem make the reference to the wrapper inacessable allowing the garbage collector to free the thread local copies up.Note that an alternative approach would be to implement a
TODO: investigate the possibility to implement some expiring cache to drop (and if necessary, re-inti) ThreadLocals. TODO: Maybe ExpiringThreadLocal(timeout)? to mitigate this issue?Closeable
semantics to allow explicitly freeing up the copies, however this is currently considered not viable.- See Also:
-
http://www.javacodegeeks.com/2013/01/how-to-shoot-yourself-in-foot-with-threadlocals.html,
http://stackoverflow.com/questions/817856/when-and-how-should-i-use-a-threadlocal-variable
Please note that this interface is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StandardizerWrapper
aromatizeBasic()
Wrap basic aromatization.static StandardizerWrapper
aromatizeGeneral()
Wrap general aromatization.static StandardizerWrapper
aromatizeLoose()
Wrap loose aromatization.static StandardizerWrapper
chainOf(StandardizerWrapper... s)
Create a chained wrapper.static StandardizerWrapper
fromStandardizer(Standardizer standardizer)
Extract actions from aStandardizer
instance.static StandardizerWrapper
fromStandardizerCfgLocation(String cfglocation)
Wrap aStandardizer
with config file location.static StandardizerWrapper
fromStandardizerConfigXml(String configXml)
Wrap aStandardizer
with config XML location.static StandardizerWrapper
identityStandardizer()
Identity standardization.static StandardizerWrapper
removeAllExplicitH()
Remove all explicit H atoms.static StandardizerWrapper
removeSmallFragments()
Remove small fragments (disconnected components).
-
-
-
Method Detail
-
fromStandardizerCfgLocation
public static StandardizerWrapper fromStandardizerCfgLocation(String cfglocation)
Wrap aStandardizer
with config file location.The returned wrapper uses
ThreadLocal
clones of the suppliedStandardizer
. For details seefromStandardizer(chemaxon.standardizer.Standardizer)
- Parameters:
cfglocation
- Config file location- Returns:
- Wrapped and initialzied Standardizer
- Throws:
IllegalArgumentException
- upon initialization proble,
-
fromStandardizerConfigXml
public static StandardizerWrapper fromStandardizerConfigXml(String configXml)
Wrap aStandardizer
with config XML location.The returned wrapper uses
ThreadLocal
clones of the suppliedStandardizer
. For details seefromStandardizer(chemaxon.standardizer.Standardizer)
The returned wrapper is serializable and thread safe. Apart from the
ThreadLocal
storage state it is immutable.- Parameters:
configXml
- Configuration file location- Returns:
- Wrapped and initialzied Standardizer
- Throws:
IllegalArgumentException
- upon initialization proble,
-
fromStandardizer
public static StandardizerWrapper fromStandardizer(Standardizer standardizer)
Extract actions from aStandardizer
instance. Note that only the following actions are supported:AromatizeAction
maps toStandardizerWrappers.Aromatize
RemoveExplicitHydrogensAction
maps toStandardizerWrappers.RemoveExplicitH
- Parameters:
standardizer
- Standardizer to extract enabled actions- Returns:
- Wrapper
- Throws:
IllegalArgumentException
- when non supported action found or a not valid (StandardizerAction.isValid()
) action found
-
identityStandardizer
public static StandardizerWrapper identityStandardizer()
Identity standardization.- Returns:
- Wrapper doing nothing
-
chainOf
public static StandardizerWrapper chainOf(StandardizerWrapper... s)
Create a chained wrapper.- Parameters:
s
- Steps- Returns:
- Chained wrapper
-
aromatizeBasic
public static StandardizerWrapper aromatizeBasic()
Wrap basic aromatization.- Returns:
- Wrapper
-
aromatizeGeneral
public static StandardizerWrapper aromatizeGeneral()
Wrap general aromatization.- Returns:
- Wrapper
-
aromatizeLoose
public static StandardizerWrapper aromatizeLoose()
Wrap loose aromatization.- Returns:
- Wrapper
-
removeAllExplicitH
public static StandardizerWrapper removeAllExplicitH()
Remove all explicit H atoms. DelegatesHydrogenize.convertExplicitHToImplicit(chemaxon.struc.MoleculeGraph, int)
withflags
valueMolAtom.ALL_H
to remove all explicit H atoms. This includes lonely, h-bonded, isotope, charged and others, for details see documentation ofHydrogenize.convertExplicitHToImplicit(chemaxon.struc.MoleculeGraph, chemaxon.struc.MolAtom[], int, boolean)
.- Returns:
- Wrapper
-
removeSmallFragments
public static StandardizerWrapper removeSmallFragments()
Remove small fragments (disconnected components). Implicit H atoms are also considered. When multiple largest fragments )having the same size) are found the behavior is not specified currently.- Returns:
- Wrapper
-
-