Skip to content

Commit

Permalink
Fixed import and export for Transition Condition FREE
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Oct 10, 2024
1 parent d8a86a6 commit 72c9b93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,11 @@ private void writeTransitionData(StringBuilder sb, Subtype subtype, Map<String,
List<ReactantPattern> rpList = reactionRule.getReactantPatterns(); // we already know that this list is not empty
List<MolecularTypePattern> mtpReactantList = rpList.get(0).getSpeciesPattern().getMolecularTypePatterns();

TransitionCondition transitionCondition = TransitionCondition.FREE; // molecules with just one site belong to free
TransitionCondition transitionCondition = TransitionCondition.NONE; // no restriction
if(mtpReactantList.size() == 1) { // transition reaction condition "None" or "Free"
for(MolecularComponentPattern mcpOtherReactant : mtpTransitionReactant.getComponentPatternList()) {
if(mcpOtherReactant != mcpTransitionReactant) {
if(BondType.None == mcpOtherReactant.getBondType()) {
// transition "None" has the bond types of all sites set to "None" (except the transitioning site which is "Possible")
transitionCondition = TransitionCondition.NONE;
break;
}
}
if(BondType.None == mcpTransitionReactant.getBondType()) {
// transition "FREE" has the bond types of all sites set to "Possible" (except the transitioning site which is Unbound)
transitionCondition = TransitionCondition.FREE;
}
} else if(mtpReactantList.size() == 2) { // transition reaction condition "Bound"
transitionCondition = TransitionCondition.BOUND;
Expand Down
20 changes: 5 additions & 15 deletions vcell-core/src/main/java/org/vcell/model/ssld/SsldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -991,14 +991,9 @@ private void adjustTransitionReactionSites(TransitionReaction ssldReaction, Mapp
ComponentStatePattern cspTransitionReactant = new ComponentStatePattern(csdInitial);
mcpTransitionReactant.setComponentStatePattern(cspTransitionReactant);
// bond is already set to Any
if(ssldReaction.getCondition().equals(TransitionReaction.NO_CONDITION)) {
for(MolecularComponentPattern mcp : mtpTransitionReactant.getComponentPatternList()) {
if(mcp == mcpTransitionReactant) {
continue;
}
mcp.setBondType(MolecularComponentPattern.BondType.None);
}
} else if(ssldReaction.getCondition().equals(TransitionReaction.BOUND_CONDITION)) {
if(ssldReaction.getCondition().equals(TransitionReaction.FREE_CONDITION)) {
mcpTransitionReactant.setBondType(MolecularComponentPattern.BondType.None);
} else if(ssldReaction.getCondition().equals(TransitionReaction.BOUND_CONDITION)) {
// we know for sure that this is the only explicit bond in each of the 2 molecular type patterns of the reactant
int bondId = 1; // correct would be: sp.nextBondId();
mcpConditionReactant.setBondId(bondId); // this also sets the BondType to Specified
Expand All @@ -1016,13 +1011,8 @@ private void adjustTransitionReactionSites(TransitionReaction ssldReaction, Mapp
ComponentStatePattern cspTransitionProduct = new ComponentStatePattern(csdFinal);
mcpTransitionProduct.setComponentStatePattern(cspTransitionProduct);
System.out.println(" " + ssldReaction.getCondition());
if(ssldReaction.getCondition().equals(TransitionReaction.NO_CONDITION)) {
for(MolecularComponentPattern mcp : mtpTransitionProduct.getComponentPatternList()) {
if(mcp == mcpTransitionProduct) {
continue;
}
mcp.setBondType(MolecularComponentPattern.BondType.None);
}
if(ssldReaction.getCondition().equals(TransitionReaction.FREE_CONDITION)) {
mcpTransitionProduct.setBondType(MolecularComponentPattern.BondType.None);
} else if(ssldReaction.getCondition().equals(TransitionReaction.BOUND_CONDITION)) {
// we know for sure that this is the only explicit bond in each of the 2 molecular type patterns of the product
int bondId = 1; // correct would be: sp.nextBondId();
Expand Down

0 comments on commit 72c9b93

Please sign in to comment.