use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.
the class RbmObservable method resolveStates.
// TODO: this will have to go once we get rid of ComponentStatePattern
// use as a stopgap measure to eliminate a bug where the ComponentStatePattern is null
// instead of being Any (which happens when the MolecularComponent has states defined)
private void resolveStates() {
for (SpeciesPattern sp : speciesPatternList) {
for (MolecularTypePattern mtp : sp.getMolecularTypePatterns()) {
for (MolecularComponentPattern mcp : mtp.getComponentPatternList()) {
if (mcp.getComponentStatePattern() == null && mcp.getMolecularComponent().getComponentStateDefinitions().size() > 0) {
ComponentStatePattern csp = new ComponentStatePattern();
mcp.setComponentStatePattern(csp);
}
}
}
}
}
use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.
the class RbmObservable method findStateUsage.
public void findStateUsage(MolecularType mt, MolecularComponent mc, ComponentStateDefinition csd, Map<String, Pair<Displayable, SpeciesPattern>> usedHere) {
for (SpeciesPattern sp : getSpeciesPatternList()) {
for (MolecularTypePattern mtp : sp.getMolecularTypePatterns()) {
if (mtp.getMolecularType() == mt) {
List<MolecularComponentPattern> componentPatterns = mtp.getComponentPatternList();
for (MolecularComponentPattern mcp : componentPatterns) {
if (mcp.isImplied()) {
// we don't care about these
continue;
}
if (mcp.getMolecularComponent() == mc) {
// found mc in use
// now let's look at component state definition
ComponentStatePattern csp = mcp.getComponentStatePattern();
if (csp == null) {
continue;
}
if (csp.getComponentStateDefinition() == csd) {
String key = sp.getDisplayName();
key = getDisplayType() + getDisplayName() + key;
usedHere.put(key, new Pair<Displayable, SpeciesPattern>(this, sp));
}
}
}
}
}
}
}
use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.
the class RbmObservable method resolveBonds.
private void resolveBonds() {
for (SpeciesPattern sp : speciesPatternList) {
List<MolecularTypePattern> molecularTypePatterns = sp.getMolecularTypePatterns();
for (int i = 0; i < molecularTypePatterns.size(); ++i) {
molecularTypePatterns.get(i).setIndex(i + 1);
}
sp.resolveBonds();
}
}
use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.
the class ReactionRule method removeMatch.
public void removeMatch(String keyToRemove) {
// no need to specify where the key is, we remove it from everywhere
if (keyToRemove == null || keyToRemove.equals("*")) {
// nothing to remove if key is bad or no key
return;
}
int matches = 0;
for (ReactionRuleParticipant participant : reactantPatterns) {
List<MolecularTypePattern> molecularTypePatterns = participant.getSpeciesPattern().getMolecularTypePatterns();
for (MolecularTypePattern mtp : molecularTypePatterns) {
if (mtp.hasExplicitParticipantMatch() && mtp.getParticipantMatchLabel().equals(keyToRemove)) {
mtp.setParticipantMatchLabel("*");
matches++;
}
}
}
for (ReactionRuleParticipant participant : productPatterns) {
List<MolecularTypePattern> molecularTypePatterns = participant.getSpeciesPattern().getMolecularTypePatterns();
for (MolecularTypePattern mtp : molecularTypePatterns) {
if (mtp.hasExplicitParticipantMatch() && mtp.getParticipantMatchLabel().equals(keyToRemove)) {
mtp.setParticipantMatchLabel("*");
matches++;
}
}
}
if (matches > 1) {
throw new RuntimeException("Found more than one MolecularTypePatterns to remove matching the key " + keyToRemove);
}
}
use of org.vcell.model.rbm.MolecularTypePattern in project vcell by virtualcell.
the class ReactionRule method populateMaps.
public List<MolecularTypePattern> populateMaps(MolecularType mt, ReactionRuleParticipantType type) {
List<MolecularTypePattern> mtpList = new ArrayList<MolecularTypePattern>();
List<? extends ReactionRuleParticipant> patterns = (type == ReactionRuleParticipantType.Reactant) ? reactantPatterns : productPatterns;
for (ReactionRuleParticipant participant : patterns) {
List<MolecularTypePattern> molecularTypePatterns = participant.getSpeciesPattern().getMolecularTypePatterns();
for (MolecularTypePattern mtp : molecularTypePatterns) {
if (mtp.getMolecularType() == mt) {
mtpList.add(mtp);
}
}
}
return mtpList;
}
Aggregations