Search in sources :

Example 1 with SSSearcher

use of com.actelion.research.chem.SSSearcher in project openchemlib by Actelion.

the class DruglikenessPredictor method getDruglikenessString.

public String getDruglikenessString(StereoMolecule testMolecule) {
    if (!sInitialized)
        return "Druglikeness predictor not properly initialized.";
    double incrementSum = 0.0;
    int fragmentCount = 0;
    SSSearcher sss = new SSSearcher(SSSearcher.cMatchAtomCharge);
    StereoMolecule fragment = new StereoMolecule();
    for (int i = 0; i < sIncrementTable.getSize(); i++) {
        new IDCodeParser(false).parse(fragment, sIncrementTable.getFragment(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule()) {
            incrementSum += sIncrementTable.getIncrement(i);
            fragmentCount++;
        }
    }
    double druglikeness = (fragmentCount == 0) ? -1 : incrementSum / Math.sqrt(fragmentCount);
    return druglikeness + "\t" + fragmentCount + "\t" + testMolecule.getAtoms();
}
Also used : IDCodeParser(com.actelion.research.chem.IDCodeParser) SSSearcher(com.actelion.research.chem.SSSearcher) StereoMolecule(com.actelion.research.chem.StereoMolecule)

Example 2 with SSSearcher

use of com.actelion.research.chem.SSSearcher in project openchemlib by Actelion.

the class ToxicityPredictor method assessRisk.

public int assessRisk(StereoMolecule testMolecule, int riskType, ThreadMaster threadMaster) {
    if (!sInitialized)
        return cUnknownRisk;
    if (sRiskMolecules[riskType].contains(new Canonizer(testMolecule).getIDCode()))
        return cHighRisk;
    SSSearcher sss = new SSSearcher(SSSearcher.cMatchAtomCharge);
    StereoMolecule fragment = new StereoMolecule();
    for (int i = 0; i < sHighRiskFragments[riskType].size(); i++) {
        if (threadMaster != null && threadMaster.threadMustDie())
            return cUnknownRisk;
        Thread.yield();
        new IDCodeParser(false).parse(fragment, sHighRiskFragments[riskType].get(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule())
            return cHighRisk;
    }
    for (int i = 0; i < sLowRiskFragments[riskType].size(); i++) {
        if (threadMaster != null && threadMaster.threadMustDie())
            return cUnknownRisk;
        Thread.yield();
        new IDCodeParser(false).parse(fragment, sLowRiskFragments[riskType].get(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule())
            return cLowRisk;
    }
    return cNoRisk;
}
Also used : IDCodeParser(com.actelion.research.chem.IDCodeParser) SSSearcher(com.actelion.research.chem.SSSearcher) StereoMolecule(com.actelion.research.chem.StereoMolecule) Canonizer(com.actelion.research.chem.Canonizer)

Example 3 with SSSearcher

use of com.actelion.research.chem.SSSearcher in project openchemlib by Actelion.

the class DruglikenessPredictor method assessDruglikeness.

public double assessDruglikeness(StereoMolecule testMolecule, ThreadMaster threadMaster) {
    ParameterizedStringList detail = new ParameterizedStringList();
    if (!sInitialized) {
        detail.add("Druglikeness predictor not properly initialized.", ParameterizedStringList.cStringTypeText);
        return cDruglikenessUnknown;
    }
    detail.add("Found sub-structure fragments and their contributions:", ParameterizedStringList.cStringTypeText);
    detail.add("(yellow atoms carry at least one more substituent)", ParameterizedStringList.cStringTypeText);
    double nastyIncrementSum = 0.0;
    double incrementSum = 0.0;
    int fragmentCount = 0;
    SSSearcher sss = new SSSearcher(SSSearcher.cMatchAtomCharge);
    StereoMolecule fragment = new StereoMolecule();
    for (int i = 0; i < sIncrementTable.getSize(); i++) {
        if (threadMaster != null && threadMaster.threadMustDie())
            return cDruglikenessUnknown;
        Thread.yield();
        new IDCodeParser(false).parse(fragment, sIncrementTable.getFragment(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule()) {
            double increment = sIncrementTable.getIncrement(i);
            if (increment < -1)
                nastyIncrementSum += increment;
            else {
                incrementSum += increment;
                fragmentCount++;
            }
            detail.add(sIncrementTable.getFragment(i), ParameterizedStringList.cStringTypeIDCode);
            detail.add(Double.toString(increment), ParameterizedStringList.cStringTypeDouble);
        }
    }
    if (fragmentCount == 0)
        return -1;
    double druglikeness = nastyIncrementSum + incrementSum / Math.sqrt(fragmentCount);
    // correct cut-off by also treating molecules
    // with more than 50 found fragments as more drug-like
    druglikeness = druglikeness + 0.0625 * (fragmentCount - 40);
    mDetail = detail;
    return druglikeness;
}
Also used : IDCodeParser(com.actelion.research.chem.IDCodeParser) SSSearcher(com.actelion.research.chem.SSSearcher) StereoMolecule(com.actelion.research.chem.StereoMolecule)

Example 4 with SSSearcher

use of com.actelion.research.chem.SSSearcher in project openchemlib by Actelion.

the class ToxicityPredictor method getDetail.

public ParameterizedStringList getDetail(StereoMolecule testMolecule, int riskType) {
    ParameterizedStringList theDetail = new ParameterizedStringList();
    if (!sInitialized) {
        theDetail.add("Toxicity predictor not properly initialized.", ParameterizedStringList.cStringTypeText);
        return theDetail;
    }
    String idcode = new Canonizer(testMolecule).getIDCode();
    if (sRiskMolecules[riskType].contains(idcode)) {
        theDetail.add("This molecule is known to be " + cRiskNameA[riskType] + ":", ParameterizedStringList.cStringTypeText);
        theDetail.add(idcode, ParameterizedStringList.cStringTypeIDCode);
        return theDetail;
    }
    SSSearcher sss = new SSSearcher(SSSearcher.cMatchAtomCharge);
    boolean found = false;
    StereoMolecule fragment = new StereoMolecule();
    for (int i = 0; i < sHighRiskFragments[riskType].size(); i++) {
        new IDCodeParser(false).parse(fragment, sHighRiskFragments[riskType].get(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule()) {
            if (!found)
                theDetail.add("High-risk fragments indicating " + cRiskNameN[riskType] + ":", ParameterizedStringList.cStringTypeText);
            found = true;
            theDetail.add(sHighRiskFragments[riskType].get(i), ParameterizedStringList.cStringTypeIDCode);
        }
    }
    found = false;
    for (int i = 0; i < sLowRiskFragments[riskType].size(); i++) {
        new IDCodeParser(false).parse(fragment, sLowRiskFragments[riskType].get(i));
        sss.setMol(fragment, testMolecule);
        if (sss.isFragmentInMolecule()) {
            if (!found)
                theDetail.add("Medium-risk fragments indicating " + cRiskNameN[riskType] + ":", ParameterizedStringList.cStringTypeText);
            found = true;
            theDetail.add(sLowRiskFragments[riskType].get(i), ParameterizedStringList.cStringTypeIDCode);
        }
    }
    if (theDetail.getSize() == 0)
        theDetail.add("No indication for " + cRiskNameN[riskType] + " found.", ParameterizedStringList.cStringTypeText);
    return theDetail;
}
Also used : IDCodeParser(com.actelion.research.chem.IDCodeParser) SSSearcher(com.actelion.research.chem.SSSearcher) StereoMolecule(com.actelion.research.chem.StereoMolecule) Canonizer(com.actelion.research.chem.Canonizer)

Aggregations

IDCodeParser (com.actelion.research.chem.IDCodeParser)4 SSSearcher (com.actelion.research.chem.SSSearcher)4 StereoMolecule (com.actelion.research.chem.StereoMolecule)4 Canonizer (com.actelion.research.chem.Canonizer)2