//package insilico.core.descriptor.nestle; import insilico.core.descriptor.Descriptor; import insilico.core.descriptor.weight.QuantumNumber; import insilico.core.molecule.InsilicoMolecule; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.Molecule; import org.openscience.cdk.RingSet; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; /** * Custom descriptors and fixes (to be compliant with older Dragon version). * * @author Alberto Manganaro (a.manganaro@kode-solutions.net) */ public class CustomDescriptors { public double nHM; public double RBN; public double Hy; public double N_MlogP_Correction; public CustomDescriptors(InsilicoMolecule mol) { // Hydrophilic factor Hy = Hy(mol); // no. heavy atoms as in Dragon 5 nHM = 0; // no. of rotatable bonds as in Dragon 5 RBN = 0; // >n- correction for MLogP N_MlogP_Correction = 0; try { for (IAtom CurAt : mol.GetStructure().atoms()) { if (CurAt.getSymbol().equalsIgnoreCase("Si") || CurAt.getSymbol().equalsIgnoreCase("Cu") || CurAt.getSymbol().equalsIgnoreCase("Ag") || CurAt.getSymbol().equalsIgnoreCase("Cd") || CurAt.getSymbol().equalsIgnoreCase("Sn") || CurAt.getSymbol().equalsIgnoreCase("Hg") || CurAt.getSymbol().equalsIgnoreCase("Pb") || CurAt.getSymbol().equalsIgnoreCase("Bi") || CurAt.getSymbol().equalsIgnoreCase("As")) nHM++; } } catch (Exception e) { nHM = -999; } try { double[][] ConnAugMatrix = mol.GetMatrixConnectionAugmented(); int nSK = ConnAugMatrix.length; RingSet rings = mol.GetSSSR(); for (int i=0; i 0) { n_vd++; if (ConnAugMatrix[j][j] == 7) if (mol.GetStructure().getAtom(j).getFlag(CDKConstants.ISAROMATIC)) nn = true; } } if ( (n_vd == 3) && (!nn)) { N_MlogP_Correction++; } } } } } catch (Exception e) { RBN = -999; } } private int calculateVD(double[][] ConnAugMatrix, int Atom) { int nSK = ConnAugMatrix.length; int VD = 0; for (int i=0; i 0) VD++; } return VD; } private boolean checkAmide(double[][] ConnAugMatrix, int Atom1, int Atom2) { int nSK = ConnAugMatrix.length; if ( ( (ConnAugMatrix[Atom1][Atom1] == 6) && (ConnAugMatrix[Atom2][Atom2] == 7) ) || ( (ConnAugMatrix[Atom1][Atom1] == 7) && (ConnAugMatrix[Atom2][Atom2] == 6) ) ){ int Carbon = ConnAugMatrix[Atom1][Atom1] == 6 ? Atom1 : Atom2; for (int i=0; i 0) VD++; // #* if ( (ConnAugMatrix[Atom][i] == 3) ) return true; // Cl,F,Br,I attach if ( (ConnAugMatrix[Atom][i] == 1) && (ConnAugMatrix[i][i] == 17) ) nCl++; if ( (ConnAugMatrix[Atom][i] == 1) && (ConnAugMatrix[i][i] == 9) ) nF++; if ( (ConnAugMatrix[Atom][i] == 1) && (ConnAugMatrix[i][i] == 35) ) nBr++; if ( (ConnAugMatrix[Atom][i] == 1) && (ConnAugMatrix[i][i] == 53) ) nI++; } if ( (VD-1) == (nCl+nF+nBr+nI)) return true; return false; } private double Hy(InsilicoMolecule mol) { try { double[][] ConnAugMatrix = mol.GetMatrixConnectionAugmented(); Molecule CurMol = mol.GetStructure(); int nSK = CurMol.getAtomCount(); int Nhy = 0; // hydrophilic groups int nC = 0; // number of carbons for (int At=0; At 0) { // if (ConnAugMatrix[At][j] == 1) nSng++; // if (ConnAugMatrix[At][j] == 2) nDbl++; // if (ConnAugMatrix[At][j] == 3) nTrp++; // if (ConnAugMatrix[At][j] == 1.5) nAr++; // } // } // if ( ((nSng+nDbl+nTrp+nAr)==1) && (nSng==1) && (nH==1)) // Nhy++; } // nC if ( (ConnAugMatrix[At][At] == 6) ) { nC++; } } return ( (1 + Nhy) * Log2(1 + Nhy) + nC * ( (1.0/nSK) * Log2(1.0/nSK) ) + Math.sqrt( Nhy / (nSK*nSK)) ) / Log2(1 + nSK); } catch (Throwable e) { return Descriptor.MISSING_VALUE; } } private double Log2(double val) { return (Math.log(val) / Math.log(2)); } }