Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in comp flattening routine (cannot register compartment, cannot register parameter) #213

Open
matthiaskoenig opened this issue May 19, 2020 · 5 comments
Labels

Comments

@matthiaskoenig
Copy link
Collaborator

When trying to flatten some simple comp models I get errors for the following files:
comp.zip

Flattening is performed via

doc = SBMLReader.read(file);
CompFlatteningConverter compFlatteningConverter = new CompFlatteningConverter();
docFlat = compFlatteningConverter.flatten(doc);

E.g. for test10.xml one gets

May 19, 2020 2:53:12 PM org.sbml.jsbml.ext.comp.util.CompFlatteningConverter initSubModels
INFO: No model definition found in sub1.
May 19, 2020 2:53:12 PM org.sbml.jsbml.ext.comp.util.CompFlatteningConverter initSubModels
INFO: No model definition found in sub1.
ERROR (Model.java:4687) - An element of type compartment with the id "moddef1C" is already present in this model. The new element of type compartment will not have it's id set. In some cases, the new element will not be added to the model.

java.lang.IllegalArgumentException: Cannot register compartment.

	at org.sbml.jsbml.AbstractSBase.registerChild(AbstractSBase.java:2220)
	at org.sbml.jsbml.ListOf.add(ListOf.java:444)
	at org.sbml.jsbml.Model.addCompartment(Model.java:351)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.mergeListsOfModels(CompFlatteningConverter.java:385)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.mergeModels(CompFlatteningConverter.java:347)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.flattenAndMergeModels(CompFlatteningConverter.java:304)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.flattenAndMergeModels(CompFlatteningConverter.java:299)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.initSubModels(CompFlatteningConverter.java:284)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.initSubModels(CompFlatteningConverter.java:277)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.instantiateSubModels(CompFlatteningConverter.java:153)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.flatten(CompFlatteningConverter.java:115)
	at org.simulator.comp.CompSimulator.<init>(CompSimulator.java:43)
	at org.simulator.comp.CompSimulatorTest.testComp(CompSimulatorTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runners.Suite.runChild(Suite.java:127)
	at org.junit.runners.Suite.runChild(Suite.java:26)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runners.Suite.runChild(Suite.java:127)
	at org.junit.runners.Suite.runChild(Suite.java:26)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

For test6.xml one gets

ERROR (Model.java:4687) - An element of type parameter with the id "Mod1subparam2" is already present in this model. The new element of type parameter will not have it's id set. In some cases, the new element will not be added to the model.

java.lang.IllegalArgumentException: Cannot register parameter.

	at org.sbml.jsbml.AbstractSBase.registerChild(AbstractSBase.java:2220)
	at org.sbml.jsbml.ListOf.add(ListOf.java:444)
	at org.sbml.jsbml.Model.addParameter(Model.java:434)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.mergeListsOfModels(CompFlatteningConverter.java:451)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.mergeModels(CompFlatteningConverter.java:354)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.flattenAndMergeModels(CompFlatteningConverter.java:304)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.initSubModels(CompFlatteningConverter.java:284)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.instantiateSubModels(CompFlatteningConverter.java:153)
	at org.sbml.jsbml.ext.comp.util.CompFlatteningConverter.flatten(CompFlatteningConverter.java:115)
	at org.simulator.comp.CompSimulator.<init>(CompSimulator.java:43)
	at org.simulator.comp.CompSimulatorTest.testComp(CompSimulatorTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runners.Suite.runChild(Suite.java:127)
	at org.junit.runners.Suite.runChild(Suite.java:26)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runners.Suite.runChild(Suite.java:127)
	at org.junit.runners.Suite.runChild(Suite.java:26)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
@matthiaskoenig matthiaskoenig changed the title Errors in comp flattening routine (cannot register compartment, Errors in comp flattening routine (cannot register compartment, cannot register parameter) May 19, 2020
@draeger draeger added the bug label May 19, 2020
@matthiaskoenig
Copy link
Collaborator Author

Hi all,

does anybody know what is going on here? This worked in earlier versions of JSBML and should be picked up by regression tests. When we worked 1-2 years ago with Shalin on the CompSimulation in SBSCL all these models flattened just fine.

What changed in the Comp flattening since then?

@niko-rodrigue
Copy link
Member

niko-rodrigue commented May 29, 2020 via email

@matthiaskoenig
Copy link
Collaborator Author

Hi all,
I will tackle this issue.

There are many test models in the repository, the failures were just not very obvious (2 failing tests). After creating some better tests (parametrized tests instead of one test running all test models) 54/60 comp test models cannot be flattened.
If anybody gives me commit access to the repository I can push my changes in a branch and work on fixing the flattening issues.

Best Matthias

@niko-rodrigue
Copy link
Member

niko-rodrigue commented Jul 14, 2020 via email

@draeger
Copy link
Member

draeger commented Jul 16, 2020

@matthiaskoenig has been invited as a collaborator with write permission. Thanks, @niko-rodrigue and @matthiaskoenig!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants