@PublicAPI public class CleanUtil extends java.lang.Object implements HybridizationStateConsts
HS_S, HS_SP, HS_SP2, HS_SP3, HS_UNKNOWN
Constructor and Description |
---|
CleanUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
arrangeComponents(MoleculeGraph mol)
Arranges molecule components (reactants, agents, products,
R-group definitions) nicely.
|
static boolean |
arrangeComponents(MoleculeGraph mol,
boolean obj)
Arranges molecule components (reactants, agents, products,
R-group definitions, data, brackets) nicely.
|
static boolean |
arrangeComponents(MoleculeGraph mol,
boolean obj,
boolean frags)
Arranges molecule components (reactants, agents, products,
R-group definitions, data, brackets) nicely.
|
static void |
arrangeDataSgroupData(MoleculeGraph m)
Arrange data attached to DataSgroup.
|
static void |
arrangeMolecules(MoleculeGraph[] mo,
int dist,
int col)
Arrange molecules nicely
If we have more molecules try to arrange them in a
2D square lattice.
|
static void |
arrangeReaction(RxnMolecule m)
Arranges reaction components nicely
|
static void |
arrangeRelativeDataSgroupData(MoleculeGraph m)
Arrange data attached to DataSgroup.
|
static void |
arrangeSgBrackets(MoleculeGraph m)
Arrange sgroup brackets in the molecule.
|
static double |
calcBadness(MoleculeGraph mol1,
MoleculeGraph mol2,
MolAtom sa,
MolBond[] xbonds)
Calculates a "badness" value for the atomic coordinates.
|
static DPoint3[] |
calcBracketEndPoints(DPoint3[] q,
DPoint3 p1,
double c)
Calculates the bracket endpoints from the base line of the bracket.
|
static DPoint3 |
calcDividingPoint(DPoint3 p1,
DPoint3 p2,
double k)
Calculates the division point of a segment with a given ratio.
|
static DPoint3[] |
calcSimplePolymerBracket(DPoint3 p1,
DPoint3 p2,
double ratio)
Calculates the points of a simple polymer bracket that belongs to a bond.
|
static void |
createBracket(Sgroup sg,
DPoint3[] q,
int btype) |
static CTransform3D |
createRotationAboutBond(MolBond b,
double phi)
Creates a rotation transformation about a bond.
|
static double[] |
createSavedCoordsArray(MoleculeGraph g)
Creates an empty array for the atomic coordinates of a structure.
|
static void |
generateBracketCoords(Sgroup sg,
int btype)
Generates brackets with coordinates for a specified S-group.
|
static void |
generateBracketCoords(Sgroup sg,
int btype,
boolean extraSpace)
Generates brackets with coordinates for a specified S-group.
|
static boolean |
hasWiggly(MolAtom a)
Check if at least one wiggly bond starts from this atom.
|
static boolean[] |
isNonPreferredStereoAtom(MoleculeGraph m)
Check if the atoms in the molecule is in SP2 hybridization state and
has wedge whose getAtom1 is the specified atom, but wiggly
bonds next to double bonds are allowed.
|
static boolean |
removeCTflagFromSmallRings(MoleculeGraph m)
Remove CIS|TRANS flag from bonds in rings smaller than size 8.
|
static void |
restoreCoords(MoleculeGraph g,
double[] coords)
Restores atomic coordinates.
|
static void |
saveCoords(MoleculeGraph g,
double[] coords)
Saves atomic coordinates.
|
static void |
setBestLigandPosition(MolAtom atom,
MolAtom ligand)
Calculates and sets an optimal position for a ligand atom.
|
static void |
setBestLigandPosition(MolAtom atom,
MolAtom ligand,
double bondlength)
Calculates and sets an optimal position for a ligand atom.
|
static void |
setCTCrossedBond(MoleculeGraph m)
Convert wiggly type double bonds to crossed.
|
static boolean |
setCTWigglyBond(MoleculeGraph m)
Convert crossed double bonds to wiggly type.
|
static boolean |
setCTWigglyBond(MoleculeGraph m,
int bond)
Convert crossed double bond to wiggly type.
|
static double |
sumDistanceSquare(MoleculeGraph mol,
DPoint3 p)
Calculates the sum of the distance square for each atom from a point.
|
public static boolean arrangeComponents(MoleculeGraph mol)
mol
- the moleculetrue
if components have been rearranged,
false
if no components foundpublic static boolean arrangeComponents(MoleculeGraph mol, boolean obj)
mol
- the moleculeobj
- also arrange other object attached to the molecule
(like data, brackets)true
if components have been rearranged,
false
if no components foundpublic static boolean arrangeComponents(MoleculeGraph mol, boolean obj, boolean frags)
mol
- the moleculeobj
- also arrange other object attached to the molecule
(like data, brackets)frags
- also arrange fragments in root / main moleculetrue
if components have been rearranged,
false
if no components foundpublic static void arrangeReaction(RxnMolecule m)
m
- the reaction moleculepublic static void arrangeMolecules(MoleculeGraph[] mo, int dist, int col)
mo
- moleculesdist
- use CCLENGTH distance for the moleculescol
- number of colums (if -1 calculate it)public static void arrangeDataSgroupData(MoleculeGraph m)
public static void arrangeRelativeDataSgroupData(MoleculeGraph m)
m
- moleculepublic static void arrangeSgBrackets(MoleculeGraph m)
m
- moleculepublic static double sumDistanceSquare(MoleculeGraph mol, DPoint3 p)
mol
- the moleculep
- the pointpublic static double calcBadness(MoleculeGraph mol1, MoleculeGraph mol2, MolAtom sa, MolBond[] xbonds)
mol1
- the original moleculemol2
- the transformed substructuresa
- additional transformed atom or nullxbonds
- additional bonds between mol1 and mol2, or nullpublic static double[] createSavedCoordsArray(MoleculeGraph g)
g
- the structurepublic static void saveCoords(MoleculeGraph g, double[] coords)
g
- the structurecoords
- array for the coordinatespublic static void restoreCoords(MoleculeGraph g, double[] coords)
g
- the structurecoords
- array containing the coordinatespublic static CTransform3D createRotationAboutBond(MolBond b, double phi)
b
- the bondphi
- rotation anglepublic static boolean setCTWigglyBond(MoleculeGraph m)
m
- moleculepublic static boolean setCTWigglyBond(MoleculeGraph m, int bond)
m
- a molecule that contains a double bond to convert it to a wiggly
represented up-o-down stereo double bondbond
- the index of the double bond topublic static boolean hasWiggly(MolAtom a)
a
- atompublic static void setCTCrossedBond(MoleculeGraph m)
m
- moleculepublic static boolean[] isNonPreferredStereoAtom(MoleculeGraph m)
m
- moleculepublic static boolean removeCTflagFromSmallRings(MoleculeGraph m)
m
- moleculepublic static void setBestLigandPosition(MolAtom atom, MolAtom ligand)
atom
- the atom whose ligand atom's position is calculatedligand
- the ligand atom whoose optimal position is calculatedpublic static void setBestLigandPosition(MolAtom atom, MolAtom ligand, double bondlength)
atom
- the atom whose ligand atom's position is calculatedligand
- the ligand atom whoose optimal position is calculatedbondlength
- the requested bond length between the atom and its ligand, use -1 for
automatic bond length determination according atom types.public static DPoint3[] calcBracketEndPoints(DPoint3[] q, DPoint3 p1, double c)
q
- endpoints of the base line in the bracket.p1
- point to fix the plane in which the bracket endpoints will be.c
- expected length of the bracket internal segmentpublic static DPoint3 calcDividingPoint(DPoint3 p1, DPoint3 p2, double k)
p1
- the first endpoint of the segmentp2
- the second endpoint of the segmentk
- the ratiopublic static DPoint3[] calcSimplePolymerBracket(DPoint3 p1, DPoint3 p2, double ratio)
p1
- endpoint of the bond that belongs to the sgroupp2
- the other endpoint of the bondRepeatingUnitSgroup
public static void generateBracketCoords(Sgroup sg, int btype)
sg
- the S-group to generate the brackets and coordinates forbtype
- the type of the brackets to generateMBracket.T_ROUND
,
MBracket.T_SQUARE
public static void generateBracketCoords(Sgroup sg, int btype, boolean extraSpace)
sg
- the S-group to generate the brackets and coordinates forbtype
- the type of the brackets to generateextraSpace
- calculate with extra space at atom labelsMBracket.T_ROUND
,
MBracket.T_SQUARE