Search in sources :

Example 91 with SpeciesPattern

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

the class SpeciesContext method findStateUsage.

public void findStateUsage(MolecularType mt, MolecularComponent mc, ComponentStateDefinition csd, Map<String, Pair<Displayable, SpeciesPattern>> usedHere) {
    if (!hasSpeciesPattern()) {
        return;
    }
    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) {
                    // here some state is always in use if available
                    ComponentStatePattern csp = mcp.getComponentStatePattern();
                    if (csp == null) {
                        System.out.println("This component " + mc.getName() + " should have had some State specified.");
                        continue;
                    }
                    if ((csp.getComponentStateDefinition() == csd) && (mcp.getBond() != null)) {
                        // we only care if there's a bond
                        String key = sp.getDisplayName();
                        key = getDisplayType() + getDisplayName() + key;
                        usedHere.put(key, new Pair<Displayable, SpeciesPattern>(this, sp));
                    }
                }
            }
        }
    }
}
Also used : Displayable(org.vcell.util.Displayable) 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 92 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern 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 93 with SpeciesPattern

use of org.vcell.model.rbm.SpeciesPattern 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

SpeciesPattern (org.vcell.model.rbm.SpeciesPattern)93 MolecularTypePattern (org.vcell.model.rbm.MolecularTypePattern)39 MolecularComponentPattern (org.vcell.model.rbm.MolecularComponentPattern)30 MolecularType (org.vcell.model.rbm.MolecularType)25 RbmObservable (cbit.vcell.model.RbmObservable)22 SpeciesContext (cbit.vcell.model.SpeciesContext)22 Structure (cbit.vcell.model.Structure)22 Point (java.awt.Point)18 ReactionRule (cbit.vcell.model.ReactionRule)16 ArrayList (java.util.ArrayList)16 ComponentStatePattern (org.vcell.model.rbm.ComponentStatePattern)16 Graphics (java.awt.Graphics)13 PropertyVetoException (java.beans.PropertyVetoException)13 SpeciesPatternLargeShape (cbit.vcell.graph.SpeciesPatternLargeShape)12 ProductPattern (cbit.vcell.model.ProductPattern)12 ReactantPattern (cbit.vcell.model.ReactantPattern)12 Dimension (java.awt.Dimension)12 ComponentStateDefinition (org.vcell.model.rbm.ComponentStateDefinition)12 Model (cbit.vcell.model.Model)11 ModelException (cbit.vcell.model.ModelException)11