Skip to content

Commit

Permalink
WIP, testing model exchange between springsalad and vcell, roundtripp…
Browse files Browse the repository at this point in the history
…ing between the 2
  • Loading branch information
danv61 committed Sep 18, 2024
1 parent 1517731 commit 710dfab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static ReactionRuleMappingType fromDatabaseName(String databaseName){
}
}

public static final String ANY_STATE = "Any_State"; // SpringSaLaD stuff
public static final String ANY_STATE_STRING = "Any_State"; // SpringSaLaD stuff
private double fieldBondLength = 1; // only used for Subtype.BINDING reactions

public enum Subtype {
Expand Down Expand Up @@ -346,7 +346,7 @@ public void analizeReaction(Map<String, Object> analysisResults) {
if(cspReactant == null) {
stateReactant = "ERROR";
} else if(cspReactant.isAny()) {
stateReactant = ANY_STATE;
stateReactant = ANY_STATE_STRING;
} else {
ComponentStateDefinition csdReactant = cspReactant.getComponentStateDefinition();
stateReactant = csdReactant.getName();
Expand Down Expand Up @@ -703,7 +703,7 @@ private void writeTransitionData(StringBuilder sb, Subtype subtype, Map<String,

MolecularTypePattern mtpConditionReactant = null; // the bound condition molecule
MolecularComponentPattern mcpConditionReactant = null; // the bound condition site (must be bond type "Exists")
String stateConditionReactant = ANY_STATE;
String stateConditionReactant = ANY_STATE_STRING;

// we may have 2 mtp if the reaction condition is "Bound"!
List<ReactantPattern> rpList = reactionRule.getReactantPatterns(); // we already know that this list is not empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ private static void writeBindingReactions(StringBuilder sb) {
(new ArrayList<Map.Entry<ParticleMolecularTypePattern, ParticleMolecularComponentPattern>>(mapSet)).get(0);
Map.Entry<ParticleMolecularTypePattern, ParticleMolecularComponentPattern> elementTwo =
(new ArrayList<Map.Entry<ParticleMolecularTypePattern, ParticleMolecularComponentPattern>>(mapSet)).get(1);
String nameOne = "Any_State";
String nameTwo = "Any_State";
String nameOne = ReactionRuleSpec.ANY_STATE_STRING;
String nameTwo = ReactionRuleSpec.ANY_STATE_STRING;
if(elementOne.getValue().getComponentStatePattern().getParticleComponentStateDefinition() != null) {
nameOne = elementOne.getValue().getComponentStatePattern().getParticleComponentStateDefinition().getName();
}
Expand Down Expand Up @@ -659,7 +659,8 @@ private static void writeTransitionReactions(StringBuilder sb) {
}
// identify the binding condition site and state
for(ParticleMolecularComponentPattern pmcp : pmtpConditionReactant.getMolecularComponentPatternList()) {
if(pmcp.getComponentStatePattern().isAny()) {
// condition state may be "any". We need to look for an "existing" bond
if(!(pmcp.getBondType() == ParticleMolecularComponentPattern.ParticleBondType.Exists)) {
continue;
}
ParticleComponentStatePattern pcsp = pmcp.getComponentStatePattern();
Expand Down Expand Up @@ -708,7 +709,7 @@ private static void writeTransitionReactions(StringBuilder sb) {
if(TransitionCondition.BOUND == transitionCondition) {
sb.append(" '").append(pmtpConditionReactant.getMolecularType().getName()).append("' : '")
.append(pmcpConditionReactant.getMolecularComponent().getName()).append("' : '")
.append(pcsdConditionReactant);
.append(pmcpConditionReactant.getComponentStatePattern().isAny() ? ReactionRuleSpec.ANY_STATE_STRING : pcsdConditionReactant);
}
sb.append("\n");
} // end if Subtype.TRANSITION
Expand Down

0 comments on commit 710dfab

Please sign in to comment.