Search in sources :

Example 71 with MolecularTypePattern

use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.

the class SpeciesContext method deleteStateFromPatterns.

public boolean deleteStateFromPatterns(MolecularType mt, MolecularComponent mc, ComponentStateDefinition csd) {
    if (!hasSpeciesPattern()) {
        return true;
    }
    SpeciesPattern sp = getSpeciesPattern();
    for (MolecularTypePattern mtp : sp.getMolecularTypePatterns()) {
        if (mtp.getMolecularType() == mt) {
            List<MolecularComponentPattern> componentPatterns = mtp.getComponentPatternList();
            for (MolecularComponentPattern mcp : componentPatterns) {
                if (!(mcp.getMolecularComponent() == mc)) {
                    continue;
                }
                ComponentStatePattern csp = mcp.getComponentStatePattern();
                if (csp == null) {
                    continue;
                }
                if (csp.isAny()) {
                    if (mc.getComponentStateDefinitions().size() == 1) {
                        mcp.setComponentStatePattern(null);
                    }
                    continue;
                }
                if (csp.getComponentStateDefinition() == csd) {
                    if (mc.getComponentStateDefinitions().size() == 1) {
                        // we are about to delete the last possible state, so we set the ComponentStatePattern to null
                        mcp.setComponentStatePattern(null);
                    } else {
                        // set to Any (may result in an Issue being raised)
                        csp = new ComponentStatePattern();
                        mcp.setComponentStatePattern(csp);
                    }
                }
            }
        }
    }
    return true;
}
Also used : MolecularComponentPattern(org.vcell.model.rbm.MolecularComponentPattern) ComponentStatePattern(org.vcell.model.rbm.ComponentStatePattern) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern)

Example 72 with MolecularTypePattern

use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.

the class PathwayMapping method generateSpeciesPattern.

private SpeciesPattern generateSpeciesPattern(BioModel bioModel, PhysicalEntity bioPaxObject, boolean addSubunits) {
    SpeciesPattern sp = new SpeciesPattern();
    if (bioPaxObject instanceof Complex) {
        Complex c = (Complex) bioPaxObject;
        for (PhysicalEntity pc : c.getComponents()) {
            MolecularType mt = createMolecularTypeFromBioPaxObject(bioModel, pc, addSubunits);
            MolecularTypePattern mtp = new MolecularTypePattern(mt);
            sp.addMolecularTypePattern(mtp);
        }
        return sp;
    } else {
        // else if(!(bioPaxObject instanceof Complex))
        MolecularType mt = createMolecularTypeFromBioPaxObject(bioModel, bioPaxObject, addSubunits);
        MolecularTypePattern mtp = new MolecularTypePattern(mt);
        sp.addMolecularTypePattern(mtp);
        return sp;
    }
// return null;
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) PhysicalEntity(org.vcell.pathway.PhysicalEntity) MolecularTypePattern(org.vcell.model.rbm.MolecularTypePattern) SpeciesPattern(org.vcell.model.rbm.SpeciesPattern) Complex(org.vcell.pathway.Complex)

Aggregations

MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)72 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)49 SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)39 ComponentStatePattern (org.vcell.model.rbm.ComponentStatePattern)19 Graphics (java.awt.Graphics)16 MolecularType (org.vcell.model.rbm.MolecularType)16 Point (java.awt.Point)14 BioModelNode (cbit.vcell.desktop.BioModelNode)11 RbmObservable (cbit.vcell.model.RbmObservable)10 SpeciesContext (cbit.vcell.model.SpeciesContext)10 Icon (javax.swing.Icon)10 ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)10 MolecularComponent (org.vcell.model.rbm.MolecularComponent)10 ArrayList (java.util.ArrayList)9 SpeciesPatternLargeShape (cbit.vcell.graph.SpeciesPatternLargeShape)7 ReactionRule (cbit.vcell.model.ReactionRule)7 LinkedHashMap (java.util.LinkedHashMap)7 MolecularTypeLargeShape (cbit.vcell.graph.MolecularTypeLargeShape)6 MolecularTypeSmallShape (cbit.vcell.graph.MolecularTypeSmallShape)6 RuleAnalysisChanged (cbit.vcell.graph.ReactionCartoon.RuleAnalysisChanged)6