Logo Search packages:      
Sourcecode: cdk version File versions  Download package

DescriptorValue org::openscience::cdk::qsar::descriptors::molecular::XLogPDescriptor::calculate ( IAtomContainer  atomContainer  )  throws CDKException [inline]

Calculates the xlogP for an atom container.

If checkAromaticity is true, the method check the aromaticity, if false, means that the aromaticity has already been checked. It is necessary to use before the call of this mehtod the addExplicitHydrogensToSatisfyValency method (HydrogenAdder classe).

Parameters:
atomContainer AtomContainer
Returns:
XLogP is a double
Exceptions:
CDKException Possible Exceptions

Implements org::openscience::cdk::qsar::IMolecularDescriptor.

Definition at line 188 of file XLogPDescriptor.java.

References org::openscience::cdk::interfaces::IRingSet::add(), org::openscience::cdk::isomorphism::matchers::QueryAtomContainer::addBond(), org::openscience::cdk::AtomContainer::bonds, checkRingLink(), org::openscience::cdk::interfaces::IChemObject::clone(), org::openscience::cdk::interfaces::IRingSet::contains(), org::openscience::cdk::ringsearch::SSSRFinder::findEssentialRings(), getAromaticCarbonsCount(), getAromaticNitrogensCount(), org::openscience::cdk::interfaces::IBond::getAtom(), org::openscience::cdk::interfaces::IAtomContainer::getAtom(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainer(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainerCount(), org::openscience::cdk::interfaces::IAtomContainer::getAtomCount(), getAtomTypeXCount(), org::openscience::cdk::interfaces::IAtomContainer::getBondOrderSum(), org::openscience::cdk::interfaces::IChemObject::getBuilder(), getCarbonsCount(), org::openscience::cdk::interfaces::IAtomContainer::getConnectedBondsCount(), getDoubleBondedCarbonsCount(), getDoubleBondedNitrogenCount(), getDoubleBondedOxygenCount(), getDoubleBondedSulfurCount(), org::openscience::cdk::interfaces::IChemObject::getFlag(), org::openscience::cdk::interfaces::IAtomType::getFormalCharge(), getHalogenCount(), getHydrogenCount(), org::openscience::cdk::isomorphism::mcss::RMap::getId1(), getIfCarbonIsHydrophobic(), org::openscience::cdk::interfaces::IAtomContainer::getMaximumBondOrder(), org::openscience::cdk::interfaces::IBond::getOrder(), getOxygenCount(), getParameterNames(), getParameters(), getPiSystemsCount(), getPresenceOfCarbonil(), getPresenceOfHydroxy(), getPresenceOfNitro(), getPresenceOfSulfat(), org::openscience::cdk::interfaces::IChemObject::getProperty(), org::openscience::cdk::interfaces::IRingSet::getRings(), getSpecification(), org::openscience::cdk::interfaces::IElement::getSymbol(), initializeHydrogenPairCheck(), org::openscience::cdk::interfaces::IChemObjectBuilder::newRingSet(), org::openscience::cdk::AtomContainer::removeBond(), org::openscience::cdk::interfaces::IChemObject::setProperty(), and org::openscience::cdk::Element::setSymbol().

                                                                                       {
        IAtomContainer ac;
        try {
            ac = (IAtomContainer) atomContainer.clone();
        } catch (CloneNotSupportedException e) {
            throw new CDKException("Error during clone");
        }

        IRingSet rs = (IRingSet) (new AllRingsFinder()).findAllRings(ac);
        IRingSet atomRingSet=null;
        if (checkAromaticity) {
            HueckelAromaticityDetector.detectAromaticity(ac, rs, true);
        }
        double xlogP = 0;
//          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
        String symbol = "";
        int bondCount = 0;
        int atomCount = ac.getAtomCount();
        int hsCount = 0;
        double xlogPOld=0;
        double maxBondOrder = 0;
        List hBondAcceptors=new ArrayList();
        List hBondDonors=new ArrayList();
        int checkAminoAcid=1;//if 0 no check, if >1 check
        IAtom atomi = null;
        for (int i = 0; i < atomCount; i++) {
            atomi = (IAtom)ac.getAtom(i);
            //                Problem fused ring systems
            atomRingSet= rs.getRings(atomi);
            atomi.setProperty("IS_IN_AROMATIC_RING", new Boolean(false));
            atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, new Integer(0));
            //logger.debug("atomRingSet.size "+atomRingSet.size());
            if (atomRingSet.getAtomContainerCount()>0){
                if (atomRingSet.getAtomContainerCount()>1){
                  Iterator containers = RingSetManipulator.getAllAtomContainers(atomRingSet).iterator();
                  atomRingSet = rs.getBuilder().newRingSet();
                  while (containers.hasNext()) {
                        ssrf = new SSSRFinder((IAtomContainer)containers.next());
                        atomRingSet.add(ssrf.findEssentialRings());
                  }
                    //logger.debug(" SSSRatomRingSet.size "+atomRingSet.size());
                }
                for (int j=0;j<atomRingSet.getAtomContainerCount();j++){
                    if (j==0){
                        atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, new Integer(((IRing)atomRingSet.getAtomContainer(j)).getRingSize()));
                    }

                    if (((IRing)atomRingSet.getAtomContainer(j)).contains(atomi)){
                        if (((IRing)atomRingSet.getAtomContainer(j)).getRingSize()>=6 && atomi.getFlag(CDKConstants.ISAROMATIC)){
                            atomi.setProperty("IS_IN_AROMATIC_RING", new Boolean(true));
                        }
                        if (((IRing)atomRingSet.getAtomContainer(j)).getRingSize()<((Integer)atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()){
                            atomi.setProperty(CDKConstants.PART_OF_RING_OF_SIZE, new Integer(((IRing)atomRingSet.getAtomContainer(j)).getRingSize()));
                        }
                    }
                }
            }//else{
            //logger.debug();
            //}
        }


        for (int i = 0; i < atomCount; i++) {
            atomi = (IAtom)ac.getAtom(i);
            if (xlogPOld==xlogP & i>0 & !symbol.equals("H")){
                //logger.debug("\nXlogPAssignmentError: Could not assign atom number:"+(i-1));
            }

            xlogPOld=xlogP;
            symbol = atomi.getSymbol();
            bondCount = ac.getConnectedBondsCount(atomi);
            hsCount = getHydrogenCount(ac, atomi);
            maxBondOrder = ac.getMaximumBondOrder(atomi);
            if (!symbol.equals("H")){
                //logger.debug("i:"+i+" Symbol:"+symbol+" "+" bondC:"+bondCount+" Charge:"+atoms[i].getFormalCharge()+" hsC:"+hsCount+" maxBO:"+maxBondOrder+" Arom:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" AtomTypeX:"+getAtomTypeXCount(ac, atoms[i])+" PiSys:"+getPiSystemsCount(ac, atoms[i])+" C=:"+getDoubleBondedCarbonsCount(ac, atoms[i])+" AromCc:"+getAromaticCarbonsCount(ac,atoms[i])+" RS:"+((Integer)atoms[i].getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()+"\t");
            }
            if (symbol.equals("C")) {
                if (bondCount == 2) {
                    // C sp
                    if (hsCount >= 1) {
                        xlogP += 0.209;
                        //logger.debug("XLOGP: 38            0.209");
                    } else {
                        if (maxBondOrder == 2.0) {
                            xlogP += 2.073;
                            //logger.debug("XLOGP: 40        2.037");
                        } else if (maxBondOrder == 3.0) {
                            xlogP += 0.33;
                            //logger.debug("XLOGP: 39        0.33");
                        }
                    }
                }
                if (bondCount == 3) {
                    // C sp2
                    if (((Boolean)atomi.getProperty("IS_IN_AROMATIC_RING")).booleanValue()) {
                        if (getAromaticCarbonsCount(ac, atomi) >= 2 && getAromaticNitrogensCount(ac,atomi)==0) {
                            if (hsCount == 0) {
                                if (getAtomTypeXCount(ac, atomi) == 0 ) {
                                    xlogP += 0.296;
                                    //logger.debug("XLOGP: 34            0.296");
                                } else {
                                    xlogP -= 0.151;
                                    //logger.debug("XLOGP: 35     C.ar.x      -0.151");
                                }
                            } else {
                                xlogP += 0.337;
                                //logger.debug("XLOGP: 32          0.337");
                            }
                            //} else if (getAromaticCarbonsCount(ac, atoms[i]) < 2 && getAromaticNitrogensCount(ac, atoms[i]) > 1) {
                        } else if (getAromaticNitrogensCount(ac, atomi) >= 1) {
                            if (hsCount == 0) {
                                if (getAtomTypeXCount(ac, atomi) == 0) {
                                    xlogP += 0.174;
                                    //logger.debug("XLOGP: 36     C.ar.(X)     0.174");
                                } else {
                                    xlogP += 0.366;
                                    //logger.debug("XLOGP: 37            0.366");
                                }
                            } else if (getHydrogenCount(ac, atomi) == 1) {
                                xlogP += 0.126;
                                //logger.debug("XLOGP: 33          0.126");
                            }
                        }
                        //NOT aromatic, but sp2
                    } else {
                        if (hsCount == 0) {
                            if (getAtomTypeXCount(ac, atomi) == 0) {
                                if (getPiSystemsCount(ac, atomi) <= 1) {
                                    xlogP += 0.05;
                                    //logger.debug("XLOGP: 26            0.05");
                                } else {
                                    xlogP += 0.013;
                                    //logger.debug("XLOGP: 27            0.013");
                                }
                            }
                            else if (getAtomTypeXCount(ac, atomi) == 1) {
                                if (getPiSystemsCount(ac, atomi) == 0) {
                                    xlogP -= 0.03;
                                    //logger.debug("XLOGP: 28           -0.03");
                                } else {
                                    xlogP -= 0.027;
                                    //logger.debug("XLOGP: 29           -0.027");
                                }
                            }
                            else if (getAtomTypeXCount(ac, atomi) == 2) {
                                if (getPiSystemsCount(ac, atomi) ==0) {
                                    xlogP += 0.005;
                                    //logger.debug("XLOGP: 30            0.005");
                                } else {
                                    xlogP -= 0.315;
                                    //logger.debug("XLOGP: 31           -0.315");
                                }
                            }
                        }
                        if (hsCount == 1) {
                            if (getAtomTypeXCount(ac, atomi) == 0) {
                                if (getPiSystemsCount(ac, atomi) == 0) {
                                    xlogP += 0.466;
                                    //logger.debug("XLOGP: 22            0.466");
                                }
                                if (getPiSystemsCount(ac, atomi) == 1) {
                                    xlogP += 0.136;
                                    //logger.debug("XLOGP: 23            0.136");
                                }
                            } else {
                                if (getPiSystemsCount(ac, atomi) == 0) {
                                    xlogP += 0.001;
                                    //logger.debug("XLOGP: 24            0.001");
                                }
                                if (getPiSystemsCount(ac, atomi) == 1) {
                                    xlogP -= 0.31;
                                    //logger.debug("XLOGP: 25           -0.31");
                                }
                            }
                        }
                        if (hsCount == 2) {
                            xlogP += 0.42;
                            //logger.debug("XLOGP: 21        0.42");
                        }
                        if (getIfCarbonIsHydrophobic(ac, atomi)) {
                            xlogP += 0.211;
                            //logger.debug("XLOGP: Hydrophobic Carbon   0.211");
                        }
                    }//sp2 NOT aromatic
                }

                if (bondCount == 4) {
                    // C sp3
                    if (hsCount == 0) {
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP -= 0.006;
                                //logger.debug("XLOGP: 16         -0.006");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP -= 0.57;
                                //logger.debug("XLOGP: 17         -0.57");
                            }
                            if (getPiSystemsCount(ac, atomi) >= 2) {
                                xlogP -= 0.317;
                                //logger.debug("XLOGP: 18         -0.317");
                            }
                        } else {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP -= 0.316;
                                //logger.debug("XLOGP: 19         -0.316");
                            } else {
                                xlogP -= 0.723;
                                //logger.debug("XLOGP: 20         -0.723");
                            }
                        }
                    }
                    if (hsCount == 1) {
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP += 0.127;
                                //logger.debug("XLOGP: 10          0.127");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP -= 0.243;
                                //logger.debug("XLOGP: 11         -0.243");
                            }
                            if (getPiSystemsCount(ac, atomi) >= 2) {
                                xlogP -= 0.499;
                                //logger.debug("XLOGP: 12         -0.499");
                            }
                        } else {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP -= 0.205;
                                //logger.debug("XLOGP: 13         -0.205");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP -= 0.305;
                                //logger.debug("XLOGP: 14         -0.305");
                            }
                            if (getPiSystemsCount(ac, atomi) >= 2) {
                                xlogP -= 0.709;
                                //logger.debug("XLOGP: 15         -0.709");
                            }
                        }
                    }
                    if (hsCount == 2) {
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP += 0.358;
                                //logger.debug("XLOGP:  4          0.358");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP -= 0.008;
                                //logger.debug("XLOGP:  5         -0.008");
                            }
                            if (getPiSystemsCount(ac, atomi) == 2) {
                                xlogP -= 0.185;
                                //logger.debug("XLOGP:  6         -0.185");
                            }
                        } else {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP -= 0.137;
                                //logger.debug("XLOGP:  7         -0.137");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP -= 0.303;
                                //logger.debug("XLOGP:  8         -0.303");
                            }
                            if (getPiSystemsCount(ac, atomi) == 2) {
                                xlogP -= 0.815;
                                //logger.debug("XLOGP:  9         -0.815");
                            }
                        }
                    }
                    if (hsCount > 2) {
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP += 0.528;
                                //logger.debug("XLOGP:  1          0.528");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP += 0.267;
                                //logger.debug("XLOGP:  2          0.267");
                            }
                        }else{
                            //if (getNitrogenOrOxygenCount(ac, atomi) == 1) {
                            xlogP -= 0.032;
                            //logger.debug("XLOGP:  3       -0.032");
                        }
                    }
                    if (getIfCarbonIsHydrophobic(ac, atomi)) {
                        xlogP += 0.211;
                        //logger.debug("XLOGP: Hydrophobic Carbon 0.211");
                    }
                }//csp3


            }//C

            if (symbol.equals("N")) {
                //NO2
                if (ac.getBondOrderSum(atomi) >= 3.0 && getOxygenCount(ac, atomi) >= 2 && maxBondOrder==2) {
                    xlogP += 1.178;
                    //logger.debug("XLOGP: 66          1.178");
                }
                else {
                    if (getPresenceOfCarbonil(ac, atomi)>=1) {
                        // amidic nitrogen
                        if (hsCount == 0) {
                            if (getAtomTypeXCount(ac, atomi) == 0) {
                                xlogP += 0.078;
                                //logger.debug("XLOGP: 57          0.078");
                            }
                            if (getAtomTypeXCount(ac, atomi) == 1) {
                                xlogP -= 0.118;
                                //logger.debug("XLOGP: 58         -0.118");
                            }
                        }
                        if (hsCount == 1) {
                            if (getAtomTypeXCount(ac, atomi) == 0) {
                                xlogP -= 0.096;
                                hBondDonors.add(new Integer(i));
                                //logger.debug("XLOGP: 55         -0.096");
                            } else {
                                xlogP -= 0.044;
                                hBondDonors.add(new Integer(i));
                                //logger.debug("XLOGP: 56         -0.044");
                            }
                        }
                        if (hsCount == 2) {
                            xlogP -= 0.646;
                            hBondDonors.add(new Integer(i));
                            //logger.debug("XLOGP: 54       -0.646");
                        }
                    } else {//NO amidic nitrogen
                        if (bondCount == 1) {
                            // -C#N
                            if (getCarbonsCount(ac, atomi) == 1) {
                                xlogP -= 0.566;
                                //logger.debug("XLOGP: 68         -0.566");
                            }
                        }else if (bondCount == 2) {
                            // N sp2
                            if (((Boolean)atomi.getProperty("IS_IN_AROMATIC_RING")).booleanValue()) {
                                xlogP -= 0.493;
                                //logger.debug("XLOGP: 67         -0.493");
                                if (checkAminoAcid!=0){ checkAminoAcid+=1;}
                            } else {
                                if (getDoubleBondedCarbonsCount(ac, atomi) == 0) {
                                    if (getDoubleBondedNitrogenCount(ac, atomi) == 0) {
                                        if (getDoubleBondedOxygenCount(ac, atomi) == 1) {
                                            xlogP += 0.427;
                                            //logger.debug("XLOGP: 65          0.427");
                                        }
                                    }
                                    if (getDoubleBondedNitrogenCount(ac, atomi) == 1) {
                                        if (getAtomTypeXCount(ac, atomi) == 0) {
                                            xlogP += 0.536;
                                            //logger.debug("XLOGP: 63          0.536");
                                        }
                                        if (getAtomTypeXCount(ac, atomi) == 1) {
                                            xlogP -= 0.597;
                                            //logger.debug("XLOGP: 64         -0.597");
                                        }
                                    }
                                }else if (getDoubleBondedCarbonsCount(ac, atomi) == 1) {
                                    if (getAtomTypeXCount(ac, atomi) == 0) {
                                        if (getPiSystemsCount(ac, atomi) == 0) {
                                            xlogP += 0.007;
                                            //logger.debug("XLOGP: 59          0.007");
                                        }
                                        if (getPiSystemsCount(ac, atomi) == 1) {
                                            xlogP -= 0.275;
                                            //logger.debug("XLOGP: 60         -0.275");
                                        }
                                    }else if (getAtomTypeXCount(ac, atomi) == 1) {
                                        if (getPiSystemsCount(ac, atomi) == 0) {
                                            xlogP += 0.366;
                                            //logger.debug("XLOGP: 61          0.366");
                                        }
                                        if (getPiSystemsCount(ac, atomi) == 1) {
                                            xlogP += 0.251;
                                            //logger.debug("XLOGP: 62          0.251");
                                        }
                                    }
                                }
                            }
                        }else if (bondCount == 3) {
                            // N sp3
                            if (hsCount == 0) {
                                //if (rs.contains(atomi)&&ringSize>3) {
                                if (atomi.getFlag(CDKConstants.ISAROMATIC)|| (rs.contains(atomi)&& ((Integer)atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()>3 && getPiSystemsCount(ac,atomi)>=1)){
                                    if (getAtomTypeXCount(ac, atomi) == 0) {
                                        xlogP += 0.881;
                                        //logger.debug("XLOGP: 51        0.881");
                                    } else {
                                        xlogP -= 0.01;
                                        //logger.debug("XLOGP: 53       -0.01");
                                    }
                                } else {
                                    if (getAtomTypeXCount(ac, atomi) == 0) {
                                        if (getPiSystemsCount(ac, atomi) == 0) {
                                            xlogP += 0.159;
                                            //logger.debug("XLOGP: 49          0.159");
                                        }
                                        if (getPiSystemsCount(ac, atomi) > 0) {
                                            xlogP += 0.761;
                                            //logger.debug("XLOGP: 50          0.761");
                                        }
                                    } else {
                                        xlogP -= 0.239;
                                        //logger.debug("XLOGP: 52       -0.239");
                                    }
                                }
                            }else if (hsCount == 1) {
                                if (getAtomTypeXCount(ac, atomi) == 0) {
//                                                    like pyrrole
                                    if (atomi.getFlag(CDKConstants.ISAROMATIC)|| (rs.contains(atomi)&& ((Integer)atomi.getProperty(CDKConstants.PART_OF_RING_OF_SIZE)).intValue()>3 && getPiSystemsCount(ac,atomi)>=2)) {
                                        xlogP += 0.545;
                                        hBondDonors.add(new Integer(i));
                                        //logger.debug("XLOGP: 46        0.545");
                                    } else {
                                        if (getPiSystemsCount(ac, atomi) == 0) {
                                            xlogP -= 0.112;
                                            hBondDonors.add(new Integer(i));
                                            //logger.debug("XLOGP: 44         -0.112");
                                        }
                                        if (getPiSystemsCount(ac, atomi) > 0) {
                                            xlogP += 0.166;
                                            hBondDonors.add(new Integer(i));
                                            //logger.debug("XLOGP: 45          0.166");
                                        }
                                    }
                                } else {
                                    if (rs.contains(atomi)) {
                                        xlogP += 0.153;
                                        hBondDonors.add(new Integer(i));
                                        //logger.debug("XLOGP: 48        0.153");
                                    } else {
                                        xlogP += 0.324;
                                        hBondDonors.add(new Integer(i));
                                        //logger.debug("XLOGP: 47        0.324");
                                    }
                                }
                            }else if (hsCount == 2) {
                                if (getAtomTypeXCount(ac, atomi) == 0) {
                                    if (getPiSystemsCount(ac, atomi) == 0) {
                                        xlogP -= 0.534;
                                        hBondDonors.add(new Integer(i));
                                        //logger.debug("XLOGP: 41       -0.534");
                                    }
                                    if (getPiSystemsCount(ac, atomi) == 1) {
                                        xlogP -= 0.329;
                                        hBondDonors.add(new Integer(i));
                                        //logger.debug("XLOGP: 42       -0.329");
                                    }

                                    if (checkAminoAcid!=0){ checkAminoAcid+=1;}
                                } else {
                                    xlogP -= 1.082;
                                    hBondDonors.add(new Integer(i));
                                    //logger.debug("XLOGP: 43           -1.082");
                                }
                            }
                        }
                    }
                }
            }
            if (symbol.equals("O")) {
                if (bondCount == 1 && maxBondOrder==2.0) {
                    xlogP -= 0.399;
                    if (!getPresenceOfHydroxy(ac,atomi)){
                        hBondAcceptors.add(new Integer(i));
                    }
                    //logger.debug("XLOGP: 75   A=O   -0.399");
                }else if(bondCount == 1 && hsCount==0 && (getPresenceOfNitro(ac,atomi) || getPresenceOfCarbonil(ac,atomi)==1) || getPresenceOfSulfat(ac,atomi)){
                    xlogP -= 0.399;
                    if (!getPresenceOfHydroxy(ac,atomi)){
                        hBondAcceptors.add(new Integer(i));
                    }
                    //logger.debug("XLOGP: 75   A=O   -0.399");
                }else if (bondCount >= 1) {
                    if (hsCount == 0 && bondCount==2) {
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP += 0.084;
                                //logger.debug("XLOGP: 72   R-O-R  0.084");
                            }
                            if (getPiSystemsCount(ac, atomi) > 0) {
                                xlogP += 0.435;
                                //logger.debug("XLOGP: 73   R-O-R.1      0.435");
                            }
                        }else if (getAtomTypeXCount(ac, atomi) == 1) {
                            xlogP += 0.105;
                            //logger.debug("XLOGP: 74 R-O-X  0.105");
                        }
                    }else{
                        if (getAtomTypeXCount(ac, atomi) == 0) {
                            if (getPiSystemsCount(ac, atomi) == 0) {
                                xlogP -= 0.467;
                                hBondDonors.add(new Integer(i));
                                hBondAcceptors.add(new Integer(i));
                                //logger.debug("XLOGP: 69   R-OH  -0.467");
                            }
                            if (getPiSystemsCount(ac, atomi) == 1) {
                                xlogP += 0.082;
                                hBondDonors.add(new Integer(i));
                                hBondAcceptors.add(new Integer(i));
                                //logger.debug("XLOGP: 70   R-OH.1       0.082");
                            }
                        }else if (getAtomTypeXCount(ac, atomi) == 1) {
                            xlogP -= 0.522;
                            hBondDonors.add(new Integer(i));
                            hBondAcceptors.add(new Integer(i));
                            //logger.debug("XLOGP: 71 X-OH  -0.522");
                        }
                    }
                }
            }
            if (symbol.equals("S")) {
                if ((bondCount == 1 && maxBondOrder==2) || (bondCount == 1 && atomi.getFormalCharge()==-1)) {
                    xlogP -= 0.148;
                    //logger.debug("XLOGP: 78   A=S   -0.148");
                }else if (bondCount == 2) {
                    if (hsCount == 0) {
                        xlogP += 0.255;
                        //logger.debug("XLOGP: 77     A-S-A  0.255");
                    } else {
                        xlogP += 0.419;
                        //logger.debug("XLOGP: 76     A-SH   0.419");
                    }
                }else if (bondCount == 3) {
                    if (getOxygenCount(ac, atomi) >= 1) {
                        xlogP -= 1.375;
                        //logger.debug("XLOGP: 79     A-SO-A      -1.375");
                    }
                }else if (bondCount == 4) {
                    if (getDoubleBondedOxygenCount(ac, atomi) >= 2) {
                        xlogP -= 0.168;
                        //logger.debug("XLOGP: 80     A-SO2-A     -0.168");
                    }
                }
            }
            if (symbol.equals("P")) {
                if (getDoubleBondedSulfurCount(ac, atomi) >= 1 && bondCount>=4) {
                    xlogP += 1.253;
                    //logger.debug("XLOGP: 82   S=PA3  1.253");
                }else if (getOxygenCount(ac,atomi)>=1 || getDoubleBondedOxygenCount(ac, atomi) == 1 && bondCount>=4) {
                    xlogP -= 0.447;
                    //logger.debug("XLOGP: 81   O=PA3 -0.447");
                }
            }
            if (symbol.equals("F")) {
                if (getPiSystemsCount(ac, atomi) == 0) {
                    xlogP += 0.375;
                    //logger.debug("XLOGP: 83   F.0    0.512");
                }else if (getPiSystemsCount(ac, atomi) == 1) {
                    xlogP += 0.202;
                    //logger.debug("XLOGP: 84   F.1    0.202");
                }
            }
            if (symbol.equals("Cl")) {
                if (getPiSystemsCount(ac, atomi) == 0) {
                    xlogP += 0.512;
                    //logger.debug("XLOGP: 85   Cl.0   0.512");
                }else if (getPiSystemsCount(ac, atomi) >= 1) {
                    xlogP += 0.663;
                    //logger.debug("XLOGP: 86   Cl.1   0.663");
                }
            }
            if (symbol.equals("Br")) {
                if (getPiSystemsCount(ac, atomi) == 0) {
                    xlogP += 0.85;
                    //logger.debug("XLOGP: 87   Br.0   0.85");
                }else if (getPiSystemsCount(ac, atomi) == 1) {
                    xlogP += 0.839;
                    //logger.debug("XLOGP: 88   Br.1   0.839");
                }
            }
            if (symbol.equals("I")) {
                if (getPiSystemsCount(ac, atomi) == 0) {
                    xlogP += 1.05;
                    //logger.debug("XLOGP: 89   I.0    1.05");
                }else if (getPiSystemsCount(ac, atomi) == 1) {
                    xlogP += 1.109;
                    //logger.debug("XLOGP: 90   I.1    1.109");
                }
            }

//                Halogen pair 1-3
            int halcount=getHalogenCount(ac, atomi);
            if ( halcount== 2) {
                xlogP += 0.137;
                //logger.debug("XLOGP: Halogen 1-3 pair      0.137");
            }else if (halcount==3){
                xlogP += (3*0.137);
                //logger.debug("XLOGP: Halogen 1-3 pair      0.411");
            }else if (halcount==4){
                xlogP += (6*0.137);
                //logger.debug("XLOGP: Halogen 1-3 pair      1.902");
            }

//                sp2 Oxygen 1-5 pair
            if (getPresenceOfCarbonil(ac, atomi) == 2) {// sp2 oxygen 1-5 pair
                if(!rs.contains(atomi)) {
                    xlogP += 0.580;
                    //logger.debug("XLOGP: sp2 Oxygen 1-5 pair     0.580");
                }
            }
        }
        //logger.debug("XLOGP: Before Correction:"+xlogP);
        List path=null;
        SimpleGraph moleculeGraph=null;
        int [][] pairCheck=null;
//          //logger.debug("Acceptors:"+hBondAcceptors.size()+" Donors:"+hBondDonors.size());
        if (hBondAcceptors.size()>0 && hBondDonors.size()>0){
            moleculeGraph=MoleculeGraphs.getMoleculeGraph(ac);
            pairCheck=initializeHydrogenPairCheck(new int[atomCount][atomCount]);
        }
        for (int i=0; i<hBondAcceptors.size();i++){
            for (int j=0; j<hBondDonors.size();j++){
                if (checkRingLink(rs,ac,ac.getAtom(((Integer)hBondAcceptors.get(i)).intValue())) || checkRingLink(rs,ac,ac.getAtom(((Integer)hBondDonors.get(j)).intValue()))){
                    path=BFSShortestPath.findPathBetween(moleculeGraph,ac.getAtom(((Integer)hBondAcceptors.get(i)).intValue()), ac.getAtom(((Integer)hBondDonors.get(j)).intValue()));
//                            //logger.debug(" Acc:"+checkRingLink(rs,ac,atoms[((Integer)hBondAcceptors.get(i)).intValue()])
//                            +" S:"+atoms[((Integer)hBondAcceptors.get(i)).intValue()].getSymbol()
//                            +" Nr:"+((Integer)hBondAcceptors.get(i)).intValue()
//                            +" Don:"+checkRingLink(rs,ac,atoms[((Integer)hBondDonors.get(j)).intValue()])
//                            +" S:"+atoms[((Integer)hBondDonors.get(j)).intValue()].getSymbol()
//                            +" Nr:"+((Integer)hBondDonors.get(j)).intValue()
//                            +" i:"+i+" j:"+j+" path:"+path.size());
                    if (checkRingLink(rs,ac,ac.getAtom(((Integer)hBondAcceptors.get(i)).intValue())) && checkRingLink(rs,ac,ac.getAtom(((Integer)hBondDonors.get(j)).intValue()))){
                        if (path.size()==3 && pairCheck[((Integer)hBondAcceptors.get(i)).intValue()][((Integer)hBondDonors.get(j)).intValue()]==0){
                            xlogP += 0.429;
                            pairCheck[((Integer)hBondAcceptors.get(i)).intValue()][((Integer)hBondDonors.get(j)).intValue()]=1;
                            pairCheck[((Integer)hBondDonors.get(j)).intValue()][((Integer)hBondAcceptors.get(i)).intValue()]=1;
                            //logger.debug("XLOGP: Internal HBonds 1-4   0.429");
                        }
                    }else{
                        if (path.size()==4 && pairCheck[((Integer)hBondAcceptors.get(i)).intValue()][((Integer)hBondDonors.get(j)).intValue()]==0){
                            xlogP += 0.429;
                            pairCheck[((Integer)hBondAcceptors.get(i)).intValue()][((Integer)hBondDonors.get(j)).intValue()]=1;
                            pairCheck[((Integer)hBondDonors.get(j)).intValue()][((Integer)hBondAcceptors.get(i)).intValue()]=1;
                            //logger.debug("XLOGP: Internal HBonds 1-5   0.429");
                        }
                    }
                }
            }
        }

        if (checkAminoAcid>1){
//                alpha amino acid
            QueryAtomContainer aminoAcid =
                QueryAtomContainerCreator.createBasicQueryContainer(
                        createAminoAcid(ac.getBuilder())
                );

            Iterator bonds = aminoAcid.bonds();
            IAtom bondAtom0=null;
            IAtom bondAtom1=null;
            while (bonds.hasNext()) {
                IBond bond = (IBond) bonds.next();
                bondAtom0=bond.getAtom(0);
                bondAtom1=bond.getAtom(1);
                if ((bondAtom0.getSymbol().equals("C") && bondAtom1.getSymbol().equals("N")) || (bondAtom0.getSymbol().equals("N") && bondAtom1.getSymbol().equals("C"))&& bond.getOrder()==1){
                    aminoAcid.removeBond(bondAtom0,bondAtom1);
                    aminoAcid.addBond(new AnyOrderQueryBond((IQueryAtom)bondAtom0,(IQueryAtom)bondAtom1,1));
                    break;
                }
            }

            //AtomContainer aminoacid = sp.parseSmiles("NCC(=O)O");
            if (UniversalIsomorphismTester.isSubgraph((org.openscience.cdk.AtomContainer)ac, aminoAcid)) {
                List list = UniversalIsomorphismTester.getSubgraphAtomsMap((org.openscience.cdk.AtomContainer)ac, aminoAcid);
                RMap map = null;
                IAtom atom1=null;
                for (int j = 0; j < list.size(); j++){
                    map = (RMap) list.get(j);
                    atom1 = ac.getAtom(map.getId1());
                    if (atom1.getSymbol().equals("O")&& ac.getMaximumBondOrder(atom1)==1){
                        if (ac.getConnectedBondsCount(atom1)==2 && getHydrogenCount(ac, atom1)==0){
                        }else{
                            xlogP -= 2.166;
                            //logger.debug("XLOGP: alpha amino acid     -2.166");
                            break;
                        }
                    }
                }
            }
        }

        IAtomContainer paba = createPaba(ac.getBuilder());
        // p-amino sulphonic acid
        if (UniversalIsomorphismTester.isSubgraph((org.openscience.cdk.AtomContainer)ac, paba)) {
            xlogP -= 0.501;
            //logger.debug("XLOGP: p-amino sulphonic acid   -0.501");
        }


        // salicylic acid
        if (salicylFlag){
            IAtomContainer salicilic = createSalicylicAcid(ac.getBuilder());
            if (UniversalIsomorphismTester.isSubgraph((org.openscience.cdk.AtomContainer)ac, salicilic)) {
                xlogP += 0.554;
                //logger.debug("XLOGP: salicylic acid  0.554");
            }
        }


//           ortho oxygen pair
        //AtomContainer orthopair = sp.parseSmiles("OCCO");
        QueryAtomContainer orthopair=new QueryAtomContainer();
        AromaticAtom atom1=new AromaticAtom();
        atom1.setSymbol("C");
        AromaticAtom atom2=new AromaticAtom();
        atom2.setSymbol("C");
        SymbolQueryAtom atom3=new SymbolQueryAtom();
        atom3.setSymbol("O");
        SymbolQueryAtom atom4=new SymbolQueryAtom();
        atom4.setSymbol("O");
        orthopair.addBond(new AromaticQueryBond(atom1,atom2,1.5));
        orthopair.addBond(new OrderQueryBond(atom1,atom3,1));
        orthopair.addBond(new OrderQueryBond(atom2,atom4,1));

        if (UniversalIsomorphismTester.isSubgraph((org.openscience.cdk.AtomContainer)ac, orthopair)) {
            xlogP -= 0.268;
            //logger.debug("XLOGP: Ortho oxygen pair  -0.268");
        }

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(),
                new DoubleResult(xlogP), new String[] {"XLogP"});
    }


Generated by  Doxygen 1.6.0   Back to index