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;
}
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;
}
Aggregations