From d113dc4560f01484eab3668630fc2f5cbea4fc19 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Tue, 12 Nov 2024 14:35:21 -0500 Subject: [PATCH 1/9] WIP --- .../vcell/mapping/NetworkTransformer.java | 21 +++++++++++++++++++ .../src/main/java/cbit/vcell/model/Model.java | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java index 32c4862ada..cd6326e400 100644 --- a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java +++ b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java @@ -745,9 +745,17 @@ private void transform(SimulationContext simContext, SimulationContext transform mathMappingCallback.setMessage("generating network: adding observables..."); mathMappingCallback.setProgressFraction(progressFractionQuota/8.0f*7.0f); startTime = System.currentTimeMillis(); + + long removeObsTime = 0; + long addParamTime = 0; + long st; // start + long et; // end + + System.out.println("\nObservables :"); RbmModelContainer rbmmc = model.getRbmModelContainer(); for (int i = 0; i < outputSpec.getObservableGroups().length; i++){ + ObservableGroup o = outputSpec.getObservableGroups()[i]; // System.out.println(i+1 + ":\t\t" + o.toString()); @@ -764,8 +772,19 @@ private void transform(SimulationContext simContext, SimulationContext transform exp.bindExpression(rbmmc.getSymbolTable()); RbmObservable originalObservable = rbmmc.getObservable(o.getObservableGroupName()); VCUnitDefinition observableUnitDefinition = originalObservable.getUnitDefinition(); + + st = System.currentTimeMillis(); // ========================== rbmmc.removeObservable(originalObservable); + et = System.currentTimeMillis(); // ========================== + removeObsTime += (et-st); + + + st = System.currentTimeMillis(); // ========================== Parameter newParameter = rbmmc.addParameter(o.getObservableGroupName(), exp, observableUnitDefinition); + et = System.currentTimeMillis(); // ========================== + addParamTime += (et-st); + + RbmObservable origObservable = simContext.getModel().getRbmModelContainer().getObservable(o.getObservableGroupName()); ModelEntityMapping em = new ModelEntityMapping(origObservable,newParameter); @@ -781,6 +800,8 @@ private void transform(SimulationContext simContext, SimulationContext transform elapsedTime = endTime - startTime; msg = "Adding " + outputSpec.getObservableGroups().length + " observables to model, " + elapsedTime + " ms"; System.out.println(msg); + msg = "removeObsTime: " + removeObsTime + ", addParamTime: " + addParamTime; + System.out.println(msg); } catch (PropertyVetoException | ModelException | ExpressionException | ClassNotFoundException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); diff --git a/vcell-core/src/main/java/cbit/vcell/model/Model.java b/vcell-core/src/main/java/cbit/vcell/model/Model.java index 319b8f2630..7d08e372ab 100644 --- a/vcell-core/src/main/java/cbit/vcell/model/Model.java +++ b/vcell-core/src/main/java/cbit/vcell/model/Model.java @@ -1611,7 +1611,8 @@ public Parameter addFunction(String name, Expression expression, VCUnitDefinitio } public Parameter addParameter(String name, Expression expression, VCUnitDefinition unitDefinition) throws ModelException, PropertyVetoException{ - return Model.this.addModelParameter(new ModelParameter(name, expression, ROLE_UserDefined, unitDefinition)); + ModelParameter mp = new ModelParameter(name, expression, ROLE_UserDefined, unitDefinition); + return Model.this.addModelParameter(mp); } public RbmObservable getObservable(String obName){ From 68f793e1ed2f7e00ca9887a2674891f8408a77c5 Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Thu, 14 Nov 2024 14:17:16 -0500 Subject: [PATCH 2/9] Fix for PR #1336 Generation of Observables takes a long time --- .../ReactionRulePropertiesTableModel.java | 5 --- .../vcell/mapping/NetworkTransformer.java | 6 ++- .../src/main/java/cbit/vcell/model/Model.java | 44 +++++++++++++++---- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ReactionRulePropertiesTableModel.java b/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ReactionRulePropertiesTableModel.java index 6db7a855f8..60c53974e6 100644 --- a/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ReactionRulePropertiesTableModel.java +++ b/vcell-client/src/main/java/cbit/vcell/client/desktop/biomodel/ReactionRulePropertiesTableModel.java @@ -310,11 +310,6 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { } } -/** - * Sets the geometry property (cbit.vcell.geometry.Geometry) value. - * @param geometry The new value for the property. - * @see #getGeometry - */ public void setReactionRule(ReactionRule newValue) { ReactionRule oldValue = reactionRule; reactionRule = newValue; diff --git a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java index cd6326e400..7a549cf128 100644 --- a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java +++ b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java @@ -753,6 +753,8 @@ private void transform(SimulationContext simContext, SimulationContext transform System.out.println("\nObservables :"); + // we delete all observables; instead, for each of them we create a user-defined global parameter + // which is the sum of all generated (by flattening) species that satisfy the observable pattern RbmModelContainer rbmmc = model.getRbmModelContainer(); for (int i = 0; i < outputSpec.getObservableGroups().length; i++){ @@ -774,13 +776,13 @@ private void transform(SimulationContext simContext, SimulationContext transform VCUnitDefinition observableUnitDefinition = originalObservable.getUnitDefinition(); st = System.currentTimeMillis(); // ========================== - rbmmc.removeObservable(originalObservable); + rbmmc.removeObservable(originalObservable, Model.PropertyNotificationMode.Silent); et = System.currentTimeMillis(); // ========================== removeObsTime += (et-st); st = System.currentTimeMillis(); // ========================== - Parameter newParameter = rbmmc.addParameter(o.getObservableGroupName(), exp, observableUnitDefinition); + Parameter newParameter = rbmmc.addParameter(o.getObservableGroupName(), exp, observableUnitDefinition, Model.PropertyNotificationMode.Silent); et = System.currentTimeMillis(); // ========================== addParamTime += (et-st); diff --git a/vcell-core/src/main/java/cbit/vcell/model/Model.java b/vcell-core/src/main/java/cbit/vcell/model/Model.java index 7d08e372ab..a5a1681fe2 100644 --- a/vcell-core/src/main/java/cbit/vcell/model/Model.java +++ b/vcell-core/src/main/java/cbit/vcell/model/Model.java @@ -1572,7 +1572,10 @@ public ReactionRule createReactionRule(String label, Structure structure, boolea return new ReactionRule(Model.this, label, structure, bReversible); } - public final void setObservableList(List newValue) throws PropertyVetoException{ + public final void setObservableList(List newValue) throws PropertyVetoException { + setObservableList(newValue, PropertyNotificationMode.Loud); + } + public final void setObservableList(List newValue, PropertyNotificationMode mode) throws PropertyVetoException{ List oldValue = observableList; fireVetoableChange(RbmModelContainer.PROPERTY_NAME_OBSERVABLE_LIST, oldValue, newValue); if(oldValue != null){ @@ -1590,7 +1593,9 @@ public final void setObservableList(List newValue) throws Propert mt.setModel(Model.this); } } - firePropertyChange(RbmModelContainer.PROPERTY_NAME_OBSERVABLE_LIST, oldValue, newValue); + if(mode == PropertyNotificationMode.Loud) { + firePropertyChange(RbmModelContainer.PROPERTY_NAME_OBSERVABLE_LIST, oldValue, newValue); + } } public List getMolecularTypeList(){ @@ -1610,9 +1615,14 @@ public Parameter addFunction(String name, Expression expression, VCUnitDefinitio return Model.this.addModelParameter(new ModelParameter(name, expression, ROLE_UserDefined, unitDefinition)); } - public Parameter addParameter(String name, Expression expression, VCUnitDefinition unitDefinition) throws ModelException, PropertyVetoException{ + public Parameter addParameter(String name, Expression expression, VCUnitDefinition unitDefinition, PropertyNotificationMode mode) throws ModelException, PropertyVetoException { ModelParameter mp = new ModelParameter(name, expression, ROLE_UserDefined, unitDefinition); - return Model.this.addModelParameter(mp); + return Model.this.addModelParameter(mp, mode); + + } + public Parameter addParameter(String name, Expression expression, VCUnitDefinition unitDefinition) throws ModelException, PropertyVetoException{ + Parameter ret = addParameter(name, expression, unitDefinition, PropertyNotificationMode.Loud); + return ret; } public RbmObservable getObservable(String obName){ @@ -1640,12 +1650,16 @@ public Parameter getParameter(String obName){ } public boolean removeObservable(RbmObservable observable) throws PropertyVetoException{ + boolean ret = removeObservable(observable, PropertyNotificationMode.Loud); + return ret; + } + public boolean removeObservable(RbmObservable observable, PropertyNotificationMode mode) throws PropertyVetoException{ if(!observableList.contains(observable)){ return false; } ArrayList newValue = new ArrayList(observableList); newValue.remove(observable); - setObservableList(newValue); + setObservableList(newValue, mode); return true; } @@ -1958,6 +1972,11 @@ public void adjustRulesPatterns(MolecularType mt, MolecularComponent mc){ } } + public enum PropertyNotificationMode { + Silent, + Loud + } + public Model(Version argVersion){ this(argVersion, ModelUnitSystem.createDefaultVCModelUnitSystem()); } @@ -2053,11 +2072,14 @@ private ReservedSymbol[] createReservedSymbols(){ // ModelParameter modelParameter = new ModelParameter(name, expr, role, units); // return modelParameter; //} - public ModelParameter addModelParameter(Model.ModelParameter modelParameter) throws PropertyVetoException{ + ModelParameter ret = addModelParameter(modelParameter, PropertyNotificationMode.Loud); + return ret; + } + public ModelParameter addModelParameter(Model.ModelParameter modelParameter, PropertyNotificationMode mode) throws PropertyVetoException{ // if (!contains(modelParameter)){ Model.ModelParameter[] newModelParameters = ArrayUtils.addElement(fieldModelParameters, modelParameter); - setModelParameters(newModelParameters); + setModelParameters(newModelParameters, mode); // } return modelParameter; } @@ -3722,12 +3744,16 @@ public void setDiagrams(int index, Diagram diagrams){ ; } - public void setModelParameters(ModelParameter[] modelParameters) throws java.beans.PropertyVetoException{ + setModelParameters(modelParameters, PropertyNotificationMode.Loud); + } + public void setModelParameters(ModelParameter[] modelParameters, PropertyNotificationMode mode) throws java.beans.PropertyVetoException{ ModelParameter[] oldValue = fieldModelParameters; fireVetoableChange(Model.PROPERTY_NAME_MODEL_PARAMETERS, oldValue, modelParameters); fieldModelParameters = modelParameters; - firePropertyChange(Model.PROPERTY_NAME_MODEL_PARAMETERS, oldValue, modelParameters); + if(mode == PropertyNotificationMode.Loud) { + firePropertyChange(Model.PROPERTY_NAME_MODEL_PARAMETERS, oldValue, modelParameters); + } //System.out.print("vcModel model parameters ["); //for (ModelParameter p : oldValue){ From 8acdb85f57ec8b0733e4f22542a401617dc9ff1f Mon Sep 17 00:00:00 2001 From: jcschaff Date: Thu, 14 Nov 2024 17:43:09 -0500 Subject: [PATCH 3/9] support Infinity and NaN in SBML values and MathML --- .../org/vcell/sbml/vcell/SBMLImporter.java | 25 ++++++++++++++++--- .../org/vcell/sbml/SBMLTestSuiteTest.java | 2 -- .../vcell/parser/ExpressionMathMLParser.java | 14 ++++++++++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/vcell-core/src/main/java/org/vcell/sbml/vcell/SBMLImporter.java b/vcell-core/src/main/java/org/vcell/sbml/vcell/SBMLImporter.java index bcb17b58d3..3e0cb7e070 100644 --- a/vcell-core/src/main/java/org/vcell/sbml/vcell/SBMLImporter.java +++ b/vcell-core/src/main/java/org/vcell/sbml/vcell/SBMLImporter.java @@ -2975,18 +2975,35 @@ private static void addOutputFunctions(org.sbml.jsbml.Model sbmlModel, BioModel private static void applySavedExpressions(org.sbml.jsbml.Model sbmlModel, SBMLSymbolMapping sbmlSymbolMapping, VCLogger vcLogger) throws Exception{ for(SBase sbmlValueTargetSbase : sbmlSymbolMapping.getSbmlValueTargets()){ Double sbmlValue = sbmlSymbolMapping.getSbmlValue(sbmlValueTargetSbase); - if(sbmlValue != null && !sbmlValue.isInfinite() && !sbmlValue.isNaN()){ + final Expression sbmlValueExp; + if (sbmlValue != null) { + if (sbmlValue.isInfinite() && sbmlValue > 0) { + sbmlValueExp = new Expression(Double.MAX_VALUE); + logger.debug("setting infinite value for SBML id " + sbmlValueTargetSbase.getId() + " to " + Double.MAX_VALUE); + } else if (sbmlValue.isInfinite() && sbmlValue < 0){ + sbmlValueExp = new Expression(-Double.MAX_VALUE); + logger.debug("setting infinite value for SBML id " + sbmlValueTargetSbase.getId() + " to " + -Double.MAX_VALUE); + } else if (sbmlValue.isNaN()){ + sbmlValueExp = new Expression("0/0"); + logger.debug("setting NaN value for SBML id " + sbmlValueTargetSbase.getId() + " to 0/0"); + } else { + sbmlValueExp = new Expression(sbmlValue); + } + } else { + sbmlValueExp = null; + } + if(sbmlValueExp != null){ EditableSymbolTableEntry targetSte = sbmlSymbolMapping.getInitialSte(sbmlValueTargetSbase); try { if(targetSte != null){ if(targetSte.isExpressionEditable()){ - targetSte.setExpression(new Expression(sbmlValue)); + targetSte.setExpression(sbmlValueExp); } } else { targetSte = sbmlSymbolMapping.getRuntimeSte(sbmlValueTargetSbase); if(targetSte != null){ if(targetSte.isExpressionEditable()){ - targetSte.setExpression(new Expression(sbmlValue)); + targetSte.setExpression(sbmlValueExp); } } else { logger.error("couldn't find vcell object mapped to sbml object: " + sbmlValueTargetSbase); @@ -2998,7 +3015,7 @@ private static void applySavedExpressions(org.sbml.jsbml.Model sbmlModel, SBMLSy vcLogger.sendMessage(VCLogger.Priority.HighPriority, VCLogger.ErrorType.OverallWarning, msg); } } else { - String msg = "missing or unexpected value attribute '" + sbmlValue + "' for SBML object id " + sbmlValueTargetSbase.getId(); + String msg = "missing value attribute for SBML object id " + sbmlValueTargetSbase.getId(); logger.error(msg); vcLogger.sendMessage(VCLogger.Priority.HighPriority, VCLogger.ErrorType.OverallWarning, msg); } diff --git a/vcell-core/src/test/java/org/vcell/sbml/SBMLTestSuiteTest.java b/vcell-core/src/test/java/org/vcell/sbml/SBMLTestSuiteTest.java index 439fa4a32e..c7ecfc0974 100644 --- a/vcell-core/src/test/java/org/vcell/sbml/SBMLTestSuiteTest.java +++ b/vcell-core/src/test/java/org/vcell/sbml/SBMLTestSuiteTest.java @@ -374,8 +374,6 @@ public static Collection testCases() { faults.put(943, FAULT.DELAY); faults.put(945, FAULT.STRUCTURE_SIZE_IN_ASSIGNMENT_RULE); faults.put(947, FAULT.STRUCTURE_SIZE_IN_ASSIGNMENT_RULE); - faults.put(950, FAULT.VALUE_NAN_INF_OR_MISSING); - faults.put(951, FAULT.VALUE_NAN_INF_OR_MISSING); faults.put(957, FAULT.XOR_MISSING); faults.put(958, FAULT.XOR_MISSING); faults.put(959, FAULT.INCONSISTENT_UNIT_SYSTEM); diff --git a/vcell-math/src/main/java/cbit/vcell/parser/ExpressionMathMLParser.java b/vcell-math/src/main/java/cbit/vcell/parser/ExpressionMathMLParser.java index 8fc9d7c1b9..3fdd14b178 100644 --- a/vcell-math/src/main/java/cbit/vcell/parser/ExpressionMathMLParser.java +++ b/vcell-math/src/main/java/cbit/vcell/parser/ExpressionMathMLParser.java @@ -497,7 +497,19 @@ private SimpleNode getRootNode(Element nodeMathML, String timeSymbol) throws Exp } else { throw new ExpressionException("csymbol node type "+nodeMathML.getAttributeValue(MathMLTags.DEFINITIONURL)+" not supported yet"); } - } else{ + } else if (nodeMathML.getName().equals(MathMLTags.NOT_A_NUMBER)){ + ASTFloatNode zeroNode = new ASTFloatNode(0.0); + ASTFloatNode zeroNode2 = new ASTFloatNode(0.0); + ASTInvertTermNode invNode = new ASTInvertTermNode(); + invNode.jjtAddChild(zeroNode2); + ASTMultNode multNode = new ASTMultNode(); + multNode.jjtAddChild(zeroNode); + multNode.jjtAddChild(invNode); + return multNode; + } else if (nodeMathML.getName().equals(MathMLTags.INFINITY)) { + ASTFloatNode infNode = new ASTFloatNode(Double.MAX_VALUE); + return infNode; + }else{ throw new ExpressionException("node type '"+nodeMathML.getName()+"' not supported yet"); } } From 355c69ef44b0d480a6b80083801ac06ffd416cbf Mon Sep 17 00:00:00 2001 From: jcschaff Date: Fri, 15 Nov 2024 01:35:17 -0500 Subject: [PATCH 4/9] add unit test for infinity and NaN from MathML --- .../java/cbit/vcell/parser/MathMLTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/vcell-math/src/test/java/cbit/vcell/parser/MathMLTest.java b/vcell-math/src/test/java/cbit/vcell/parser/MathMLTest.java index 1c28811272..4aa7cd985b 100644 --- a/vcell-math/src/test/java/cbit/vcell/parser/MathMLTest.java +++ b/vcell-math/src/test/java/cbit/vcell/parser/MathMLTest.java @@ -80,6 +80,26 @@ public void testMathMLParsing_XOR() throws IOException, ExpressionException { assertTrue(equiv, msg); } + @Test + public void testNaN_MathmlParsing() throws ExpressionException { + String nanMathML = ""; + Expression exp = new ExpressionMathMLParser(null).fromMathML(nanMathML, "t"); + Expression expectedExp = new Expression("0/0"); + boolean equiv = ExpressionUtils.functionallyEquivalent(exp, expectedExp, true); + String msg = "not equivalent: origExp='"+exp.infix()+"', expMathML='"+expectedExp.infix()+"'"; + assertTrue(equiv, msg); + } + + @Test + public void testInfinity_MathmlParsing() throws ExpressionException { + String nanMathML = ""; + Expression exp = new ExpressionMathMLParser(null).fromMathML(nanMathML, "t"); + Expression expectedExp = new Expression(Double.MAX_VALUE); + boolean equiv = ExpressionUtils.functionallyEquivalent(exp, expectedExp, true); + String msg = "not equivalent: origExp='"+exp.infix()+"', expMathML='"+expectedExp.infix()+"'"; + assertTrue(equiv, msg); + } + @ParameterizedTest @MethodSource("testCases") From a539a5d036dd883abe3cf15904d616e7b9f93fa2 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Fri, 15 Nov 2024 01:47:50 -0500 Subject: [PATCH 5/9] new failure mode for SBML test suite model 696 after supporting NaN --- .../src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java b/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java index 7bbc1702ad..6cad88769a 100644 --- a/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java +++ b/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java @@ -157,7 +157,7 @@ public static Map knownFaults() { faults.put(627, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_123' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that y faults.put(628, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_8' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that you faults.put(632, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'k4b' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that you have pro - faults.put(696, SBMLTestSuiteTest.FAULT.MATHML_PARSING); // cause: Error adding Lambda function UnsupportedConstruct: error parsing expression ' ': node type 'notanumber' not supported yet + faults.put(696, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_16' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that yo faults.put(705, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_21' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that yo faults.put(706, SBMLTestSuiteTest.FAULT.UNCATEGORIZED); // cause: found more than one SBase match for sid=v, matched [org.vcell.sbml.vcell.SBMLSymbolMapping$SBaseWrapper@67cc48df, org.vcell.sbml.vcell.SBMLSymbolMapping$SBaseWrapper@483ac21f] faults.put(710, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_0_0' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that y From 5c6cbd44e5ecebe947f52aceb0bf82e19a22b0ed Mon Sep 17 00:00:00 2001 From: jcschaff Date: Fri, 15 Nov 2024 02:01:29 -0500 Subject: [PATCH 6/9] SBML Test suite model 952 works now that NaN supported --- vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java b/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java index 6cad88769a..7285e492b2 100644 --- a/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java +++ b/vcell-core/src/test/java/org/vcell/sbml/BMDB_SBMLImportTest.java @@ -179,7 +179,6 @@ public static Map knownFaults() { faults.put(872, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'beta' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that you have pr faults.put(908, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_2' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that you faults.put(925, SBMLTestSuiteTest.FAULT.UNCATEGORIZED); // cause: OverallWarning: missing or unexpected value attribute '-Infinity' for SBML object id log_time - faults.put(952, SBMLTestSuiteTest.FAULT.MATHML_PARSING); // cause: Error adding Lambda function UnsupportedConstruct: error parsing expression ' ': node type 'notanumber' not supported yet faults.put(956, SBMLTestSuiteTest.FAULT.MATHML_PARSING); // cause: Error adding Lambda function UnsupportedConstruct: error parsing expression ' ': node type 'notanumber' not supported yet faults.put(961, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'rateOf_re15' to model: 're15' is either not found in your model or is not allowed to be used in the current context. Check that you have provided t faults.put(969, SBMLTestSuiteTest.FAULT.EXPRESSION_BINDING_EXCEPTION); // cause: Error binding global parameter 'Metabolite_11' to model: 'UNRESOLVED.initConc' is either not found in your model or is not allowed to be used in the current context. Check that yo From d38dadb29323e6c193eba3e238cec274da4033f6 Mon Sep 17 00:00:00 2001 From: Logan Drescher Date: Fri, 8 Nov 2024 14:22:01 -0500 Subject: [PATCH 7/9] Using OIDC method of permission --- .github/workflows/CI-full.yml | 4 ++-- .github/workflows/ci_cd.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI-full.yml b/.github/workflows/CI-full.yml index cb5318ffea..45f85a3bfa 100644 --- a/.github/workflows/CI-full.yml +++ b/.github/workflows/CI-full.yml @@ -98,8 +98,8 @@ jobs: shell: bash run: | cd docker/build - sudo docker login -u ${{ secrets.ACTION_USER }} -p ${{ secrets.ACTION_TOKEN }} ghcr.io - docker login -u ${{ secrets.ACTION_USER }} -p ${{ secrets.ACTION_TOKEN }} ghcr.io + echo "${{ secrets.GITHUB_TOKEN }}" | sudo docker login ghcr.io -u ${{ github.actor }} --password-stdin + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin ./build.sh all ${{ env.VCELL_REPO_NAMESPACE }} ${{ env.VCELL_TAG }} - name: tag as latest and push to registry diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index a2578d23db..20fe0b789a 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -267,7 +267,7 @@ jobs: REVISION=$(git rev-parse HEAD) CREATED=$(date --rfc-3339=seconds | sed 's/ /T/') sed -i 's/_VC_VERSION_TAG_/${{steps.version.outputs.tag}}/g' biosimulators.json - echo ${{ secrets.ACTION_TOKEN }} | docker login ghcr.io -u ${{ secrets.ACTION_USER }} --password-stdin + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin docker build \ --no-cache \ --file Dockerfile \ From de075a3e13c12c7bfd099abfa0c7e10dec1b420d Mon Sep 17 00:00:00 2001 From: Logan Drescher Date: Tue, 12 Nov 2024 11:09:42 -0500 Subject: [PATCH 8/9] More token updates --- .github/workflows/bsts_local.yml | 2 +- .github/workflows/create_bs_singularity.yml | 4 ++-- .github/workflows/site_deploy.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bsts_local.yml b/.github/workflows/bsts_local.yml index 6dcd059589..2c7537f130 100644 --- a/.github/workflows/bsts_local.yml +++ b/.github/workflows/bsts_local.yml @@ -91,7 +91,7 @@ jobs: - name: Login into Docker registries run: | # VCell Docker registry (GHCR) - docker login ghcr.io --username ${{ secrets.GHCR_USERNAME }} --password ${{ secrets.GHCR_TOKEN }} + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - id: validateCommitSimulator name: Validate and commit simulator diff --git a/.github/workflows/create_bs_singularity.yml b/.github/workflows/create_bs_singularity.yml index 2a5b019072..b9b4bf73e1 100644 --- a/.github/workflows/create_bs_singularity.yml +++ b/.github/workflows/create_bs_singularity.yml @@ -64,7 +64,7 @@ jobs: REVISION=$(git rev-parse HEAD) CREATED=$(date --rfc-3339=seconds | sed 's/ /T/') sed -i 's/_VC_VERSION_TAG_/${VCELL_SHA}/g' biosimulators.json - echo ${{ secrets.ACTION_TOKEN }} | docker login ghcr.io -u ${{ secrets.ACTION_USER }} --password-stdin + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin docker build \ --no-cache \ --file Dockerfile \ @@ -77,7 +77,7 @@ jobs: . docker push --all-tags ghcr.io/virtualcell/biosimulators_vcell singularity build biosimulators_vcell_${VCELL_SHA}.img docker:ghcr.io/virtualcell/biosimulators_vcell:${VCELL_SHA} - singularity remote login -u ${{ secrets.ACTION_USER }} -p ${{ secrets.ACTION_TOKEN }} oras://ghcr.io + singularity remote login -u "${{ secrets.GITHUB_TOKEN }}" -p ${{ github.actor }} oras://ghcr.io singularity push -U biosimulators_vcell_${VCELL_SHA}.img oras://ghcr.io/virtualcell/biosimulators_vcell_singularity:${VCELL_SHA} - name: Setup tmate session diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 8c7cf0cf90..0254ae6209 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -87,7 +87,7 @@ jobs: if: ${{ github.event.inputs.server_only != 'true' }} run: | cd docker/swarm - sudo docker login -u ${{ secrets.ACTION_USER }} -p ${{ secrets.ACTION_TOKEN }} ghcr.io + echo "${{ secrets.GITHUB_TOKEN }}" | sudo docker login ghcr.io -u ${{ github.actor }} --password-stdin sudo docker pull $VCELL_REPO_NAMESPACE/vcell-clientgen:$VCELL_TAG ./generate_installers.sh ./${VCELL_CONFIG_FILE_NAME} - name: upload generated installers @@ -197,7 +197,7 @@ jobs: run: | set -ux cd docker/swarm - ssh -t ${{ secrets.CD_FULL_USER }}@${VCELL_MANAGER_NODE} sudo docker login -u ${{ secrets.ACTION_USER }} -p ${{ secrets.ACTION_TOKEN }} ghcr.io + ssh -t ${{ secrets.CD_FULL_USER }}@${VCELL_MANAGER_NODE} sudo docker login -u ${{ github.actor }} -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io if ${{ github.event.inputs.server_only != 'true' }}; then # build and install the client installers, and the web help (kubernetes cluster deployments are separate) ./deploy-action-kubernetes.sh \ From 64b68a203e53238fd393fe5d14a99ae577127f6f Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Fri, 15 Nov 2024 12:48:20 -0500 Subject: [PATCH 9/9] Fix for PR #1336 Generation of Observables takes a long time --- .../vcell/mapping/NetworkTransformer.java | 149 ++++++++---------- 1 file changed, 66 insertions(+), 83 deletions(-) diff --git a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java index 7a549cf128..79b0113baa 100644 --- a/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java +++ b/vcell-core/src/main/java/cbit/vcell/mapping/NetworkTransformer.java @@ -11,6 +11,8 @@ import java.util.List; import java.util.Map; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.vcell.model.bngl.ParseException; import org.vcell.model.rbm.FakeReactionRuleRateParameter; import org.vcell.model.rbm.FakeSeedSpeciesInitialConditionsParameter; @@ -68,6 +70,8 @@ */ public class NetworkTransformer implements SimContextTransformer { + private final static Logger lg = LogManager.getLogger(NetworkTransformer.class); + private Map> speciesEquivalenceMap = new LinkedHashMap>(); private Map kineticsParameterMap = new LinkedHashMap(); public final static int defaultSpeciesLimit = 800; // 1000 @@ -142,13 +146,13 @@ public String convertToBngl(SimulationContext simulationContext, boolean ignoreF } String bngl = bnglStringWriter.toString(); pw.close(); -// System.out.println(bngl); +// lg.debug(bngl); // for (Map.Entry> entry : speciesEquivalenceMap.entrySet()) { // String key = entry.getKey(); // Pair value = entry.getValue(); // SpeciesContext sc = value.one; // Expression initial = value.two; -// System.out.println("key: " + key + ", species: " + sc.getName() + ", initial: " + initial.infix()); +// lg.debug("key: " + key + ", species: " + sc.getName() + ", initial: " + initial.infix()); // } return bngl; } @@ -179,24 +183,24 @@ private BNGOutputSpec generateNetwork(SimulationContext simContext, MathMappingC Pair value = entry.getValue(); SpeciesContext sc = value.one; Expression initial = value.two; - System.out.println("key: " + key.fakeParameterName + ", species: " + sc.getName() + ", initial: " + initial.infix()); + lg.info("key: " + key.fakeParameterName + ", species: " + sc.getName() + ", initial: " + initial.infix()); } String md5hash = MD5.md5(input); if(isBngHashValid(input, md5hash, simContext)) { String s = "Previously saved outputSpec is up-to-date, no need to generate network."; - System.out.println(s); + lg.info(s); tcm = new TaskCallbackMessage(TaskCallbackStatus.Notification, s); simContext.appendToConsole(tcm); if(simContext.isInsufficientIterations()) { s = NetworkTransformer.getInsufficientIterationsMessage(); - System.out.println(s); + lg.info(s); tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, s); simContext.appendToConsole(tcm); } if(simContext.isInsufficientMaxMolecules()) { s = NetworkTransformer.getInsufficientMaxMoleculesMessage(); - System.out.println(s); + lg.info(s); tcm = new TaskCallbackMessage(TaskCallbackStatus.Error, s); simContext.appendToConsole(tcm); } @@ -265,16 +269,16 @@ private BNGOutputSpec generateNetwork(SimulationContext simContext, MathMappingC throw new RuntimeException(message); } -// System.out.println("new hash: " + md5hash); -// System.out.println("old hash: " + simContext.getMd5hash()); +// lg.debug("new hash: " + md5hash); +// lg.debug("old hash: " + simContext.getMd5hash()); if(md5hash != null && md5hash.length() != 0 && outputSpec != null) { - System.out.println("saving hash and output spec"); + lg.info("saving hash and output spec"); synchronized (this) { simContext.setMd5hash(md5hash); simContext.setMostRecentlyCreatedOutputSpec(outputSpec); } } else { - System.out.println("something is wrong with the hash and/or output spec"); + lg.debug("something is wrong with the hash and/or output spec"); } return (BNGOutputSpec)BeanUtils.cloneSerializable(outputSpec); } @@ -290,8 +294,8 @@ private void transform(SimulationContext simContext, SimulationContext transform simContext.appendToConsole(tcm); tcm = new TaskCallbackMessage(TaskCallbackStatus.TaskStart, msg); simContext.appendToConsole(tcm); - long startTime = System.currentTimeMillis(); - System.out.println("Convert to bngl, execute BNG, retrieve the results."); +// long startTime = System.currentTimeMillis(); + lg.info("Convert to bngl, execute BNG, retrieve the results."); try { BNGOutputSpec outputSpec = generateNetwork(simContext, mathMappingCallback, networkGenerationRequirements); if (mathMappingCallback.isInterrupted()){ @@ -300,28 +304,28 @@ private void transform(SimulationContext simContext, SimulationContext transform simContext.appendToConsole(tcm); throw new UserCancelException(msg); } - long endTime = System.currentTimeMillis(); - long elapsedTime = endTime - startTime; - System.out.println(" " + elapsedTime + " milliseconds"); +// long endTime = System.currentTimeMillis(); +// long elapsedTime = endTime - startTime; +// lg.info(" " + elapsedTime + " milliseconds"); Model model = transformedSimulationContext.getModel(); ReactionContext reactionContext = transformedSimulationContext.getReactionContext(); // ---- Parameters ----------------------------------------------------------------------------------------------- - startTime = System.currentTimeMillis(); +// startTime = System.currentTimeMillis(); for (int i = 0; i < outputSpec.getBNGParams().length; i++){ BNGParameter p = outputSpec.getBNGParams()[i]; -// System.out.println(i+1 + ":\t\t"+ p.toString()); +// lg.info(i+1 + ":\t\t"+ p.toString()); if(model.getRbmModelContainer().getParameter(p.getName()) != null) { -// System.out.println(" ...already exists."); +// lg.warn(" ...already exists."); continue; // if it's already there we don't try to add it again; this should be true for all of them! } String s = p.getName(); if(NetworkConstraints.SPECIES_LIMIT_PARAMETER.equals(s)) { - System.out.println("found NetworkConstraints seciesLimit parameter."); + lg.info("found NetworkConstraints seciesLimit parameter."); continue; } if(NetworkConstraints.REACTIONS_LIMIT_PARAMETER.equals(s)) { - System.out.println("found NetworkConstraints reactionsLimit parameter."); + lg.info("found NetworkConstraints reactionsLimit parameter."); continue; } @@ -331,7 +335,7 @@ private void transform(SimulationContext simContext, SimulationContext transform } FakeReactionRuleRateParameter fakeKineticParam = FakeReactionRuleRateParameter.fromString(s); if(fakeKineticParam != null) { - System.out.println("found fakeKineticParam "+fakeKineticParam.fakeParameterName); + lg.info("found fakeKineticParam "+fakeKineticParam.fakeParameterName); continue; // we get rid of the fake parameters we use as keys } throw new RuntimeException("unexpected parameter "+p.getName()+" in internal BNG processing"); @@ -339,16 +343,16 @@ private void transform(SimulationContext simContext, SimulationContext transform // exp.bindExpression(model.getRbmModelContainer().getSymbolTable()); // model.getRbmModelContainer().addParameter(p.getName(), exp, model.getUnitSystem().getInstance_TBD()); } - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - msg = "Adding " + outputSpec.getBNGParams().length + " parameters to model, " + elapsedTime + " ms"; - System.out.println(msg); +// endTime = System.currentTimeMillis(); +// elapsedTime = endTime - startTime; +// msg = "Adding " + outputSpec.getBNGParams().length + " parameters to model, " + elapsedTime + " ms"; +// lg.info(msg); // ---- Species ------------------------------------------------------------------------------------------------------------ mathMappingCallback.setMessage("generating network: adding species..."); mathMappingCallback.setProgressFraction(progressFractionQuota/4.0f); - startTime = System.currentTimeMillis(); - System.out.println("\nSpecies :"); +// startTime = System.currentTimeMillis(); + lg.info("\nSpecies :"); HashMap speciesMap = new HashMap(); // the reactions will need this map to recover the names of species knowing only the networkFileIndex LinkedHashMap sMap = new LinkedHashMap(); LinkedHashMap scMap = new LinkedHashMap(); @@ -359,7 +363,7 @@ private void transform(SimulationContext simContext, SimulationContext transform // final int decimalTickCount = Math.max(outputSpec.getBNGSpecies().length/10, 1); for (int i = 0; i < outputSpec.getBNGSpecies().length; i++){ BNGSpecies s = outputSpec.getBNGSpecies()[i]; -// System.out.println(i+1 + ":\t\t"+ s.toString()); +// lg.debug(i+1 + ":\t\t"+ s.toString()); String key = s.getConcentration().infix(); FakeSeedSpeciesInitialConditionsParameter fakeParam = FakeSeedSpeciesInitialConditionsParameter.fromString(key); @@ -372,7 +376,7 @@ private void transform(SimulationContext simContext, SimulationContext transform // we'll have to find the species context from the cloned model which correspond to the original species SpeciesContext sc = model.getSpeciesContext(originalsc.getName()); -// System.out.println(sc.getName() + ", " + sc.getSpecies().getCommonName() + " ...is one of the original seed species."); +// lg.info(sc.getName() + ", " + sc.getSpecies().getCommonName() + " ...is one of the original seed species."); speciesMap.put(s.getNetworkFileIndex(), sc.getName()); // existing name sMap.put(sc.getName(), sc.getSpecies()); scMap.put(sc.getName(), sc); @@ -440,7 +444,7 @@ private void transform(SimulationContext simContext, SimulationContext transform throw new UserCancelException(msg); } // if(i%50 == 0) { -// System.out.println(i+""); +// lg.info(i+""); // } // if(i%decimalTickCount == 0) { // int multiplier = i/decimalTickCount; @@ -449,11 +453,11 @@ private void transform(SimulationContext simContext, SimulationContext transform // } } -// System.out.println("Total generated species: " + countGenerated); -// System.out.println("------------------------ " + sMap.size() + " species in the map."); -// System.out.println("------------------------ " + scMap.size() + " species contexts in the map."); -// System.out.println("------------------------ " + model.getSpecies().length + " species in the Model."); -// System.out.println("------------------------ " + model.getSpeciesContexts().length + " species contexts in the Model."); +// lg.info("Total generated species: " + countGenerated); +// lg.info("------------------------ " + sMap.size() + " species in the map."); +// lg.info("------------------------ " + scMap.size() + " species contexts in the map."); +// lg.info("------------------------ " + model.getSpecies().length + " species in the Model."); +// lg.info("------------------------ " + model.getSpeciesContexts().length + " species contexts in the Model."); for(SpeciesContext sc1 : model.getSpeciesContexts()) { boolean found = false; @@ -461,13 +465,13 @@ private void transform(SimulationContext simContext, SimulationContext transform SpeciesContext sc2 = entry.getValue(); if(sc1.getName().equals(sc2.getName())) { found = true; -// System.out.println("found species context " + sc1.getName() + " of species " + sc1.getSpecies().getCommonName() + " // " + sc2.getSpecies().getCommonName()); +// lg.info("found species context " + sc1.getName() + " of species " + sc1.getSpecies().getCommonName() + " // " + sc2.getSpecies().getCommonName()); break; } } if(found == false) { // we add to the map the species context and the species which exist in the model but which are not in the map yet // the only ones in this situation should be plain species which were not given to bngl for flattening (they are flat already) -// System.out.println("species context " + sc1.getName() + " not found in the map. Adding it."); +// lg.debug("species context " + sc1.getName() + " not found in the map. Adding it."); scMap.put(sc1.getName(), sc1); sMap.put(sc1.getName(), sc1.getSpecies()); noMapForThese.add(sc1); @@ -479,12 +483,12 @@ private void transform(SimulationContext simContext, SimulationContext transform Species s2 = entry.getValue(); if(s1.getCommonName().equals(s2.getCommonName())) { found = true; -// System.out.println("found species " + s1.getCommonName()); +// lg.info("found species " + s1.getCommonName()); break; } } if(found == false) { - System.err.println("species " + s1.getCommonName() + " not found in the map!"); + lg.error("species " + s1.getCommonName() + " not found in the map!"); } } SpeciesContext[] sca = new SpeciesContext[scMap.size()]; @@ -519,16 +523,16 @@ private void transform(SimulationContext simContext, SimulationContext transform // for(SpeciesContext sc : sca) { // clean all the species patterns from the flattened species, we have no sp now // sc.setSpeciesPattern(null); // } - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - msg = "Adding " + outputSpec.getBNGSpecies().length + " species to model, " + elapsedTime + " ms"; - System.out.println(msg); - +// endTime = System.currentTimeMillis(); +// elapsedTime = endTime - startTime; +// msg = "Adding " + outputSpec.getBNGSpecies().length + " species to model, " + elapsedTime + " ms"; +// lg.info(msg); + // ---- Reactions ----------------------------------------------------------------------------------------------------- mathMappingCallback.setMessage("generating network: adding reactions..."); mathMappingCallback.setProgressFraction(progressFractionQuota/4.0f*3.0f); - startTime = System.currentTimeMillis(); - System.out.println("\nReactions :"); +// startTime = System.currentTimeMillis(); + lg.info("\nReactions :"); Map> ruleKeyMap = new HashMap>(); Map directBNGReactionsMap = new HashMap(); @@ -554,7 +558,7 @@ private void transform(SimulationContext simContext, SimulationContext transform Map reactionStepMap = new HashMap(); for (int i = 0; i < outputSpec.getBNGReactions().length; i++){ BNGReaction bngReaction = outputSpec.getBNGReactions()[i]; -// System.out.println(i+1 + ":\t\t"+ r.writeReaction()); +// lg.info(i+1 + ":\t\t"+ r.writeReaction()); String baseName = bngReaction.getRuleName(); // Hack to correct a corrupted bng reaction name, until we fix the root cause // which may never happen since we encountered this problem only one time in many years @@ -562,7 +566,7 @@ private void transform(SimulationContext simContext, SimulationContext transform int pos = baseName.indexOf(","); baseName = baseName.substring(0, pos); } -// System.out.println(i + ": " + baseName); +// lg.info(i + ": " + baseName); String reactionName = null; HashSet keySetsForThisRule = ruleKeyMap.get(bngReaction.getRuleName()); if (keySetsForThisRule.size()==1 && model.getReactionStep(bngReaction.getRuleName()) == null && !reactionStepMap.containsKey(bngReaction.getRuleName())) { // we can reuse the reaction rule labels @@ -593,7 +597,7 @@ private void transform(SimulationContext simContext, SimulationContext transform ReactionRule rr = model.getRbmModelContainer().getReactionRule(name); if(rr == null) { // temp code, trying to catch a rare random bug, may be a race condition of some sort - System.out.println("ReactionRule " + name + " not found."); + lg.error("ReactionRule " + name + " not found."); } Structure structure = rr.getStructure(); @@ -734,35 +738,29 @@ private void transform(SimulationContext simContext, SimulationContext transform simContext.appendToConsole(tcm); throw new UserCancelException(msg); } - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - msg = "Adding " + outputSpec.getBNGReactions().length + " reactions to model, " + elapsedTime + " ms"; - System.out.println(msg); +// endTime = System.currentTimeMillis(); +// elapsedTime = endTime - startTime; +// msg = "Adding " + outputSpec.getBNGReactions().length + " reactions to model, " + elapsedTime + " ms"; +// lg.info(msg); // clean all the reaction rules model.getRbmModelContainer().getReactionRuleList().clear(); // ---- Observables ------------------------------------------------------------------------------------------------- mathMappingCallback.setMessage("generating network: adding observables..."); mathMappingCallback.setProgressFraction(progressFractionQuota/8.0f*7.0f); - startTime = System.currentTimeMillis(); - - long removeObsTime = 0; - long addParamTime = 0; - long st; // start - long et; // end - +// startTime = System.currentTimeMillis(); - System.out.println("\nObservables :"); + lg.info("\nObservables :"); // we delete all observables; instead, for each of them we create a user-defined global parameter // which is the sum of all generated (by flattening) species that satisfy the observable pattern RbmModelContainer rbmmc = model.getRbmModelContainer(); for (int i = 0; i < outputSpec.getObservableGroups().length; i++){ ObservableGroup o = outputSpec.getObservableGroups()[i]; -// System.out.println(i+1 + ":\t\t" + o.toString()); +// lg.info(i+1 + ":\t\t" + o.toString()); if(rbmmc.getParameter(o.getObservableGroupName()) != null) { - System.out.println(" ...already exists."); + lg.info(" ...already exists."); continue; // if it's already there we don't try to add it again; this should be true for all of them! } ArrayList terms = new ArrayList(); @@ -775,18 +773,8 @@ private void transform(SimulationContext simContext, SimulationContext transform RbmObservable originalObservable = rbmmc.getObservable(o.getObservableGroupName()); VCUnitDefinition observableUnitDefinition = originalObservable.getUnitDefinition(); - st = System.currentTimeMillis(); // ========================== rbmmc.removeObservable(originalObservable, Model.PropertyNotificationMode.Silent); - et = System.currentTimeMillis(); // ========================== - removeObsTime += (et-st); - - - st = System.currentTimeMillis(); // ========================== Parameter newParameter = rbmmc.addParameter(o.getObservableGroupName(), exp, observableUnitDefinition, Model.PropertyNotificationMode.Silent); - et = System.currentTimeMillis(); // ========================== - addParamTime += (et-st); - - RbmObservable origObservable = simContext.getModel().getRbmModelContainer().getObservable(o.getObservableGroupName()); ModelEntityMapping em = new ModelEntityMapping(origObservable,newParameter); @@ -798,20 +786,15 @@ private void transform(SimulationContext simContext, SimulationContext transform simContext.appendToConsole(tcm); throw new UserCancelException(msg); } - endTime = System.currentTimeMillis(); - elapsedTime = endTime - startTime; - msg = "Adding " + outputSpec.getObservableGroups().length + " observables to model, " + elapsedTime + " ms"; - System.out.println(msg); - msg = "removeObsTime: " + removeObsTime + ", addParamTime: " + addParamTime; - System.out.println(msg); +// endTime = System.currentTimeMillis(); +// elapsedTime = endTime - startTime; +// msg = "Adding " + outputSpec.getObservableGroups().length + " observables to model, " + elapsedTime + " ms"; +// lg.info(msg); } catch (PropertyVetoException | ModelException | ExpressionException | ClassNotFoundException | IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } - System.out.println("Done transforming"); - msg = "Generating math..."; - System.out.println(msg); mathMappingCallback.setMessage(msg); mathMappingCallback.setProgressFraction(progressFractionQuota); } @@ -847,7 +830,7 @@ private Expression applyKineticsExpressions(BNGReaction bngReaction, KineticsPar throw new RuntimeException("unexpected identifier "+fakeSymbol+" in kinetic law during network generation"); } LocalParameter localParameter = this.kineticsParameterMap.get(fakeParameter); - System.out.println(localParameter.getNameScope()); + lg.info(localParameter.getNameScope()); if (localParameter.getNameScope() instanceof ReactionRule.ReactionRuleNameScope){ reactionRule = ((ReactionRule.ReactionRuleNameScope)localParameter.getNameScope()).getReactionRule(); }