Search in sources :

Example 1 with ReactionScore

use of ambit2.reactions.rules.scores.ReactionScore in project ambit-mirror by ideaconsult.

the class SyntheticStrategy method calcReactionScore.

public ReactionScore calcReactionScore(GenericReactionInstance gri) {
    ReactionScore rscore = new ReactionScore();
    if (reactionScoreSchema.basicScoreWeight > 0.0) {
        rscore.basicScore = gri.reaction.getBasicScore();
        rscore.totalScore += rscore.basicScore * reactionScoreSchema.basicScoreWeight;
    }
    if (reactionScoreSchema.priorityScoreWeight > 0.0) {
        rscore.priorityScore = gri.reaction.getPriorityScore();
        rscore.totalScore += rscore.priorityScore * reactionScoreSchema.priorityScoreWeight;
    }
    if (reactionScoreSchema.experimentalConditionsScoreWeight > 0.0) {
        rscore.experimentalConditionsScore = gri.reaction.getExperimentalConditionsScore();
        rscore.totalScore += rscore.experimentalConditionsScore * reactionScoreSchema.experimentalConditionsScoreWeight;
    }
    if (reactionScoreSchema.productComplexityWeight > 0.0) {
        rscore.productComplexityScore = calcProductComplexity(gri.products);
        rscore.totalScore += rscore.productComplexityScore * reactionScoreSchema.productComplexityWeight;
    }
    if (reactionScoreSchema.reactionCenterComplexityWeight > 0.0) {
        rscore.reactionCenterComplexityScore = calcReactionCenterComplexity(gri);
        rscore.totalScore += rscore.reactionCenterComplexityScore * reactionScoreSchema.reactionCenterComplexityWeight;
    }
    if (reactionScoreSchema.yieldScoreWeight > 0.0) {
        // average of lo and hi reaction yield
        rscore.yieldScore = 0.5 * (gri.reaction.getYieldHi() + gri.reaction.getYieldLo());
        rscore.totalScore += rscore.yieldScore * reactionScoreSchema.yieldScoreWeight;
    }
    return rscore;
}
Also used : ReactionScore(ambit2.reactions.rules.scores.ReactionScore)

Example 2 with ReactionScore

use of ambit2.reactions.rules.scores.ReactionScore in project ambit-mirror by ideaconsult.

the class ReactionSequenceLevel method toString.

public String toString() {
    StringBuffer sb = new StringBuffer();
    sb.append("Level " + levelIndex + "\n");
    for (int i = 0; i < molecules.size(); i++) {
        String smi = null;
        try {
            IAtomContainer mol = molecules.get(i).clone();
            MoleculeTools.convertExplicitHAtomsToImplicit(mol);
            smi = SmartsHelper.moleculeToSMILES(mol, true);
        } catch (Exception x) {
        }
        ;
        sb.append("" + smi);
        sb.append("   " + MoleculeStatus.getShortString((MoleculeStatus) molecules.get(i).getProperty(ReactionSequence.MoleculeStatusProperty)));
        // sb.append("       " + molecules.get(i).getProperty(ReactionSequence.MoleculeInChIKeyProperty));
        Object[] obj = getGenerationInfo(i);
        if (obj != null) {
            GenericReaction genReaction = (GenericReaction) obj[0];
            sb.append("   <R" + genReaction.getExternId() + ",M" + ((Integer) obj[1] + 1));
            if (obj[2] != null) {
                ReactionScore rscore = (ReactionScore) obj[2];
                sb.append(",S" + ((Double) rscore.totalScore).intValue());
                sb.append(">");
                sb.append("     " + rscore.toStringLine());
            } else
                sb.append(">");
        }
        /*
			ReactionSequenceStep step = steps.get(i);
			if (step != null)
			{
				//TODO
			}
			*/
        sb.append("\n");
    }
    return sb.toString();
}
Also used : GenericReaction(ambit2.reactions.GenericReaction) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) ReactionScore(ambit2.reactions.rules.scores.ReactionScore)

Aggregations

ReactionScore (ambit2.reactions.rules.scores.ReactionScore)2 GenericReaction (ambit2.reactions.GenericReaction)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1