Package org.openscience.cdk.hash
Class HashGeneratorMaker
java.lang.Object
org.openscience.cdk.hash.HashGeneratorMaker
Fluent API for creating hash generators. The maker is first configured with
one or more attributes. Once fully configured the generator is made by
invoking
Examples
atomic()
, molecular()
or ensemble()
. The
order of the built-in configuration methods does not matter however when
specifying custom encoders with encode(AtomEncoder)
the order they
are added is the order they will be used. Therefore one can expect different
hash codes if there is a change in the order they are specified.
Examples
// simple MoleculeHashGenerator generator = new HashGeneratorMaker().depth(16) .elemental() .molecular(); // fast MoleculeHashGenerator generator = new HashGeneratorMaker().depth(8) .elemental() .isotopic() .charged() .orbital() .molecular(); // comprehensive MoleculeHashGenerator generator = new HashGeneratorMaker().depth(32) .elemental() .isotopic() .charged() .chiral() .perturbed() .molecular();
- Author:
- John May
- Source code:
- main
- Belongs to CDK module:
- hash
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatomic()
Given the current configuration create anAtomHashGenerator
.charged()
Discriminate protonation states.chiral()
Generate different hash codes for stereoisomers.depth
(int depth) Specify the depth of the hash generator.Discriminate elements.encode
(AtomEncoder encoder) Add a custom encoder to the hash generator which will be built.ensemble()
Given the current configuration create anEnsembleHashGenerator
.isotopic()
Discriminate isotopes.Given the current configuration create anMoleculeHashGenerator
.orbital()
Discriminate atomic orbitals.Discriminate atoms experiencing uniform environments.radical()
Discriminate free radicals.Suppress any explicit hydrogens in the encoding of hash values.
-
Constructor Details
-
HashGeneratorMaker
public HashGeneratorMaker()
-
-
Method Details
-
depth
Specify the depth of the hash generator. Larger values discriminate more molecules.- Parameters:
depth
- how deep should the generator hash- Returns:
- reference for fluent API
- Throws:
IllegalArgumentException
- if the depth was less then zero
-
elemental
Discriminate elements.- Returns:
- fluent API reference (self)
- See Also:
-
isotopic
Discriminate isotopes.- Returns:
- fluent API reference (self)
- See Also:
-
charged
Discriminate protonation states.- Returns:
- fluent API reference (self)
- See Also:
-
orbital
Discriminate atomic orbitals.- Returns:
- fluent API reference (self)
- See Also:
-
radical
Discriminate free radicals.- Returns:
- fluent API reference (self)
- See Also:
-
chiral
Generate different hash codes for stereoisomers. The currently supported geometries are:- Tetrahedral
- Double Bond
- Cumulative Double Bonds
- Returns:
- fluent API reference (self)
-
suppressHydrogens
Suppress any explicit hydrogens in the encoding of hash values. The generation of hashes acts as though the hydrogens are not present and as such preserves stereo-encoding.- Returns:
- fluent API reference (self)
-
perturbed
Discriminate atoms experiencing uniform environments. This method usesMinimumEquivalentCyclicSet
to break symmetry but depending on application one may need a more comprehensive method. Please refer toperturbWith(EquivalentSetFinder)
for further configuration details.- Returns:
- fluent API reference (self)
- See Also:
-
MinimumEquivalentCyclicSet
perturbWith(EquivalentSetFinder)
-
encode
Add a custom encoder to the hash generator which will be built. Although not enforced, the encoder should be stateless and should not modify any passed inputs.- Parameters:
encoder
- an atom encoder- Returns:
- fluent API reference (self)
- Throws:
NullPointerException
- no encoder provided
-
ensemble
Given the current configuration create anEnsembleHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-
molecular
Given the current configuration create anMoleculeHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-
atomic
Given the current configuration create anAtomHashGenerator
.- Returns:
- instance of the generator
- Throws:
IllegalArgumentException
- no depth or encoders were configured
-