@PublicAPI public final class MMPAlignment extends java.lang.Object
McsSearchResult.getSimilarity()
does not reach a predefined limit,
shape based Alignment
is applied on the molecule pair.
Example usage: final Molecule reference = MolImporter.importMol("CCCCOC"); final Molecule toAlign = MolImporter.importMol("CCCCNCC"); // Either you can generate 3D coordinates : // Cleaner.clean(reference, 3, ""); // Cleaner.clean(toAlign, 3, ""); // Molecule referenceP = reference; // Molecule toAlignP = toAlign; // or alternatively: boolean beautify = true; final Molecule referenceP = MMPAlignment.preprocess(reference, beautify); final Molecule toAlignP = MMPAlignment.preprocess(toAlign, beautify); // In this latter case the following actions are performed on Molecules: // 1. keep largest fragment, 2. generate 3D coordinates, if the structure is not in 3D, // 3. Additionally, if the "beautify" parameter is true: // - remove atom aliases // - remove lone pairs // - remove explicit Hydrogen atoms // - fix valence errors (needs Checker license) final MMPAlignment mmp = new MMPAlignment(referenceP, toAlignP); final MMPAlignmentResult result = mmp.calculate(); final Molecule aligned = result.getMolecule2Aligned(); System.err.println("3D Tanimoto score: " + result.getShapeScore()); System.err.println("Coordinate RMSD of the MCS after the alignment: " + result.getRmsd()); // Call a simple utility to write Molecule object into mrv format MolGeom.writeMol(result.toMolecule(), "alignedResult.mrv"); }
Constructor and Description |
---|
MMPAlignment(Molecule reference,
Molecule toAlign)
Constructs an MMPAlignment object for later alignment of two structures.
|
MMPAlignment(Molecule reference,
Molecule toAlign,
MMPAlignmentProperties props)
Constructs an MMPAlignment object for later alignment of two structures.
|
Modifier and Type | Method and Description |
---|---|
MMPAlignmentResult |
calculate()
Runs the MCS alignment calculation on the two structures of the
constructor.
|
void |
cancel()
Cancel the ongoing calculation
|
static Molecule |
clean3d(Molecule m)
Utility for preprocessing structure for alignment.
|
static Molecule |
clean3d(Molecule m,
int conformerCount)
Utility for preprocessing structure for alignment.
|
static void |
fixValence(Molecule mol)
Utility for preprocessing structure for alignment.
|
static Molecule |
keepLargestFragment(Molecule m)
Utility for preprocessing structure for alignment.
|
static Molecule |
preprocess(Molecule m,
boolean beautify)
Utility for preprocessing structure for alignment.
|
static void |
removeAtomAliases(Molecule m)
Utility for preprocessing structure for alignment.
|
static void |
removeLonePairs(Molecule m)
Utility for preprocessing structure for alignment.
|
public MMPAlignment(Molecule reference, Molecule toAlign, MMPAlignmentProperties props)
MMPAlignmentProperties.getFlexibilityMode()
. The coordinates of the MCS atoms of
the reference Molecule are transferred to the MCS atoms of the "toAlign" Molecule.
The conformation of the non-MCS parts can be optimized to obtain the best alignment.reference
- The reference structure in the alignment. The coordinates of this structure remains intact during the
alignment, if MMPAlignmentProperties.getFlexibilityMode()
is set to
AlignmentProperties.FlexibilityMode.KEEP_BOTH_RIGID
, AlignmentProperties.FlexibilityMode.KEEP_FIRST_RIGID_SECOND_FLEXIBLE
or AlignmentProperties.FlexibilityMode.KEEP_FIRST_RIGID_SECOND_FLEXIBLE_EXTRA
toAlign
- The structure to align. The coordinates of this structure changes: rotates, translates
as a rigid body, and also the rotatable bonds are tweaked in order to align to the reference structure.props
- Properties to control the alignment process.public MMPAlignment(Molecule reference, Molecule toAlign)
MMPAlignmentProperties.getFlexibilityMode()
. The coordinates of the MCS atoms of
the reference Molecule are transferred to the MCS atoms of the "toAlign" Molecule.
The conformation of the non-MCS parts can be optimized to obtain the best alignment.reference
- The reference structure in the alignment. The coordinates of this structure remains intact during the
alignment, if MMPAlignmentProperties.getFlexibilityMode()
is set to
AlignmentProperties.FlexibilityMode.KEEP_BOTH_RIGID
, AlignmentProperties.FlexibilityMode.KEEP_FIRST_RIGID_SECOND_FLEXIBLE
or AlignmentProperties.FlexibilityMode.KEEP_FIRST_RIGID_SECOND_FLEXIBLE_EXTRA
toAlign
- The structure to align. The coordinates of this structure changes: rotates, translates
as a rigid body, and also the rotatable bonds are tweaked in order to align to the reference structure.public void cancel()
public MMPAlignmentResult calculate()
public static Molecule clean3d(Molecule m)
m
- The 2D input structure.public static Molecule clean3d(Molecule m, int conformerCount)
m
- The 2D input structureconformerCount
- The lowest energy conformer will be selected from maximum
conformerCount diverse conformations.public static void removeAtomAliases(Molecule m)
m
- removes aliases on this instance.public static void removeLonePairs(Molecule m)
m
- removes LP atoms on this instance.public static Molecule keepLargestFragment(Molecule m)
m
- finds the largest fragment of this Moleculepublic static void fixValence(Molecule mol)
ValenceErrorChecker
.mol
- modifies this reference moleculepublic static Molecule preprocess(Molecule m, boolean beautify)
keepLargestFragment(Molecule)
removeAtomAliases(Molecule)
removeLonePairs(Molecule)
m
-