Search in sources :

Example 1 with ModelRuleEntry

use of cbit.vcell.model.ModelRuleFactory.ModelRuleEntry in project vcell by virtualcell.

the class ParticipantSignatureShapePanel method refreshRuleAnalysis.

private void refreshRuleAnalysis() {
    reportMap.clear();
    modelRuleEntryMap.clear();
    bRuleAnalysisFailedMap.clear();
    if (reactionRuleMap == null || reactionRuleMap.isEmpty()) {
        return;
    }
    for (Map.Entry<String, ReactionRule> entry : reactionRuleMap.entrySet()) {
        String key = entry.getKey();
        ReactionRule rr = entry.getValue();
        ModelRuleFactory factory = new ModelRuleFactory();
        ModelRuleEntry modelRuleEntry = factory.createRuleEntry(rr, 0, ReactionRuleDirection.forward);
        try {
            RuleAnalysisReport report = RuleAnalysis.analyze(modelRuleEntry, false);
            reportMap.put(key, report);
            modelRuleEntryMap.put(key, modelRuleEntry);
            bRuleAnalysisFailedMap.put(key, false);
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println("exception computing RuleAnalysis report for " + key + ": " + e.getMessage());
            bRuleAnalysisFailedMap.put(key, true);
            bRuleAnalysisFailed = true;
        }
    }
}
Also used : ModelRuleFactory(cbit.vcell.model.ModelRuleFactory) RuleAnalysisReport(org.vcell.model.rbm.RuleAnalysisReport) ModelRuleEntry(cbit.vcell.model.ModelRuleFactory.ModelRuleEntry) ReactionRule(cbit.vcell.model.ReactionRule) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 2 with ModelRuleEntry

use of cbit.vcell.model.ModelRuleFactory.ModelRuleEntry in project vcell by virtualcell.

the class ParticipantSignatureShapePanel method hasStateChanged.

public RuleAnalysisChanged hasStateChanged(String key, MolecularComponentPattern molecularComponentPattern) {
    ReactionRule reactionRule = reactionRuleMap.get(key);
    if (reactionRule == null) {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
    ModelRuleEntry modelRuleEntry = modelRuleEntryMap.get(key);
    RuleAnalysisReport report = reportMap.get(key);
    if (modelRuleEntry == null || report == null) {
        System.out.println("modelRuleEntry == null || report == null,  NOT GOOD!");
    // refreshRuleAnalysis();
    }
    if (!bRuleAnalysisFailed && report != null) {
        MolecularComponentEntry molecularComponentEntry = modelRuleEntry.findMolecularComponentEntry(molecularComponentPattern);
        if (report.hasStateChanged(molecularComponentEntry)) {
            return RuleAnalysisChanged.CHANGED;
        } else {
            return RuleAnalysisChanged.UNCHANGED;
        }
    } else {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
}
Also used : RuleAnalysisReport(org.vcell.model.rbm.RuleAnalysisReport) ModelRuleEntry(cbit.vcell.model.ModelRuleFactory.ModelRuleEntry) ReactionRule(cbit.vcell.model.ReactionRule) MolecularComponentEntry(org.vcell.model.rbm.RuleAnalysis.MolecularComponentEntry)

Example 3 with ModelRuleEntry

use of cbit.vcell.model.ModelRuleFactory.ModelRuleEntry in project vcell by virtualcell.

the class ParticipantSignatureShapePanel method hasBondChanged.

public RuleAnalysisChanged hasBondChanged(String key, MolecularComponentPattern molecularComponentPattern) {
    ReactionRule reactionRule = reactionRuleMap.get(key);
    if (reactionRule == null) {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
    ModelRuleEntry modelRuleEntry = modelRuleEntryMap.get(key);
    RuleAnalysisReport report = reportMap.get(key);
    if (modelRuleEntry == null || report == null) {
        System.out.println("modelRuleEntry == null || report == null,  NOT GOOD!");
    // refreshRuleAnalysis();
    }
    if (!bRuleAnalysisFailed && report != null) {
        MolecularComponentEntry molecularComponentEntry = modelRuleEntry.findMolecularComponentEntry(molecularComponentPattern);
        if (report.hasBondChanged(molecularComponentEntry)) {
            return RuleAnalysisChanged.CHANGED;
        } else {
            return RuleAnalysisChanged.UNCHANGED;
        }
    } else {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
}
Also used : RuleAnalysisReport(org.vcell.model.rbm.RuleAnalysisReport) ModelRuleEntry(cbit.vcell.model.ModelRuleFactory.ModelRuleEntry) ReactionRule(cbit.vcell.model.ReactionRule) MolecularComponentEntry(org.vcell.model.rbm.RuleAnalysis.MolecularComponentEntry)

Example 4 with ModelRuleEntry

use of cbit.vcell.model.ModelRuleFactory.ModelRuleEntry in project vcell by virtualcell.

the class ParticipantSignatureShapePanel method hasNoMatch.

public RuleAnalysisChanged hasNoMatch(String key, MolecularTypePattern molecularTypePattern) {
    ReactionRule reactionRule = reactionRuleMap.get(key);
    if (reactionRule == null) {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
    ModelRuleEntry modelRuleEntry = modelRuleEntryMap.get(key);
    RuleAnalysisReport report = reportMap.get(key);
    if (modelRuleEntry == null || report == null) {
        System.out.println("modelRuleEntry == null || report == null,  NOT GOOD!");
    // refreshRuleAnalysis();
    }
    if (!bRuleAnalysisFailed && report != null) {
        MolecularTypeEntry molecularTypeEntry = modelRuleEntry.findMolecularTypeEntry(molecularTypePattern);
        if (report.hasNoMatch(molecularTypeEntry)) {
            return RuleAnalysisChanged.CHANGED;
        } else {
            return RuleAnalysisChanged.UNCHANGED;
        }
    } else {
        return RuleAnalysisChanged.ANALYSISFAILED;
    }
}
Also used : RuleAnalysisReport(org.vcell.model.rbm.RuleAnalysisReport) ModelRuleEntry(cbit.vcell.model.ModelRuleFactory.ModelRuleEntry) ReactionRule(cbit.vcell.model.ReactionRule) MolecularTypeEntry(org.vcell.model.rbm.RuleAnalysis.MolecularTypeEntry)

Aggregations

ModelRuleEntry (cbit.vcell.model.ModelRuleFactory.ModelRuleEntry)4 ReactionRule (cbit.vcell.model.ReactionRule)4 RuleAnalysisReport (org.vcell.model.rbm.RuleAnalysisReport)4 MolecularComponentEntry (org.vcell.model.rbm.RuleAnalysis.MolecularComponentEntry)2 ModelRuleFactory (cbit.vcell.model.ModelRuleFactory)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 MolecularTypeEntry (org.vcell.model.rbm.RuleAnalysis.MolecularTypeEntry)1