Skip to content

Commit

Permalink
WIP, ssld import: bond length in reaction rule spec
Browse files Browse the repository at this point in the history
  • Loading branch information
danv61 committed Aug 27, 2024
1 parent fcb270b commit 37f7b67
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions vcell-core/src/main/java/org/vcell/model/ssld/SsldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ public void importApplicationFromSsld(Mapping m) throws Exception {
final SsldModel ssldModel = m.getSsldModel();
SimulationContext simContext = m.getSimulationContext(); // default ssld application

// TODO: import application specific stuff here

GeometryContext geometryContext = simContext.getGeometryContext();
Geometry geometry = simContext.getGeometry();

Expand All @@ -356,13 +354,26 @@ public void importApplicationFromSsld(Mapping m) throws Exception {

for(SpeciesContextSpec scs : scSpecs) {
importSpeciesContextSpecForSsld(scs, m);

}
for(ReactionRuleSpec rrs : rrSpecs) {
importReactionRuleSpecForSsld(rrs, m);
}



}

private void importReactionRuleSpecForSsld(ReactionRuleSpec rrs, Mapping m) throws Exception {
ReactionRule rr = rrs.getReactionRule();
Reaction ssldReaction = m.get(rr);
if(!(ssldReaction instanceof BindingReaction)) {
return; // only the BindingReaction has extra ssld-specific parameters
}
BindingReaction ssldBindingReaction = (BindingReaction)ssldReaction;
double bondLength = ssldBindingReaction.getBondLength();
rrs.setFieldBondLength(bondLength);
}

private void importSpeciesContextSpecForSsld(SpeciesContextSpec scs, Mapping m) throws Exception {

Map<MolecularComponentPattern, SiteAttributesSpec> siteAttributesMap = new LinkedHashMap<>();
Expand Down Expand Up @@ -418,6 +429,9 @@ private void importSpeciesContextSpecForSsld(SpeciesContextSpec scs, Mapping m)
InitialCondition ssldIc = ssldMolecule.getInitialCondition();
Expression countExp = new Expression(ssldIc.getNumber());
countParam.setExpression(countExp);

// TODO: something is wrong here, it shows 0 in vcell UI

}

public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
Expand Down Expand Up @@ -609,7 +623,6 @@ public Mapping importPhysiologyFromSsld(SsldModel ssldModel) throws Exception {
reactionRule.addProduct(pp);
bioModel.getModel().getRbmModelContainer().addReactionRule(reactionRule);
m.put(ssldAllostericReaction, reactionRule);

}

// ---------- Transition Reactions
Expand Down Expand Up @@ -895,8 +908,6 @@ private void adjustTransitionReactionSites(TransitionReaction ssldReaction, Mapp
}
}



private void adjustProductSite(BindingReaction ssldReaction, Mapping m) {
Molecule ssldMoleculeOne = ssldReaction.getMolecule(0);
SiteType ssldSiteTypeOne = ssldReaction.getType(0);
Expand Down Expand Up @@ -984,8 +995,6 @@ private SpeciesPattern getSpeciesPattern(Molecule molecule, Mapping m) {
}
private MolecularTypePattern getMolecularTypePattern(Molecule molecule, Mapping m) {
MolecularTypePattern mtp = new MolecularTypePattern(m.get(molecule));


return mtp;
}

Expand Down

0 comments on commit 37f7b67

Please sign in to comment.