Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
the XMLproducer for springsalad (springsalad-specific reaction rule spec
params)
  • Loading branch information
danv61 committed Sep 13, 2023
1 parent f58ea33 commit 5f3a9e1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
6 changes: 5 additions & 1 deletion vcell-core/src/main/java/cbit/vcell/xml/XMLTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -862,11 +862,15 @@ public class XMLTags {
public final static String SiteCoordXAttrTag = "SiteCoordX";
public final static String SiteCoordYAttrTag = "SiteCoordY";
public final static String SiteCoordZAttrTag = "SiteCoordZ";
public final static String BondLengthAttrTag = "BondLength";

public final static String InternalLinkSpecTag = "InternalLinkSpec";
public final static String SiteOneRefAttrTag = "SiteOneRef";
public final static String SiteTwoRefAttrTag = "SiteTwoRef";

public final static String BondLengthAttrTag = "BondLength";
public final static String SubTypeAttrTag = "SubType";
public final static String TransitionConditionAttrTag = "TransitionCondition";



}
25 changes: 21 additions & 4 deletions vcell-core/src/main/java/cbit/vcell/xml/Xmlproducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -128,6 +129,7 @@
import cbit.vcell.mapping.MolecularInternalLinkSpec;
import cbit.vcell.mapping.ParameterContext.LocalParameter;
import cbit.vcell.mapping.ParameterContext.ParameterRoleEnum;
import cbit.vcell.mapping.ReactionRuleSpec.TransitionCondition;
import cbit.vcell.mapping.RateRule;
import cbit.vcell.mapping.ReactionContext;
import cbit.vcell.mapping.ReactionRuleSpec;
Expand Down Expand Up @@ -1498,8 +1500,8 @@ private Element getXML(ReactionContext param) {
}
//Add ReactionRuleSpecs
ReactionRuleSpec[] reactionRuleArray = param.getReactionRuleSpecs();
if (reactionRuleArray.length>0){
reactioncontext.addContent( getXML(reactionRuleArray) );
if (reactionRuleArray.length>0) {
reactioncontext.addContent( getXML(reactionRuleArray, param.getSimulationContext()) );
}

return reactioncontext;
Expand All @@ -1523,13 +1525,28 @@ private Element getXML(ReactionSpec param) {
}

//For rateRules in SimulationContext
public Element getXML(ReactionRuleSpec[] reactionRuleSpecs) {
public Element getXML(ReactionRuleSpec[] reactionRuleSpecs, SimulationContext simContext) {
Element reactionRuleSpecsElement = new Element(XMLTags.ReactionRuleSpecsTag);
for (ReactionRuleSpec reactionRuleSpec : reactionRuleSpecs){
Element reactionRuleSpecElement = new Element(XMLTags.ReactionRuleSpecTag);
reactionRuleSpecElement.setAttribute(XMLTags.ReactionRuleRefAttrTag, mangle(reactionRuleSpec.getReactionRule().getName()));
reactionRuleSpecElement.setAttribute(XMLTags.ReactionRuleMappingAttrTag, mangle(reactionRuleSpec.getReactionRuleMapping().getDatabaseName()));

if(Application.SPRINGSALAD == simContext.getApplicationType()) {
reactionRuleSpecElement.setAttribute(XMLTags.BondLengthAttrTag, Double.toString(reactionRuleSpec.getFieldBondLength()));
//
// the next 2 attributes are sent only for debugging purposes, they are derived attributes and should be calculated at needed
//
Map<String, Object> analysisResults = new LinkedHashMap<> ();
reactionRuleSpec.analizeReaction(analysisResults);
ReactionRuleSpec.Subtype st = reactionRuleSpec.getSubtype(analysisResults);
reactionRuleSpecElement.setAttribute(XMLTags.SubTypeAttrTag, st.columnName);
if(ReactionRuleSpec.Subtype.TRANSITION == st) {
TransitionCondition tc = reactionRuleSpec.getTransitionCondition(analysisResults);
if(tc != null) {
reactionRuleSpecElement.setAttribute(XMLTags.TransitionConditionAttrTag, tc.vcellName);
}
}
}
reactionRuleSpecsElement.addContent(reactionRuleSpecElement);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public static String getAppComponentsForDatabase(SimulationContext simContext) {
// ReactionRuleSpecs
ReactionRuleSpec[] reactionRuleSpecs = simContext.getReactionContext().getReactionRuleSpecs();
if (reactionRuleSpecs != null && reactionRuleSpecs.length > 0){
Element reactionRuleSpecsElement = xmlProducer.getXML(reactionRuleSpecs);
Element reactionRuleSpecsElement = xmlProducer.getXML(reactionRuleSpecs, simContext);
appComponentsElement.addContent(reactionRuleSpecsElement);
}

Expand Down

0 comments on commit 5f3a9e1

Please sign in to comment.