com.actelion.research.chem.sar.SARMoleculeData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openchemlib Show documentation
Show all versions of openchemlib Show documentation
Open Source Chemistry Library
package com.actelion.research.chem.sar;
import com.actelion.research.chem.Canonizer;
import com.actelion.research.chem.IDCodeParser;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.StereoMolecule;
import java.util.ArrayList;
public class SARMoleculeData {
private StereoMolecule mMol,mBuffer;
private ScaffoldData mScaffoldData;
private String[] mSubstituent;
private int[] mSubstituentBondOrder;
private boolean[] mSubstituentConnectsBack;
protected SARMoleculeData(StereoMolecule mol, ScaffoldData scaffoldData, int[] molToCoreAtom, StereoMolecule buffer) {
mMol = mol;
mScaffoldData = scaffoldData;
mBuffer = buffer;
buildSubstituents(molToCoreAtom);
}
public ScaffoldData getScaffoldData() {
return mScaffoldData;
}
public String[] getSubstituents() {
return mSubstituent;
}
protected void clear() {
mScaffoldData = null;
}
protected void checkSubstituents() {
for (int exitVectorIndex=0; exitVectorIndex backConnectionList = new ArrayList<>();
isSubstituentAtom[rootAtom] = true;
isSubstituentAtom[exitVectorAtom] = true;
isSubstituentBond[rootBond] = true;
workAtom[0] = rootAtom;
workAtom[1] = exitVectorAtom;
int current = 1;
int highest = 1;
while (current <= highest) {
for (int i=0; i=0; bond--)
if (mBuffer.getAtomicNo(mBuffer.getBondAtom(0, bond)) == 0
&& mBuffer.getAtomicNo(mBuffer.getBondAtom(1, bond)) == 0)
mBuffer.deleteBond(bond);
mSubstituent[exitVectorIndex] = new Canonizer(mBuffer, Canonizer.ENCODE_ATOM_CUSTOM_LABELS).getIDCode();
mSubstituentBondOrder[exitVectorIndex] = mMol.getBondOrder(rootBond);
}
/**
* In case of substituent atom connecting back to the core structure, the exit vector index is encoded as label
* in the substituent idcode.
* This is needed within the check for varying substituents, because of the label chains with inverted direction
* are recognized as different substituents. Also, otherwise equal chains that connect back to different exit
* vectors are also recognized as being different.
* After the check for varying substituents and once we have a mapping from exit vector index to R-group index,
* we need to exchange the label by a new one with the R-Group index, which should be finally displayed to the user.
*/
protected void correctSubstituentRingClosureLabels() {
if (mSubstituentConnectsBack != null) {
for (int exitVectorIndex=0; exitVectorIndex
© 2015 - 2025 Weber Informatics LLC | Privacy Policy