Linking COPASI and Cytoscape

293 views
Skip to first unread message

Hikmet Emre Kaya

unread,
Apr 7, 2021, 9:52:21 AM4/7/21
to COPASI User Forum

Hello Everyone!

For my PhD project, I need to link COPASI and Cytoscape.

Cytoscape is an open source bioinformatics software platform for visualizing molecular interaction networks and integrating with gene expression profiles and other state data.

It has an app store where you can install apps for additional features, but there is no app for what I want to do, which is to run reaction kinetics simulations on the networks, particularly glycosylation networks.

So, I want to make COPASI available and compatible with Cytoscape.

Because Cytoscape is a Java application, I downloaded the java bindings for COPASI and decompiled the .class files to .java files. But, I am not sure how to proceed from here. Using Eclipse, I created a new maven project in the Cytoscape-api repository and added the .java files for COPASI.

I think I need to update the pom.xml file to add the COPASI dependencies, but I am not sure how to do that.

Sorry if the question sounds too vague, I guess I need an overall idea of how to best go about this.

Thanks,

Emre

Frank Bergmann

unread,
Apr 7, 2021, 10:23:51 AM4/7/21
to COPASI User Forum
Hello Emre, 

since COPASI is written in C++, the way we provide support for it to Java, is by automatically wrapping the C++ classes via SWIG. SWIG generates the Java-wrapper files (and c++ wrapper file containing the native JNI symbols for the java wrapper files), that are then compiled into the copasi jar file. This jar file, will only work with the native library, that was generated alongside it. If you just wanted to do it for your local instance, you would then include this jar file in your java project, and ensure that the accompanying native library is in the `java.library.path`. from there you can access the api of COPASI as done in these examples: 


And here is where it becomes a bit more complicated, if you would like the jar file to work on all systems, you also need compilations of the same generated JNI wrapper on the other platforms you would want to support. As for how to include this multi-platform approach in a maven build i am not sure. 

Again the java files, without the native library will not work for you. 

best
Frank

Hikmet Emre Kaya

unread,
Apr 7, 2021, 10:37:29 AM4/7/21
to COPASI User Forum
Hi Frank,

Thanks for this detailed explanation.

At the moment, when I copy the .jar file to CytoscapeConfiguration/3/apps/installed, Cytoscape crashes and gives the following error:

Native code library failed to load.                                                                                                                                                      
java.lang.UnsatisfiedLinkError: no CopasiJava in java.library.path: [/home/people/hkaya/Cytoscape_v3.8.2/framework/lib, /home/people/hkaya/Cytoscape_v3.8.2/framework/lib, /usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]

Frank Bergmann

unread,
Apr 7, 2021, 10:47:57 AM4/7/21
to COPASI User Forum
Indeed, as i pointed out, the jar file cannot work without the C++ library. So assuming (from your paths provided) that you work on linux x64, i assume you have downloaded this archive: 


in that archive you find next to the `copasi.jar` file (with the java wrappers for the library, but not the implementation) the native library `libCopasiJava.so`this needs to be copied into a path that is in your `java.library.path` or you need to include its location manually into the java.library.path. 

best
Frank

Hikmet Emre Kaya

unread,
Apr 8, 2021, 4:43:59 AM4/8/21
to COPASI User Forum
Hi Frank,

That makes sense; I do work on linux x64.

I will try this and keep you posted about the outcome. Thanks!

Hikmet Emre Kaya

unread,
Apr 9, 2021, 9:54:01 AM4/9/21
to COPASI User Forum
Hello Frank,

So, linking the native library to my java.library.path did work, but COPASI still fails to start when I open Cytoscape and gives the following error:

org.cytoscape.app.internal.exception.AppStartupException: Bundle start error
    at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:84) ~[?:?]
    at org.cytoscape.app.internal.manager.AppManager.startApps(AppManager.java:404) ~[?:?]
    at org.cytoscape.app.internal.manager.AppManager.initializeApps(AppManager.java:374) ~[?:?]
    at org.cytoscape.app.internal.manager.AppManager.lambda$attemptInitialization$0(AppManager.java:235) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.osgi.framework.BundleException: Activator start error in bundle org.cytoscape.COPASI [123].
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2290) ~[?:?]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2146) ~[?:?]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
    at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:82) ~[?:?]
    ... 8 more
Caused by: java.lang.UnsatisfiedLinkError: 'void org.cytoscape.COPASI.COPASIJNI.initCopasi()'
    at org.cytoscape.COPASI.COPASIJNI.initCopasi(Native Method) ~[?:?]
    at org.cytoscape.COPASI.COPASIJNI.<clinit>(COPASIJNI.java:25) ~[?:?]
    at org.cytoscape.COPASI.CCopasiMessage.<init>(CCopasiMessage.java:87) ~[?:?]
    at org.cytoscape.COPASI.CyActivator.start(CyActivator.java:52) ~[?:?]
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697) ~[?:?]
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2240) ~[?:?]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2146) ~[?:?]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
    at org.cytoscape.app.internal.manager.BundleApp.start(BundleApp.java:82) ~[?:?]
    ... 8 more


So, I probably need to define the COPASI library dependencies in my pom.xml file. I followed the instructions here to compile the dependencies, but it didn't solve the problem. How can these dependencies be installed locally using maven?

Frank Bergmann

unread,
Apr 12, 2021, 9:46:27 AM4/12/21
to COPASI User Forum
This is still the same issue, the line: 

Caused by: java.lang.UnsatisfiedLinkError: 'void org.cytoscape.COPASI.COPASIJNI.initCopasi()'
    at org.cytoscape.COPASI.COPASIJNI.initCopasi(Native Method) ~[?:?]

tells us, that again the native library could not be located. I'm afraid that i don't know how the cytoscape bundles work, and what additional code would be needed to path along the java.library path to your bundle. Googling hints at a "Bundle-NativeCode" header in OSGi. This seems to be the equivalent of the java.library.path ... but again i have no experiences with OSGi. 

I don't think you will have to compile the dependencies locally. There are cmake plugins available that could be used to have maven run cmake. But i dont see this helping. 

Frank

Hikmet Emre Kaya

unread,
May 3, 2021, 10:14:55 AM5/3/21
to COPASI User Forum
Hello Frank,

I just wanted to update you on my attempts with the project.

When I added the <Bundle-NativeCode> header to my pom.xml file to specify the location of libCopasiJava.so,  I received the following error:

Invalid bundle classpath entry: libCopasiJava.so: java.util.zip.ZipException: The JAR/ZIP file (/home/people/hkaya/git/cytoscape-api/cycopasi/src/main/resources/libCopasiJava.so) seems corrupted, error: zip END header not found

Do you have any idea why this error is generated? Is the header expecting a ZIP file even though the .so file is outside copasi.jar?

Frank Bergmann

unread,
May 4, 2021, 5:53:09 AM5/4/21
to COPASI User Forum
As mentioned before, i'm afraid i don't know how to write these plugins. If i had to interpret the error, it would seem whatever you added to the pom, is expected to be a zip file. We will have to see the full specification you added, please also have a look at: 


cheers
Frank

Hikmet Emre Kaya

unread,
Jun 24, 2021, 9:19:50 AM6/24/21
to COPASI User Forum
Hi Frank,
I have managed to include the .so file in my jar, and the app starts without crashing, but does not appear on the menu tab in Cytoscape. I figured this might be because of the way I am activating it.

I want to clarify: when accessing the api of COPASI in the java project, does one have to do System.loadLibrary to load the native library? If this is already done in the c++ wrapper COPASIJNI.class, which many other COPASI classes depend on, do we still need to declare these classes as native in our source code?

Some examples contain System.loadLibrary and some don't, so I got confused

I hope my question makes sense.

Frank Bergmann

unread,
Jun 28, 2021, 4:09:15 AM6/28/21
to COPASI User Forum
Hello, 

i did verify, that the load library call is not necessary, as it will be done at static initialization in the base JNI class, so using any class will cause the static initialization to hit. So indeed it is not necessary in the examples. 

Incidentally, i would actually like to change the behavior of this, currently the static initializer catches the exception, prints to std::error and then exits. I am not sure this is the desired behavior. I think it would be better if the exception would just be thrown. And perhaps even, that there would be an option to prevent the static initialization alltogether. What are your thoughts?

thanks
Frank

Hikmet Emre Kaya

unread,
Jul 7, 2021, 5:52:02 AM7/7/21
to COPASI User Forum
Hi Frank,

I am not sure but I previously found the following links when investigating this issue. See if they are relevant?

https://github.com/LWJGL/lwjgl3/issues/277
https://stackoverflow.com/questions/11783632/how-do-i-load-and-use-native-library-in-java

I am trying to figure out if there is a way to call copasi.jar from my bundle app with a command. Because the jar doesn't have a main class, calling java -jar copasi.jar will return a "no main attribute..." error. So, I am not sure how to implement the main class and utilize this jar file as an executable. I understand that one can type java -cp copasi.jar mainclass.java (where mainclass.java can be one of the example files), but it is not really the best way to do it inside a bundle app, I suppose.

What do you think?

Frank Bergmann

unread,
Jul 7, 2021, 9:19:36 AM7/7/21
to COPASI User Forum
I'm afraid it is really hard to see where you are at, and what the problem would be. Do you have a github project that i can look at to see where the issues are?

thanks
Frank

Hikmet Emre Kaya

unread,
Jul 7, 2021, 9:56:01 AM7/7/21
to COPASI User Forum
https://github.com/kyxhik/CytoCopasi/blob/master/src/main/java/org/cytoscape/CytoCopasi/Example1/Example1.java

My initial idea was to add the following to the unimplemented public void run method at the end of Example1.java

ExecuteCommandTask executeCommandTask = new ExecuteCommandTask(command);

Where the command would be something like "java -jar copasi.jar" or "java -cp copasi.jar main.class" that would initialize COPASI

I hope I am making sense :D Calling myself a novice in app development would be an understatement :)

Frank Bergmann

unread,
Jul 12, 2021, 9:42:38 AM7/12/21
to COPASI User Forum
I took some time to figure out how it actually would work, and created a test repository here: 


That one implements a very basic reader for COPASI files, creating nodes for compartments / species / parameters / reactions, creating edges between species involved in a reaction. That should show you how these things should work together. 

Currently the plugin requires placing the native library into the java.library.path (and there is currently no need to manually call loadLibrary). However, as indicated in my last reply, it might make sense to change that behavior, so applications can supply a custom loader for the native library. (that way you could bundle the native binaries as resources with the jar file, and extract it in a temporary place, and load the library from there, which would be needed to publish the cytoscape app in the app store i think. 

cheers
Frank

Hikmet Emre Kaya

unread,
Jul 17, 2021, 6:54:26 AM7/17/21
to COPASI User Forum
Hi Frank.

Thank you so much for this! The way I wrote the pom.xml and installed copasi.jar as a local dependency is quite similar. I also found out about Cy3Sbml just after I messaged you. I initially thought I would just create a time course simulator class that uses the model directly from Cy3SBML, but the way you structured it makes more sense.

I am taking my time to fully understand how you incorporated COPASI into some of the class files. I will get back to you with some questions and take it from there.

Hikmet Emre Kaya

unread,
Jul 21, 2021, 8:27:02 AM7/21/21
to COPASI User Forum
Hi Frank,

Before asking my other questions, here is how it looks on my Linux machine.



As per the ReadMe instructions, I have mvn-installed copasi.jar file, edited my pom.xml and copied the .so file to /usr/lib/ Interestingly, it reads .xml files but gives an unsatisfiedLinkError when trying to open .cps files

java.lang.UnsatisfiedLinkError: 'boolean org.COPASI.COPASIJNI.CDataModel_loadFromString__SWIG_3(long, org.COPASI.CDataModel, java.lang.String)'                                          
    at org.COPASI.COPASIJNI.CDataModel_loadFromString__SWIG_3(Native Method) ~[?:?]
    at org.COPASI.CDataModel.loadFromString(CDataModel.java:88) ~[?:?]
    at org.copasi.cytoscape.internal.tasks.CopasiFileReaderTask.run(CopasiFileReaderTask.java:165) ~[?:?]
    at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.innerRun(JDialogTaskManager.java:337) ~[93:org.cytoscape.work-swing-impl:3.8.2]
    at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.run(JDialogTaskManager.java:352) [93:org.cytoscape.work-swing-impl:3.8.2]

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
java.lang.Exception: java.lang.UnsatisfiedLinkError: 'boolean org.COPASI.COPASIJNI.CDataModel_loadFromString__SWIG_3(long, org.COPASI.CDataModel, java.lang.String)'
    at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.run(JDialogTaskManager.java:362)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.UnsatisfiedLinkError: 'boolean org.COPASI.COPASIJNI.CDataModel_loadFromString__SWIG_3(long, org.COPASI.CDataModel, java.lang.String)'
    at org.COPASI.COPASIJNI.CDataModel_loadFromString__SWIG_3(Native Method)
    at org.COPASI.CDataModel.loadFromString(CDataModel.java:88)
    at org.copasi.cytoscape.internal.tasks.CopasiFileReaderTask.run(CopasiFileReaderTask.java:165)
    at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.innerRun(JDialogTaskManager.java:337)
    at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.run(JDialogTaskManager.java:352)

Have you encountered this error when you tried it? Why would it specifically give the error with a .cps file, but not with an .xml file?

Frank Bergmann

unread,
Jul 21, 2021, 10:03:49 AM7/21/21
to COPASI User Forum
Maybe you could get the java.library.path from the runtime properties and print it as well. (This will get the locations from which the so file will be picked up). Also the copasi.jar and the libCopasiJava.so are quite specific, have you taken them from: 


This should help narrow things down
best
Frank

Hikmet Emre Kaya

unread,
Jul 22, 2021, 7:55:19 AM7/22/21
to COPASI User Forum
Java Library Path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib

I definitely took the copasi.jar and libCopasiJava.so files from your repository, and then I copied the .so file to /usr/lib as a root (sudo cp ...). I didn't take the copasi-gui.jar file, though.

Hikmet Emre Kaya

unread,
Jul 22, 2021, 8:03:19 AM7/22/21
to COPASI User Forum
I think it might be a permission error, perhaps I don't have the right permission to retrieve libCopasiJava.so from /usr/lib/ (because this is a root file)

Interestingly, when I typed export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/people/hkaya/git/cytoscape-api/CytoCopasi/lib/ (to add an accessible location to the java.library.path) manually, I was able to import a .cps file

Perhaps, I could try to use System.setProperty to add the location of the .so file to my java.library.path without having to copy the .so file itself.

Frank Bergmann

unread,
Jul 23, 2021, 3:41:34 AM7/23/21
to copasi-u...@googlegroups.com
I'm glad to hear that it finally works. I dont think that you can modify the java.library.path on a running instance. The only alternative to modifying the library path in advance, would be to write a custom loader, that would: 

* take the correct native library (for the currently running OS) out of a resource bundle and safe it to a temporary location
* use System.load to load it
* at shutdown clean up after itself. 

That would mean that the copasi.jar could no longer load the native library automatically though. But in the end that is the only way we can support multiple scenarios like this one. (For most people using the Java Bindings, the only thing that would change, would be that a manual System.loadLibrary call would become necessary. 

cheers
Frank

--
You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/50ca5aea-fb18-4589-bfd4-588eb8371d23n%40googlegroups.com.

Hikmet Emre Kaya

unread,
Aug 24, 2021, 9:43:49 AM8/24/21
to COPASI User Forum
Hello Frank,

I hope you have been doing well.

I put the native library issue aside later to deal with when it's time to think about app submission. In the meantime, I was able to expand the app's features so it can make conversion between .sbml and .cps files (i.e., save one as the other)

I am now wanting to create plots for time course and steady state simulations, but am confused about how to make use of the classes in copasi.jar . More specifically, does one first have to generate a report to create a plot? Or can I generate a plot directly?

I don't really understand what purpose PlotSpecification, CPlotItem , CPlotDataChannelSpec.java, etc each serve :/
Message has been deleted

Hikmet Emre Kaya

unread,
Aug 24, 2021, 9:49:57 AM8/24/21
to COPASI User Forum

My SimulationTask class will briefly pop up a dialog  (in a similar way to CellDesigner) to ask for duration, number of steps, etc, as well as the plot type (which I didn't have any problem writing)

Frank Bergmann

unread,
Aug 25, 2021, 3:31:40 AM8/25/21
to COPASI User Forum
Hello, 

I really don't think that the plot specification of the copasi API will help you. It is just there, to describe what should be plotted, so that when something is run by Copasi UI, the corresponding plots pop up (you would only need those if you wanted to encode a copasi file, that displays a similar plot to the one you had in your application). The copasi.jar file only gives you access to the backend. The report definitions conversely, describe how something should be written to file. So when you use that, and set a report target to a specific task, the corresponding file will be written to hard drive. 

What you could be using is the data model directly. So for time courses, you could specify that the results should be kept in memory (i.e. in a CTimeSeries object), where you can retrieve the results after a simulation is run. For steady state, once you have run the steady state task (and a steady state was reached), the transient values of the model objects will reflect the model at steady state. So if you at that point asked the metabolites about their concentration, they would return the steady state concentrations.  

So i'd suggest you retrieve the values from there and plot them with whatever plotting library / toolkit you would like. 

I hope that helps, 
best
Frank

Hikmet Emre Kaya

unread,
Sep 6, 2021, 10:16:33 AM9/6/21
to COPASI User Forum
Hi Frank!

Thank you for the suggestion. That actually worked perfectly! I used JFreeChart library to obtain plots.

My next question is; how would one go about getting flux rate vs time? I saw the getFlux() method, but the Copasi documentation says it only gives the final flux (which I tested and confirmed)

Thanks

Emre

Hikmet Emre Kaya

unread,
Oct 27, 2021, 5:29:41 AM10/27/21
to COPASI User Forum
Hello Frank;

I have made quite a lot of progress with COPASI's implementation of CytoScape, and I managed to generate plots for Time-Course Simulations, as well as running Steady-State Calculations.

I am currently working on writing the Optimization Task. I created the user dialog to specify the objective function, the parameter, and the optimization method, but I got stuck at some point.

I am not sure how to create expressions for the objective function. For example, if the user wants to calculate the ratios of two reaction fluxes, how can one generate that expression? I can parse reaction names, but then the app would not understand that I am referring to their fluxes. Is there a method to specify those? I hope my question is clear enough.

Best,

Emre

Hikmet Emre Kaya

unread,
Oct 27, 2021, 5:34:28 AM10/27/21
to COPASI User Forum
For example;

When you click on a reaction flux, the expression looks like this:

{(Adenylate kinase).Flux}

How does this work in COPASI's java bindings?

Frank Bergmann

unread,
Oct 27, 2021, 7:18:11 AM10/27/21
to copasi-u...@googlegroups.com
Hello Emre, 

these expressions have to be constructed by using the CN syntax. CNs are the names COPASI uses internally for all model elements and their attributes, and pretty much any other object too. They have the form like: 

    CN=Root,Model=The Brusselator,Vector=Compartments[compartment],Vector=Metabolites[Y],Reference=Concentration

Wherever expressions are used in COPASI you can use the allowed subset of operators and functions from: 


and use them with CNs. The important thing is to surround them in '<', '>' brackets. So for example: 

    <cn1> - <cn2>

to create an expression with the difference of two other elements. 

This will take some time to begin with, but I would suggest that you manually create a plot for the elements you want to use, open it in a text editor, and look at the `ChannelSpec` element to see how they should look like. 

Programmatically you get to those expressions, by asking the value reference for its CN. So in java if `reaction` is a `CReaction` element, then it would be: 

     String cn = reaction.getValueReference().getCN().getString()

i hope this helps, 

best
Frank




You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/5ed6a4b9-2bac-41e2-bd72-c09b1e62e32an%40googlegroups.com.

Hikmet Emre Kaya

unread,
Oct 27, 2021, 8:45:40 AM10/27/21
to COPASI User Forum
Hello Frank;

Thank you for the detailed explanation. By that logic, I can get an expression for the flux by model.getReaction(index).getFluxReference().getCN.toString(); correct?

I just didn't quite understand the following:


but I would suggest that you manually create a plot for the elements you want to use, open it in a text editor, and look at the `ChannelSpec` element to see how they should look like. 

Do you mean I should save the plot as a txt file to find the ChannelSpec?

Hikmet Emre Kaya

unread,
Oct 27, 2021, 9:13:41 AM10/27/21
to COPASI User Forum
One more question;

I can't figure out how to get the CN format for the reaction parameters. I can get parameter names from model.getReaction(index).getParameters.getName(), but I don't think that can be put into an expression.

Frank Bergmann

unread,
Oct 27, 2021, 10:21:57 AM10/27/21
to COPASI User Forum
I think in Java the best thing to get just the local parameter cns, would be to call: 

    reaction.getParameterCNs()

and in the result filter for those that contain the substring ',ParameterGroup=Parameters,Parameter='. 

best
Frank

Frank Bergmann

unread,
Oct 27, 2021, 10:25:00 AM10/27/21
to COPASI User Forum

Thank you for the detailed explanation. By that logic, I can get an expression for the flux by model.getReaction(index).getFluxReference().getCN.toString(); correct?


yes
 
I just didn't quite understand the following:

but I would suggest that you manually create a plot for the elements you want to use, open it in a text editor, and look at the `ChannelSpec` element to see how they should look like. 

Do you mean I should save the plot as a txt file to find the ChannelSpec?

I just meant for debugging, saving the model as COPASI file and looking at it in a text editor, will show you the precise format of the CN for the elements you are looking after. For example for local parameters it would have showed you that the format is: 

   CN=Root,Model=<model name>,Vector=Reactions[<reaction name>],ParameterGroup=Parameters,Parameter=<local parameter name>

best
Frank
 

Hikmet Emre Kaya

unread,
Oct 28, 2021, 4:53:08 AM10/28/21
to COPASI User Forum
Hi Frank,

Thank you for the valuable suggestions; it all makes perfect sense.

I had an idea about what to do when the user gives an expression for the input (By selecting objects from a JTree and putting math operations in between)

  • Write a separate class that reads this expression, separates it into its components

  •  gets the common name for each object in the expression according to the string. (e.g., if it is Flux.something, get the fluxValueReference, if it is [something], get the common name for the concentration, and so on)

  • After converting them into their CN format, it surrounds each object with < > brackets. 

  • It then feeds this revised formula back into the Optimization task. 


Do you think this is doable, or is it way more complex than it should've been?

Frank Bergmann

unread,
Oct 28, 2021, 5:03:14 AM10/28/21
to COPASI User Forum
I would need to see in what forms you take the input expression, if you can post some example expressions you want to support, that would help. If you do allow for the same syntax we use in COPASI, then there are methods that help you on the CDataModel class. (`findObjectByDisplayName` tries to resolve objects by their display name, `getObject` resolves a CCommonName to its object). 

cheers
frank

Hikmet Emre Kaya

unread,
Oct 28, 2021, 5:17:28 AM10/28/21
to copasi-u...@googlegroups.com
image.png


I am not sure if you can see the screenshot, but this is a rough version of it. Let's say I want to minimize the ratio of two fluxes, so I specify the following expression: Flux.(Glucose transport)/Flux.(Hexokinase)


I thought about using the exact syntax used in COPASI, but wasn't sure if that would help. I can change the string representations of the objects in the selection tree to look exactly like the COPASI versions, if it helps.

--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.


--
Hikmet Emre Kaya

Professional Science & Wellness Writer

PhD in Computational Glycoenzymology at the University of Cape Town



Hikmet Emre Kaya

unread,
Oct 28, 2021, 5:26:29 AM10/28/21
to copasi-u...@googlegroups.com
In COPASI, the syntax that appears on the selection panel is flux(something), but when you select it, it appears on the expression field as {(Something).Flux}. Which syntax are you referring to?

Frank Bergmann

unread,
Oct 28, 2021, 7:47:30 AM10/28/21
to COPASI User Forum
I think it would make sense, to use the same expression syntax as COPASI uses as well, that way they could be copied between tools as well. It would also make testing for you easier. 

For the infix expressions we do use display names (as you can obtain from the value reference objects using `getObjectDisplayName`)  and surround them with curly brackets for easy recognition in the infix editor, so it would be 

    { (Glucose Transport).Flux } /  { (Hexokinase).Flux } 

in the example from your screenshot. 

Cheers
Frank

Hikmet Emre Kaya

unread,
Oct 28, 2021, 8:19:28 AM10/28/21
to COPASI User Forum
Hi Frank,

That definitely makes  life a lot easier! To be clear, do you have to put that expression in angle brackets as well, or does COPASI recognize it when you put in optItem.setObjectiveFunction(my expression)

where my expression is: say, { (Glucose Transport).Flux } /  { (Hexokinase).Flux } 

Frank Bergmann

unread,
Oct 28, 2021, 9:34:02 AM10/28/21
to copasi-u...@googlegroups.com
Sorry for the confusion, the expressions of the form: 

 { (Glucose Transport).Flux } /  { (Hexokinase).Flux } 

is what we let the user enter, and copy / paste. The API uses the CN form we discussed before:

<cn1> / <cn2>

Frank

You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/a501d7a9-9e55-4c35-8c47-13034e1b8c7dn%40googlegroups.com.

Hikmet Emre Kaya

unread,
Oct 28, 2021, 9:54:46 AM10/28/21
to COPASI User Forum
Oh okay, I am actually more confused now :D

So, let's say I got this user input with the curly brackets and passed it onto the

public void run (... ...)

 - Loading the model from string
 - Running time course or steady state
 - Creating an optimization task


Will I have to convert that expression into the <cn1>/<cn2> format before I set the objective function in my COptProblem?

Hikmet Emre Kaya

unread,
Oct 29, 2021, 6:55:23 AM10/29/21
to COPASI User Forum
Hello again, Frank;

I gave it a try and wrote the following by looking at java bindings examples:

CModelValue variableModelValue = model.createModelValue("V");
variableModelValue.setStatus(CModelEntity.Status_ASSIGNMENT);
            
variableModelValue.setExpression(expression);

Where, the expression could be, for example = {[ADP]}/{[ATP]}

 String objectiveFunction = variableModelValue.getObject(new CCommonName("Reference=Value")).getCN().getString();

When I print out objectiveFunction, I get the following:

Objective Function: CN=Root,Model=Karlstaedt2019 - G6P accumulation via Phosphoglucose isomerase inhibition in heart muscles,Vector=Values[V],Reference=Value

But, when I enter the same expression on COPASI and look at the .cps file, the objective function is:

<ParameterText name="ObjectiveExpression" type="expression">
          &lt;CN=Root,Model=Karlstaedt2019 - G6P accumulation via Phosphoglucose isomerase inhibition in heart muscles,Vector=Compartments[cytosol],Vector=Metabolites[ADP],Reference=Concentration>/&lt;CN=Root,Model=Karlstaedt2019 - G6P accumulation via Phosphoglucose isomerase inhibition in heart muscles,Vector=Compartments[cytosol],Vector=Metabolites[ATP],Reference=Concentration>
        </ParameterText>


Does this mean, I am not getting the objective function correctly?

Hikmet Emre Kaya

unread,
Nov 4, 2021, 4:17:01 AM11/4/21
to COPASI User Forum
Hi Frank,

Sorry for asking too many questions :D I actually managed to do the conversion from object display name to Common Name, which gives the correct value for the minimum objective function.

My question is about the optimization task itself. I am confused as to why COPASI gives a different best parameter value (corresponding to the minimum objective function) after each optimization run. Is there a document that you can suggest for me to understand the logic of optimization better?

Best,

Emre

Frank Bergmann

unread,
Nov 4, 2021, 4:22:36 AM11/4/21
to COPASI User Forum
Hello Emre, 

can you send me the copasi file in question, and again a quick refresher of which different values you are referring to? It makes it easier to answer your question that way. 

cheers
Frank

Hikmet Emre Kaya

unread,
Nov 4, 2021, 4:33:25 AM11/4/21
to copasi-u...@googlegroups.com
Hello Frank,

This is the file that I am using to test the app.

When I ran the optimization task in standalone COPASI, I determined an objective function of [ADP]/[ATP] and chose my parameter (to be scanned) as one of the constant k values.

Every time I run the optimization task (without changing the opt method), I get more or less the same value for the minimum objective function, but the corresponding parameter value keeps changing.

So, I feel a bit perplexed about the logic of optimization in COPASI in general. I hope it doesn't sound silly.

Best,

CardioGlyco-v1.cps

Frank Bergmann

unread,
Nov 4, 2021, 5:48:10 AM11/4/21
to copasi-u...@googlegroups.com
The way the optimization works in your case, is that: 

 - a new random values for your parameters are chosen based on the selected  method (since you chose genetic algorithm, a population of values between 1e-6 and 1e6 are chosen for your parameter)
- each of these values are tested to see what is the minimal value of your chosen expression for those
   -- for that since you selected time course as sub task, each time a time course simulation over the interval [0 1] is run
- then a from there a new guess will be made to improve the value

It is always important to choose parameter ranges that make sense for your model. as it so happens, for the largest part of your range the parameter has very little influence. On your chosen objective function. Here is how you can visualize what is going on: 

- define a new global quantity 'obs' with the assignment expression: {[ADP]}/{[ATP]}
- create a new plot, plotting model time vs the transient value of obs
- select time course
- click the slider button: select Kadp_7, and create a large range as you have with the optimization.
- now as you move these slider along, you see how the simulation updates, but you hardly get any change in the result

You can now also go to scan, and do the same thing there. Vary the parameter in the range, maybe even select the steady state. And you will find that the value hardly changes.

I hope this explains a bit why this is happening. In conclusion:

- think about the ranges of the parameter you want to let varry, what makes sense for your model (in your model parameter values > 1) seem to make no difference
- do you really want to only look at the time course of [0 1]?
- scans / sliders help to visualize what happens.

cheers
Frank





CardioGlyco-v1_with_plot.cps

Pedro Mendes

unread,
Nov 4, 2021, 8:20:28 AM11/4/21
to copasi-u...@googlegroups.com
Emre,

There are many reasons why the best value of a run may be different from
another run. First you should check if "randomize start values" is
checked. If it is, then each run starts from a different place and
therefore algorithms are very likely to end up in different places
(including the deterministic algorithms).

If the initial values are _not_ randomized then you should only expect
that deterministic algorithms should end in the same place. These
algorithms are Levenberg-Marquardt, Truncated Newton, steepest descent,
NL2SOL, Praxis, Hooke-Jeeves and Nelder-Mead.

However the global optimization algorithms are based on stochasticity
and do not necessarily end up in the same value. Methods in this class
are all teh evolutionary algorithms (including genetic algorithm,
differential evolution, SRES, etc.), particle swarm and simulated
annealing.

A long time ago I published a paper on this topic (which was still for
my older Gepasi software) which talks a little about the algorithms.

Mendes P, Kell DB (1998) Non-linear optimization of biochemical
pathways: applications to metabolic engineering and parameter
estimation. Bioinformatics 14:869–883
https://doi.org/10.1093/bioinformatics/14.10.869


Pedro

On 11/4/21 4:17 AM, Hikmet Emre Kaya wrote:
> Hi Frank,
>
> Sorry for asking too many questions :D I actually managed to do the
> conversion from object display name to Common Name, which gives the
> correct value for the minimum objective function.
>
> My question is about the optimization task itself. I am confused as to
> why COPASI gives a different best parameter value (corresponding to the
> minimum objective function) after each optimization run. Is there a
> document that you can suggest for me to understand the logic of
> optimization better?
>
> Best,
>
> Emre
>
> On Friday, October 29, 2021 at 12:55:23 PM UTC+2 Hikmet Emre Kaya wrote:
>
> Hello again, Frank;
>
> I gave it a try and wrote the following by looking at java bindings
> examples:
>
> CModelValue variableModelValue = model.createModelValue("V");
> variableModelValue.setStatus(CModelEntity.Status_ASSIGNMENT);
>
> variableModelValue.setExpression(expression);
>
> Where, the expression could be, for example = {[ADP]}/{[ATP]}
>
>  String objectiveFunction = variableModelValue.getObject(new
> CCommonName("Reference=Value")).getCN().getString();
>
> When I print out objectiveFunction, I get the following:
>
> *Objective Function: CN=Root,Model=Karlstaedt2019 - G6P accumulation
> via Phosphoglucose isomerase inhibition in heart
> muscles,Vector=Values[V],Reference=Value
> *
> But, when I enter the same expression on COPASI and look at the .cps
> file, the objective function is:
>
> *<ParameterText name="ObjectiveExpression" type="expression">
>           &lt;CN=Root,Model=Karlstaedt2019 - G6P accumulation via
> Phosphoglucose isomerase inhibition in heart
> muscles,Vector=Compartments[cytosol],Vector=Metabolites[ADP],Reference=Concentration>/&lt;CN=Root,Model=Karlstaedt2019
> - G6P accumulation via Phosphoglucose isomerase inhibition in heart
> muscles,Vector=Compartments[cytosol],Vector=Metabolites[ATP],Reference=Concentration>
>         </ParameterText>*
> *
>
> Write a separate class that
> reads this expression, separates
> it into its components
>
> *
>
>  gets the common name for each
> object in the expression
> according to the string. (e.g.,
> if it is Flux.something, get the
> fluxValueReference, if it is
> [something], get the common name
> for the concentration, and so on)
>
> *
>
> After converting them into their
> CN format, it surrounds each
> object with < > brackets.
>
> *
> <https://groups.google.com/d/msgid/copasi-user-forum/54442d7a-3312-46d1-b812-0a3e71472e52n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>
>
> --
> *Hikmet Emre Kaya*
> *
> *
> *Professional Science & Wellness Writer*
> *
> *
> PhD in Computational Glycoenzymology at the
> University of Cape Town
>
> Website <https://hikmetemrekaya.wordpress.com/>
>
>
>
>
> --
> *Hikmet Emre Kaya*
> *
> *
> *Professional Science & Wellness Writer*
> *
> *
> PhD in Computational Glycoenzymology at the
> University of Cape Town
>
> Website <https://hikmetemrekaya.wordpress.com/>
>
>
> --
>
> You received this message because you are subscribed to
> the Google Groups "COPASI User Forum" group.
>
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> copasi-user-fo...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/copasi-user-forum/a501d7a9-9e55-4c35-8c47-13034e1b8c7dn%40googlegroups.com
> <https://groups.google.com/d/msgid/copasi-user-forum/a501d7a9-9e55-4c35-8c47-13034e1b8c7dn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "COPASI User Forum" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to copasi-user-fo...@googlegroups.com
> <mailto:copasi-user-fo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/copasi-user-forum/e9a6b2ab-faa5-4709-9907-d402434d7604n%40googlegroups.com
> <https://groups.google.com/d/msgid/copasi-user-forum/e9a6b2ab-faa5-4709-9907-d402434d7604n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Hikmet Emre Kaya

unread,
Nov 5, 2021, 9:56:56 AM11/5/21
to COPASI User Forum
Dear Frank and Pedro;

Thank you for your insightful comments. These suggestions will definitely help me grasp the logic of optimization much better.

I have one more question related to optimization. In stand alone COPASI, the best value is shown in a live-updating plot, but I am not sure if I can generate the same plot from the Java bindings. It seems that one can only retrieve the final value after the task is finished. Is there a way to iteratively access the value found after each function evaluation?

Frank Bergmann

unread,
Nov 5, 2021, 10:29:27 AM11/5/21
to COPASI User Forum
Hello
 
I have one more question related to optimization. In stand alone COPASI, the best value is shown in a live-updating plot, but I am not sure if I can generate the same plot from the Java bindings. It seems that one can only retrieve the final value after the task is finished. Is there a way to iteratively access the value found after each function evaluation?


I think the idea would be to create a callback class, and attach it to the optimization task when you run the task. Then COPASI will call back your application, at which point you could could read out the current objective value. 

The example below shows how to attach a shutdown handler to the task, so that when the JVM is terminated, the task is stopped. You will have to add to the class to give it access to the optimization problem. On which you call `getSolutionValue` periodically when you want to update your information. 


best
Frank

Hikmet Emre Kaya

unread,
Nov 26, 2021, 5:39:12 AM11/26/21
to COPASI User Forum
Hello Frank!

I have also been working on bringing the Parameter Scan feature into Cytoscape. Currently working on single parameter scan for now. The task does run without errors, but I am confused about retrieving the set of results for each parameter. For example, the user makes a selection from a plot assistant to get steady state concentration for each parameter value and create a plot (as described here: https://www.youtube.com/watch?v=mRPY3m8pWJU).

Do you need to implement the callback class idea here as well?

Frank Bergmann

unread,
Nov 26, 2021, 8:21:07 AM11/26/21
to COPASI User Forum
Hello, 

What you would have to do, is to create an instance of the CDataHandler class, and add all the CN's that you are interested in, to it. Then you attach the datahandler to the datamodel prior to running the scan task, and detach it later. Or you pass it along to the process method. After a successful run, you then retrieve the stored results from the data handler class. Note: it currently only collects real valued references. i have a patch ready to expand it to boolean and integer values, but that is not yet released. 

I dont have an example of doing that in Java right now, here is how it looks in python: 


should you have any trouble with it, let me know and i'll create a java example for it. 

The alternative is to let the task write the output a report file, that you then read back in and extract the data from. 

best
Frank

Hikmet Emre Kaya

unread,
Nov 26, 2021, 8:30:01 AM11/26/21
to COPASI User Forum
Hi Frank,

Thank you for the detailed response. I actually have been trying to create a report file, but it's coming out empty for some reason. Let me go over this example, and I'll get back to you if I have any questions.

Best,

Emre

Hikmet Emre Kaya

unread,
Nov 30, 2021, 4:48:21 AM11/30/21
to COPASI User Forum
Hello Frank,

There is a part that confuses me about this example. Under create_datahandler, there is the line:


if isinstance(obj, COPASI.CModel): # fix for time

obj = obj.getValueReference()

in java, obj = dm.findObjectByDisplayName(name) is a CDataObject, and it does not have the getValueReference option. So, I am not sure how this part translates to Java.

Hikmet Emre Kaya

unread,
Nov 30, 2021, 8:40:10 AM11/30/21
to COPASI User Forum
What also confuses me is that; it seems like the data handler class (or the report) would both store only the results from the run with maximum parameter value. Then, how does one go about getting the in-between values? That's when I thought of the processCallback method.

Frank Bergmann

unread,
Nov 30, 2021, 8:45:37 AM11/30/21
to copasi-u...@googlegroups.com
Hello, so basically in Java you'd need a cast at this point: 

if (obj instance of CModel)
{
  obj = ((CModel)obj).getValueReference()
}

best
Frank

--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.

Frank Bergmann

unread,
Nov 30, 2021, 8:58:35 AM11/30/21
to copasi-u...@googlegroups.com
Can you please provide a complete example (of model  + what you want to scan, and what output you want to have). Then it would be easier to encode that and to explain it in less abstract terms. 

In COPASI the output handlers can collect data at distinct times: before, during or after the task is run. In the data handler class you specify which CN's to collect  at these times using either the function addBeforeName, addDuringName or addAfterName to specify that. After the task is completed you get the results for the respective channel by calling: getBeforedata, getDuringData or getAfterData. 

best
Frank



--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.

Hikmet Emre Kaya

unread,
Nov 30, 2021, 9:33:39 AM11/30/21
to COPASI User Forum
Hello Frank;

I am using this model as an example.

In the parameter scan, I chose the "scan" option, specify one of the reaction parameters as my parameter object (e.g., (Phosphofructosekinase).Vmax_4 with intervals=10; min = 40, and max=160). Then, I click on plot assistant and select Scan of Concentrations, Volumes, and Global Quantity Values. Then, I go to the plot itself and select one of the species (e.g., [ATP]) and delete all the other curves. For the subtask, I chose steady state so that I can monitor how the std st concentration of that metabolite changes throughout the parameter interval. As far as I understand, COPASI then repeats the subtask for each interval by incrementing the parameter value between the min and the max. Then, you generate a plot like the one attached.

So, I am wanting to collect that specific model variable for each parameter value to see its dependency on that parameter.
untitled.png
CardioGlyco-v1.cps

Hikmet Emre Kaya

unread,
Nov 30, 2021, 9:47:25 AM11/30/21
to COPASI User Forum
In my code, I tried to specify the conditions for the number of intervals, min, and max values like this:
            parameterGroup.addParameter("Number of Intervals", CCopasiParameter.Type_UINT);
            CCopasiParameter parameter = parameterGroup.getParameter("Number of Intervals");
            parameter.setUIntValue(some value);

Then, I added the parameter to be scanned:


parameterGroup.addParameter("Object", CCopasiParameter.CN);

parameter=parameterGroup.getParameter("Object")

parameter.setStringValue(the string representation of the CN of that object);

I also defined the subtask in a similar way

Frank Bergmann

unread,
Nov 30, 2021, 10:43:13 AM11/30/21
to copasi-u...@googlegroups.com
Here the example of using the output handler in java: 


I invoked it like: 

   java -cp copasi.jar;. CustomOutput "CardioGlyco-v1.cps" "[ATP]" "[ADP]"

it produces output like: 

[ATP]   [ATP]
1.301643024627298       0.642530054163137
1.6932150133907584      0.5535842632054738
1.879352731470603       0.48802610343669633
1.9900205515407214      0.4414058753996679
2.0657261238718307      0.40597339993295095
2.122188999735226       0.3775488429123931
2.166767986701773       0.3538312767697282
2.2033979691565624      0.3334578978875124
2.2343940840051046      0.315566299836136
2.2612189291772085      0.2995804283474704
2.284848426245759       0.2850983600572651

2.284848426245759       0.2850983600572651

where the first lines are collected during the scan, and the final line after. 


with the copasi file as attached. 

cheers
Frank

You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/64bd8ef2-5abf-4f51-b5bc-6491e9bafe05n%40googlegroups.com.
CardioGlyco-v1.cps

Hikmet Emre Kaya

unread,
Dec 1, 2021, 7:21:56 AM12/1/21
to COPASI User Forum
Hi Frank,

Thanks! This clarifies it a lot. Currently, I am getting the error "Internal problem with scan definition". from the statement

if (!scanTask.initializeRawWithOutputHandler((int)CCopasiTask.OUTPUT_UI, dh))

It makes me think I am making a mistake when specifying the parameters. I was using the code snippet from the Java Bindings.txt as an example


CScanTask scanTask=

(CScanTask)CDataModel.getGlobal().addTask(CCopasiTask.scan);

CScanProblem scanProblem=(CScanProblem)scanTask.getProblem();

// set the desired subtask

scanProblem.setSubtask(CCopasiTask.timeCourse);

// always use the same initial values

scanProblem.setAdjustInitialConditions(false);

// get the ScanItems parameter group from the problem

CCopasiParameterGroup scanItems=scanProblem.getGroup("ScanItems");

// create a new parameter group to hold a scan item

CCopasiParameterGroup scanItem=new CCopasiParameterGroup("scanItem");

// add the parameters "Number of steps", "Type" and "Object" to the

// scan item and set their values

parameterGroup.addParameter("Number of steps",

CCopasiParameter.UINT);

CCopasiParameter parameter=parameterGroup.getParameter("Number of steps");

parameter..setUIntValue(10);

parameterGroup.addParameter("Type", CCopasiParameter.UINT);

parameter=parameterGroup.getParameter("Type")

parameter.setUIntValue(CScanProblem.SCAN_REPEAT);

parameterGroup.addParameter("Object", CCopasiParameter.CN);

parameter=parameterGroup.getParameter("Object")
parameter.setStringValue("");

here, I am confused as to where the parameters are being added. Where was the parameterGroup instance created?  Why are scanItems and scanItem not used for parameter addition in the code above?

Frank Bergmann

unread,
Dec 1, 2021, 8:24:55 AM12/1/21
to copasi-u...@googlegroups.com
Whenever you modify the COPASI document with the API, i recommend that you write the file out to disk and inspect the created copasi file by opening it up in the COPASI GUI, that way you can easily see whether the model was modified correctly or not. 

That being said, there is a better way to create the scan item, i will create a new example for that. 

best
Frank


Hikmet Emre Kaya

unread,
Dec 1, 2021, 9:00:11 AM12/1/21
to copasi-u...@googlegroups.com
Thanks, Frank. That would be helpful. In the meantime, I will be working on improving the communication between COPASI and Cytoscape's Network visualization tools (which is the key reason we wanted to bring it into the Cytoscape platform)



--
Hikmet Emre Kaya

Professional Science & Wellness Writer

Frank Bergmann

unread,
Dec 1, 2021, 9:53:26 AM12/1/21
to COPASI User Forum
Ok, the example is now online. The actual method off adding a scan item, is really just the couple of lines in the method starting on line 31: 


the remaining code deals with parsing the command line arguments into dedicated java objects. Overall running from the command line for example: 

java -cp copasi.jar;. SetupScan CardioGlyco-v1.cps out.cps "Time-Course" "|scan,(Phosphofructosekinase).Vmax_4,10,40,160|"

will open the file CardioGlyco-v1.cps, set the scan subtype to Time-Course, clears the scan items and adds one for the Vmax_4 parameter to go in 10 steps from 40 to 160. The resulting file is written to the out.cps file. You can add as many scan items on the command line in the same format. 

cheers
Frank



Hikmet Emre Kaya

unread,
Feb 5, 2022, 9:27:18 AM2/5/22
to COPASI User Forum
Dear Frank;

I hope this message finds you well.

I have been making a lot of progress with linking COPASI and Cytoscape to utilize Cytoscape's visualization and database options.

I have a quick question. How does one update an initial value (e.g., initial concentration) of an already existing model entity.

I get the concept of creating a vector to store all the changes.

For example, if I want to change the initial concentration of a metabolite, I would do the following:

ObjectStdVector changedObjects = new ObjectStdVector(); 

model.getMetabolite(i).setInitialConcentration(... 

changedObjects.add(model.getMetabolite(i).getInitialConcentrationReference()); 

model.CompileIfNecessary(); 

model.updateInitialValues(changedObjects);


However, the setInitialConcentration method does not seem to change the initial concentration. How does one go about this? I would appreciate it if you could kindly advise.

Regards;

Emre

Hikmet Emre Kaya

unread,
Feb 5, 2022, 9:40:30 AM2/5/22
to COPASI User Forum
update:

I actually figured it out. I needed to use the compileIsInitialValueChangeAllowedMethod() of CMetab.

Frank Bergmann

unread,
Feb 7, 2022, 3:46:44 AM2/7/22
to copasi-u...@googlegroups.com
Your code looked fine (personally, i'd switch the updateInitialValues and compile calls though). Most likely you had a species that was determined by an assignment rule or initial expression, in which case a change to the initial concentration will not apply. 

best
Frank


--
You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.

Hikmet Emre Kaya

unread,
Feb 14, 2022, 7:14:06 AM2/14/22
to COPASI User Forum
Hello Frank,

The code does work for changing .cps files. However, I am running into some issues when I import an SBML file, make changes and save it (and export it).

After making changes in an sbml file and exporting the changed file as SBML, when I need to import it again, I receive the following error.

java.lang.RuntimeException: C++ CCopasiException exception thrown
        at org.COPASI.COPASIJNI.CDataModel_importSBML__SWIG_2(Native Method)
        ...

How does one go about importing an SBML file, changing its values, and saving the new model as an SBML file?

Thanks for your assistance,

Emre

Frank Bergmann

unread,
Feb 14, 2022, 7:23:26 AM2/14/22
to COPASI User Forum
Hello Emre, 

i would have to see the precise code you used, generally,  you should be able to import the file after exporting it. The exception object would have a message with the error that was encountered. Can you let us know what it is? Alternatively, could you print and send me the result of: 

CCopasiMessage.getAllMessageText()

when catching the exception?

thanks
Frank

Hikmet Emre Kaya

unread,
Feb 14, 2022, 8:30:42 AM2/14/22
to COPASI User Forum

Hi Frank,

Below is the CCopasiMessage.getAllMessageText()

All this error shows up when I modify an initial concentration value and re-export the SBML file. The next time I import it, I receive the error .

error: SBML (40): LIBSBML ERROR 10215 at line 2862 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Km2ATP' in the math element of the <kineticLaw> uses 'Km2ATP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2862 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Km2Glc' in the math element of the <kineticLaw> uses 'Km2Glc' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2862 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Ks2Glc' in the math element of the <kineticLaw> uses 'Ks2Glc' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2862 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm2' in the math element of the <kineticLaw> uses 'Vm2' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2926 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K3Gly' in the math element of the <kineticLaw> uses 'K3Gly' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2926 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Km30' in the math element of the <kineticLaw> uses 'Km30' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2926 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Km3G6P' in the math element of the <kineticLaw> uses 'Km3G6P' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2926 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm3' in the math element of the <kineticLaw> uses 'Vm3' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2926 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'n3' in the math element of the <kineticLaw> uses 'n3' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K4AMP' in the math element of the <kineticLaw> uses 'K4AMP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K4ATP' in the math element of the <kineticLaw> uses 'K4ATP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K4F6P' in the math element of the <kineticLaw> uses 'K4F6P' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'L40' in the math element of the <kineticLaw> uses 'L40' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm4' in the math element of the <kineticLaw> uses 'Vm4' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c4AMP' in the math element of the <kineticLaw> uses 'c4AMP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c4ATP' in the math element of the <kineticLaw> uses 'c4ATP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c4F6P' in the math element of the <kineticLaw> uses 'c4F6P' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'g4R' in the math element of the <kineticLaw> uses 'g4R' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 2996 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'gT' in the math element of the <kineticLaw> uses 'gT' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5ADP' in the math element of the <kineticLaw> uses 'K5ADP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5AMP' in the math element of the <kineticLaw> uses 'K5AMP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5ATP' in the math element of the <kineticLaw> uses 'K5ATP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5G3P' in the math element of the <kineticLaw> uses 'K5G3P' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5NAD' in the math element of the <kineticLaw> uses 'K5NAD' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K5NADH' in the math element of the <kineticLaw> uses 'K5NADH' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'NAD' in the math element of the <kineticLaw> uses 'NAD' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'NADH' in the math element of the <kineticLaw> uses 'NADH' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3120 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm5' in the math element of the <kineticLaw> uses 'Vm5' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6ADP' in the math element of the <kineticLaw> uses 'K6ADP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6FDP' in the math element of the <kineticLaw> uses 'K6FDP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6PEP' in the math element of the <kineticLaw> uses 'K6PEP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'L60' in the math element of the <kineticLaw> uses 'L60' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm6' in the math element of the <kineticLaw> uses 'Vm6' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6ADP' in the math element of the <kineticLaw> uses 'c6ADP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6FDP' in the math element of the <kineticLaw> uses 'c6FDP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6PEP' in the math element of the <kineticLaw> uses 'c6PEP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'g6R' in the math element of the <kineticLaw> uses 'g6R' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'g6T' in the math element of the <kineticLaw> uses 'g6T' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'h6' in the math element of the <kineticLaw> uses 'h6' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3186 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'q6' in the math element of the <kineticLaw> uses 'q6' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6ADP' in the math element of the <kineticLaw> uses 'K6ADP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6FDP' in the math element of the <kineticLaw> uses 'K6FDP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'K6PEP' in the math element of the <kineticLaw> uses 'K6PEP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'L60' in the math element of the <kineticLaw> uses 'L60' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm7' in the math element of the <kineticLaw> uses 'Vm7' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6ADP' in the math element of the <kineticLaw> uses 'c6ADP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6FDP' in the math element of the <kineticLaw> uses 'c6FDP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'c6PEP' in the math element of the <kineticLaw> uses 'c6PEP' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'g6R' in the math element of the <kineticLaw> uses 'g6R' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'g6T' in the math element of the <kineticLaw> uses 'g6T' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'h6' in the math element of the <kineticLaw> uses 'h6' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3246 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'q6' in the math element of the <kineticLaw> uses 'q6' that is not the id of a species/compartment/parameter/reaction.
.
SBML (40): LIBSBML ERROR 10215 at line 3305 column 8: Outside of a <functionDefinition>, if a <ci> element is not the first element within a MathML <apply>, then the <ci>'s value can only be chosen from the set of identifiers of (in L2V1) <species>, <compartment>, or <parameter> objects; (in L2V2-L2V5), <species>, <compartment>, <parameter> or <reaction> objects; (in L3V1) <species>, <compartment>, <parameter>, <reaction> or <speciesReference> objects and (in L3V2) <species>, <compartment>, <parameter>, <reaction>, <speciesReference> objects or L3 package objects with defined mathematical meaning.
Reference: L2V4 Section 3.4.3
 The formula 'Vm8' in the math element of the <kineticLaw> uses 'Vm8' that is not the id of a species/compartment/parameter/reaction.
.
>EXCEPTION 2022-02-14T15:24:06<
  SBML (27): Error in kinetic law for reaction 'Hexokinase'.
>EXCEPTION 2022-02-14T15:24:06<
  Error while importing reaction "Vhk".
    SBML (27): Error in kinetic law for reaction 'Hexokinase'.

Frank Bergmann

unread,
Feb 14, 2022, 8:50:24 AM2/14/22
to COPASI User Forum
Ok, so we definitely know that the model manipulation broke the model. Now we need to know what functions you called to make your model changes. Could you let me know the model you used and the commands to change it, then i could reproduce it here and tell you what went wrong where. 

best
Frank

Hikmet Emre Kaya

unread,
Feb 14, 2022, 9:18:58 AM2/14/22
to copasi-u...@googlegroups.com
I actually reproduced it on standalone COPASI.

I imported the attached sbml file on COPASI, changed some initial concentration value (e.g., PEP from 0.0212 to 1.0212), clicked on export SBML, and saved it as sbml lvl 2 version 4.

The next time I want to import it, it is going to give the following error

Error while loading file /home/people/hkaya/Downloads/CardioGlyco-v1.xml!


>EXCEPTION 2022-02-14T16:05:04<

Error while importing reaction "HXT".

SBML (27): Error in kinetic law for reaction 'Glucose transport'.


So, it's actually not the code itself causing the error, I think. It has to do with how one imports, modifies and saves and SBML in general. I tried this with other sbml files (.xml) and even tried importing and exporting without changing anything. It still breaks the file somehow.


Let me know what you think.

...

CardioGlyco-v1.xml

Frank Bergmann

unread,
Feb 14, 2022, 10:27:53 AM2/14/22
to copasi-u...@googlegroups.com
For whatever reason, some of the local parameters are not written out during the export. This has already been resolved in the meantime, and if you let me know what architectures you need binaries for i can send you some. 

In the meantime the workaround would be to save the file as COPASI file (`saveModel`) and then reload it (`loadModel`) before the export. 

sorry for the inconvenience. 

best
Frank


Hikmet Emre Kaya

unread,
Feb 15, 2022, 4:40:22 AM2/15/22
to COPASI User Forum
Hello Frank,

openjdk 11.0.9 2020-10-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.9+11-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11-LTS, mixed mode, sharing) (I am not sure if this is what you are asking)

Also, the alternative method is causing Cytoscape to crash with the following error:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000000000000, pid=11511, tid=11535
#
# JRE version: OpenJDK Runtime Environment 18.9 (11.0.9+11) (build 11.0.9+11-LTS)
# Java VM: OpenJDK 64-Bit Server VM 18.9 (11.0.9+11-LTS, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  0x0000000000000000
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/people/hkaya/Cytoscape_v3.8.2/framework/hs_err_pid11511.log
#
# If you would like to submit a bug report, please visit:
#   https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%207&component=java-11-openjdk
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
./framework/bin/karaf: line 177: 11511 Aborted                 ${KARAF_EXEC} "${JAVA}" ${JAVA_OPTS} --add-reads=java.xml=java.logging --add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED --patch-module java.base=$KARAF_HOME/lib/endorsed/org.apache.karaf.specs.locator-4.2.4.jar --patch-module java.xml=$KARAF_HOME/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.4.jar -p $KARAF_HOME/lib/openjfx/$JAVAFX_DIR --add-modules javafx.base,javafx.swing,javafx.media,javafx.web --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dkaraf.instances="${KARAF_HOME}/instances" -Dkaraf.home="${KARAF_HOME}" -Dkaraf.base="${KARAF_BASE}" -Dkaraf.data="${KARAF_DATA}" -Dkaraf.etc="${KARAF_ETC}" -Dkaraf.log="${KARAF_LOG}" -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir="${KARAF_DATA}/tmp" -Djava.util.logging.config.file="${KARAF_BASE}/etc/java.util.logging.properties" ${KARAF_SYSTEM_OPTS} ${KARAF_OPTS} ${OPTS} -classpath "${CLASSPATH}" ${MAIN} "$@"

Frank Bergmann

unread,
Feb 15, 2022, 4:54:39 AM2/15/22
to copasi-u...@googlegroups.com
Hello, you can find new Java bindings (and an updated COPASI) under  http://bqfrank.spdns.org.


Without seeing the details, the crash is likely coming from a reference your application holds to elements that have been removed. Without seeing a stack trace, or the code that caused this, i cannot say more. 

best
Frank


You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/9eb79323-202f-47e0-adb6-0ba2761d7e7dn%40googlegroups.com.

Hikmet Emre Kaya

unread,
Feb 15, 2022, 9:53:27 AM2/15/22
to COPASI User Forum
Hello Frank,

I have downloaded and installed the new Java Bindings, thanks!

When the sbml file is of the format L2V1, then the exportSBML function works perfectly in both COPASI and its java bindings.
Example: https://www.ebi.ac.uk/biomodels/BIOMD0000000061

when the format is L2V4: export SBML still works perfectly in standalone COPASI, I can change a model value, and the change will be saved in the exported file.
With the java bindings version, the exportSBML method will not register any changes made in the model. I definitely made sure overwrite is possible by writing dm.exportModel(modelName, true)
Example: https://www.ebi.ac.uk/biomodels/BIOMD0000000063

Is there a specific issue in the exportSBML java bindings version that allows modifications only in certain SBML versions?

Perhaps you could try to import, change model values (e.g., some initial concentration), and export the above .xml files in java bindings and let me know if you run into the same issue?

Hikmet Emre Kaya

unread,
Feb 15, 2022, 10:38:18 AM2/15/22
to COPASI User Forum
Actually, testing it on more SBML L2V4 files, I realized that the problem is specific to this sbml model : https://www.ebi.ac.uk/biomodels/BIOMD0000000063, but I am not sure what makes this one file unalterable

Frank Bergmann

unread,
Feb 16, 2022, 3:36:28 AM2/16/22
to COPASI User Forum
I cannot reproduce the issue, like i said, i would need to know precisely which things you are changing, and how you are exporting things. Without that information, i can only guess at what is going on. 

I put together an example like you asked, that imports sbml, changes things exports, and then does the same thing many times over. I have found no issues with the bindings i send to you. 

best
Frank

changeInitialConditionAndValidate.java

Frank Bergmann

unread,
Feb 16, 2022, 3:38:15 AM2/16/22
to COPASI User Forum
As for your question what is different about the model #63, it uses flux expressions in an assignment rule. This is not a feature available in earlier versions of SBML. If you try to export it as Level 1, or L2V1, then this would not be possible. 

Frank

On Tuesday, February 15, 2022 at 4:38:18 PM UTC+1 hikmete...@gmail.com wrote:

Hikmet Emre Kaya

unread,
Feb 23, 2022, 7:56:58 AM2/23/22
to COPASI User Forum
That makes perfect sense, exportSBML() automatically exports to L2V1, unless you specify otherwise.

Also, what OS are you using? I am having trouble opening the app in Mac because it crashes when I try to import files. I copied the .so file to java.library.path, but still did not manage to solve this. Do you have any idea? I have not had this issue in Linus CentOS or Windows.

Frank Bergmann

unread,
Feb 23, 2022, 8:41:19 AM2/23/22
to COPASI User Forum
I'm using all of the operating systems. For the mac, the file is called libCopasiJava.jnilib, and it needs to be in the java.library.path. If you try to System.loadLibrary that one, do you get an error message? If it is a new mac (with arm architecture) that would fail unless you start the application in x64 mode. 

best
Frank

Hikmet Emre Kaya

unread,
Feb 23, 2022, 9:00:15 AM2/23/22
to COPASI User Forum
No,I actually was using the .so file in Mac as well, that's why it must have crashed.

Hikmet Emre Kaya

unread,
Apr 1, 2022, 4:41:18 AM4/1/22
to COPASI User Forum
Hello Frank;

I hope you are doing well. I wanted to ask a general question about creating a model with the Java Bindings.

I realized that when I tried to change the status of a metabolite (e.g., it was REACTIONS by default and I changed it to FIXED) and its initial concentration at the same time, the initial concentration did not change, even when I use the void .compileIsInitialValueChangeAllowed();  I am not sure why editing both the status and the initial concentration is not possible. I hope I am making sense.

Best,

Emre

Hikmet Emre Kaya

unread,
Apr 1, 2022, 4:47:03 AM4/1/22
to COPASI User Forum
I actually fixed it by compiling and updating before I changed the status, and the updating and compiling again after I changed the status

model.getMetabolite(i).compileIsInitialValueChangeAllowed();
                               
model.getMetabolite(i).setInitialConcentration(...
changedObjects.add(model.getMetabolite(i).getInitialConcentrationReference());
model.updateInitialValues(changedObjects);
model.compileIfNecessary();
                               
                                model.getMetabolite(i).setStatus(...);
                                model.updateInitialValues(changedObjects);
                                model.compileIfNecessary();

Hikmet Emre Kaya

unread,
Sep 12, 2022, 7:30:55 AM9/12/22
to COPASI User Forum
Hello Frank,

I wanted to ask you about data collection during Parameter Scan. I tried to implement this example: https://github.com/copasi/COPASI/blob/release/Version-4.35/copasi/bindings/java/examples/CustomOutput.java

When the subTask is Time Course, there is no problem with the DataHandler collecting "During" data, but it does not collect any during data when the subtask is steady-state.
dh.getNumRowsDuring(); gives zero

Is there additional specification needed for when the subtask is steady-state?

Thanks,

Frank Bergmann

unread,
Sep 12, 2022, 11:39:21 AM9/12/22
to COPASI User Forum
Indeed, that is expected. The steady state result is only available at the end of the computation. So you have to collect the steady state results using the DataHandler methods: 

void addAfterName(const CRegisteredCommonName & name);

and then retrieve them using: 

const std::vector< C_FLOAT64 >& getAfterData() const;

best
Frank

Hikmet Emre Kaya

unread,
Sep 13, 2022, 4:36:41 AM9/13/22
to copasi-u...@googlegroups.com
Hi Frank,

Thanks for the response. The issue is, it gives me the values for only the last interval of parameter scan. But, I want the results for each parameter scan interval.

        dh.addAfterName(new CRegisteredCommonName( obj.getCN().getString()));
        After running the task;

 FloatStdVector data = dh.getAfterData();
     
      for (int j = 0; j < data.size(); j++)
      {
        System.out.print(data.get(j));
        if (j + 1 < data.size())
          System.out.print("\t");
      }
   }

I also thought about creating a while loop around FloatStdVector, but then data collection will run forever. I am not sure what I am missing.


Frank Bergmann

unread,
Sep 13, 2022, 5:05:53 AM9/13/22
to COPASI User Forum
The best thing is to always compare what you are doing with how things work in the COPASI User Interface. Does it work there? When you are using a time course parameter scan, 'output during subtask execution' should be turned on. For a steady state scan, this makes no sense, and there the parameter has to turned off. So are you changing the value using:

CScanProblem.setOutputInSubtask

If we would see more of your code, or perhaps a model you are having issues with, I could help out better. 

best
Frank



Hikmet Emre Kaya

unread,
Sep 13, 2022, 5:32:55 AM9/13/22
to copasi-u...@googlegroups.com
Hi Frank,

I created a snippet of my parameter scan code (the actual code is very convoluted).

Then, I have this SBML model, where I run a scan by changing the initial concentration of an inhibitor [sorafenib]_0 from 0 to 5 micromolar in 10 intervals. Then, I am trying to collect std-st concentrations for all metabolites.

When I do it in COPASI UI, I can collect steady-state results in a report file (attached CSV). There, I can obtain the results for every interval.

I had not set  CScanProblem.setOutputInSubtask at all.

I hope this makes sense

Best,

Emre



--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.
Alcohol_ss_model.csv
Alcohol_ss_model.xml
ScanSnippet.java

Frank Bergmann

unread,
Sep 13, 2022, 6:27:48 AM9/13/22
to COPASI User Forum
Thank you that explains what is happening. As mentioned before, please set

       scanProblem.setOutputInSubtask(false);

after you set the steady state subtask. Then use the during calls (addDuringName, getNumRowsDuring, getNthRow) again as you had it originally. Now you will receive data from the steady state scan. 

sorry for the confusion. 

best
Frank

Hikmet Emre Kaya

unread,
Sep 13, 2022, 7:47:55 AM9/13/22
to copasi-u...@googlegroups.com
Oh okay, that works perfectly. Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.

Hikmet Emre Kaya

unread,
Sep 13, 2022, 10:22:38 AM9/13/22
to COPASI User Forum
Sorry for asking too many questions but I am experiencing a minor issue.

For retrieving std-st fluxes,

in the line dm.findObjectByDisplayName(displayName) , which is for adding items to DataHandler, I am getting the couldn't resolve displayName error (where the displayName would be: model.getReaction(i).getObjectDisplayName)

why is it that this method is throwing an error for reaction display names but not for metabolites?

Frank Bergmann

unread,
Sep 13, 2022, 11:41:15 AM9/13/22
to COPASI User Forum
`findObjectByDisplayName` only recognizes elements manually encoded there. So for Reactions we added local parameter, and the Flux Reference. So `findObjectByDisplayName("(R1).Flux")` would resolve to the flux reference of reaction R1, and `findObjectByDisplayName("(R1).k1")` to the value of the local parameter k1. 

We could add more things if needed. In general though, if you already have the reaction element itself, it would be better to use that than the slower search through the model itself. 

best
Frank

Hikmet Emre Kaya

unread,
Sep 14, 2022, 4:33:55 AM9/14/22
to copasi-u...@googlegroups.com
Hi Frank,

I followed your advice and ensured that I am adding the flux references to the DataHandler, as in:

CN=Root,Model=onecarbon_glutathione_metabolism_1,Vector=Reactions[b_gsg_decomp],Reference=Flux

However, the DataHandler is simply not collecting flux data during or after the parameter scan. Which doesn't make sense because flux collection is running fine in Copasi UI

--
You received this message because you are subscribed to a topic in the Google Groups "COPASI User Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/copasi-user-forum/g_gVsfDofOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to copasi-user-fo...@googlegroups.com.

Frank Bergmann

unread,
Sep 14, 2022, 4:53:39 AM9/14/22
to copasi-u...@googlegroups.com
I'm afraid i have to again ask for more information. If i could see the copasi file that works for you, and then the code where you are trying to do the same, then i could point out what is different. 

best
Frank

You received this message because you are subscribed to the Google Groups "COPASI User Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copasi-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copasi-user-forum/CAFJfJ8geqBanFd864EOaphcFwTUCCG0csnNyJ2yUs03bpCkdyA%40mail.gmail.com.

Hikmet Emre Kaya

unread,
Sep 14, 2022, 5:05:38 AM9/14/22
to COPASI User Forum
Hi Frank,

It is the same code that I sent you yesterday. Instead of concentrations, I am trying to add flux references to the DH. You can find a slightly modified version attached. Also attached is the excel report that COPASI UI gives me. (for the same SBML model from yesterday).

Regards,

Emre
Alcohol_ss_model-fluxes.csv
ScanSnippet.java

Hikmet Emre Kaya

unread,
Sep 14, 2022, 5:07:11 AM9/14/22
to COPASI User Forum
P.s. this is happening despite adding        scanProblem.setOutputInSubtask(false);

Frank Bergmann

unread,
Sep 14, 2022, 7:45:25 AM9/14/22
to copasi-u...@googlegroups.com
Hello, 

making the snippet compile, ensuring that the output is collected from the subtask only after it is run, and collecting the information during the scan, as we discussed yesterday. works for me. I'll attach the working example and its output. 

best
Frank
ScanSnippet.java
out.tsv

Hikmet Emre Kaya

unread,
Sep 19, 2022, 8:57:36 AM9/19/22
to COPASI User Forum
Hi Frank,

It does indeed work! I just noticed a syntax error in my code and fixed it. Thanks!
Reply all
Reply to author
Forward
0 new messages