CellML Discussion List

Text archives Help


Re: [cellml-discussion] CellML model not rendered in OpenCOR


Chronological Thread 
  • From: Alan Garny <a.garny AT auckland.ac.nz>
  • To: "cellml-discussion AT cellml.org" <cellml-discussion AT cellml.org>
  • Cc: "cellml-discussion AT lists.cellml.org" <cellml-discussion AT lists.cellml.org>
  • Subject: Re: [cellml-discussion] CellML model not rendered in OpenCOR
  • Date: Wed, 6 Jul 2022 21:33:52 +0000
  • Accept-language: en-NZ, en-GB, en-US
  • Suggested_attachment_session_id: 0a66de63-dfa3-6b79-2378-40ddcfeb9972

You are right Matthias, this is a bottleneck in CellML 2.0 support at the
moment. OpenCOR can be used from Python and CellML 1.0/1.1 models (see
https://opencor.github.io/user/pythonSupport.html#pythonsupport). Still,
Michael's Myokit might indeed be your best option at this stage.

Alan
________________________________
From:
cellml-discussion-request AT lists.cellml.org

<cellml-discussion-request AT lists.cellml.org>
on behalf of Matthias König
<konigmatt AT googlemail.com>
Sent: Thursday, 7 July 2022 2:46 am
To:
cellml-discussion AT cellml.org

<cellml-discussion AT cellml.org>
Cc:
cellml-discussion AT lists.cellml.org

<cellml-discussion AT lists.cellml.org>
Subject: Re: [cellml-discussion] CellML model not rendered in OpenCOR

Hi Michael,
thanks. This looks great and exactly what I was looking for.
I will give it a try.
Best Matthias

On Wed, Jul 6, 2022 at 12:11 PM Michael Clerx
<work AT michaelclerx.com<mailto:work AT michaelclerx.com>>
wrote:

On 7/6/22 10:09, Matthias König wrote:

Is there a python library with which I can generate CellML 1.0/1.1?

Hi Matthias,

Myokit is a Python library that can import and export CellML 1.0 and 1.1
(with exceptions, see here:
https://github.com/MichaelClerx/cellml-validation/blob/master/reports/README.md<https://github.com/MichaelClerx/cellml-validation/blob/master/reports/README.md>,
the main one being imports)

Since April 2020 it can also import and export CellML 2.0 (without imports or
resets)

It can import SBML (with some serious improvements in support in the last 2
years: it is now being used for PKPD modelling with SBML models)

It can export to C with euler or CVODES, matlab, html, latex and python, and
various formats specifically for cardiac cell modelling (EasyML, OpenCL and
CUDA multi-cell simulations, plus import of ephys data from ABF and WCP)

So yeah it's called "import" and "export" and there's an intermediate
representation which users can read (like OpenCOR has too) so some structure
& names won't get carried over, but apart from those cosmetic issues... You
can definitely import SBML and export CellML 1.0, 1.1, or 2.0 with Myokit :D

Myokit's main goal is to simulate stuff with CVODES, so you can do that too.

Cheers,
Michael






On 7/6/22 10:09, Matthias König wrote:
Hi Alan,
thanks for the answer.

So do I understand correctly,
- the main library libcellml (corresponding to the python package libcellml)
only generates cellml 2.0
- the main simulator OpenCOR only supports CellML version 1.0/1.1
This seems like a major bottleneck in CellML support at the moment.

Is there a python library with which I can generate CellML 1.0/1.1?

As part of a google summer of code project we working on a showcase of the
COMBINE standards with jupyter notebooks. Currently we are working on the
CellML repressilator model, i.e. we want to create & simulate the model using
CellML python libraries.

Is there a simple workflow to create and simulate CellML with python
(preferable using OpenCOR)?
Are there any good converters? I know of antimony which uses the old cellml
library. Is there anything else for CellML -> SBML or other ODE format (e.g.
writing CVODE code or similar things).
As I understand cellml most of the things should be convertable to SBML with
exception of models not using time as a dependent variable and likely some
strange event syntax? Is this true or are there other conversion issues?

Best Matthias







On Wed, Jul 6, 2022 at 1:09 AM Alan Garny
<a.garny AT auckland.ac.nz<mailto:a.garny AT auckland.ac.nz>>
wrote:
No, only from CellML 1.0/1.1 to CellML 2.0.

We use XSLT for that conversion and I am not sure we could do something
similar for CellML 2.0 to CellML 1.0/1.1. Indeed, in CellML 2.0, connections
don't hold any directionality information. So, to convert CellML 2.0 to
CellML 1.0/1.1 would require analysing the model to determine that
directionality information. So, yes, it wouldn't be as straightforward as
converting from CellML 1.0/1.1 to CellML 2.0.

Alan
________________________________
From:
cellml-discussion-request AT lists.cellml.org<mailto:cellml-discussion-request AT lists.cellml.org>

<cellml-discussion-request AT lists.cellml.org<mailto:cellml-discussion-request AT lists.cellml.org>>
on behalf of Lucian Smith
<lucianoelsmitho AT gmail.com<mailto:lucianoelsmitho AT gmail.com>>
Sent: Wednesday, 6 July 2022 9:15 am
To: CellML Discussion List
<cellml-discussion AT cellml.org<mailto:cellml-discussion AT cellml.org>>
Subject: Re: [cellml-discussion] CellML model not rendered in OpenCOR

Is there a converter from CellML 2.0 to 1.1?

On Tue, Jul 5, 2022 at 1:55 PM Alan Garny
<a.garny AT auckland.ac.nz<mailto:a.garny AT auckland.ac.nz>>
wrote:
Hi Matthias,

Sorry, but libCellML generates CellML 2.0 models while OpenCOR "only"
supports CellML 1.0/1.1 at this stage. So, yes, using OpenCOR, you won't be
able to edit/run any model generated by libCellML.

Support for CellML 2.0 in OpenCOR is planned, but it is still some time away.
This will be done through libOpenCOR, OpenCOR's new backend which will be
using libCellML rather than the original CellML API. (The reason for going
the libOpenCOR route is that libOpenCOR will greatly improve our Python
bindings.)

Hopefully, I will have more information to share at COMBINE in October.

Alan
________________________________
From:
cellml-discussion-request AT lists.cellml.org<mailto:cellml-discussion-request AT lists.cellml.org>

<cellml-discussion-request AT lists.cellml.org<mailto:cellml-discussion-request AT lists.cellml.org>>
on behalf of Matthias König
<konigmatt AT googlemail.com<mailto:konigmatt AT googlemail.com>>
Sent: Wednesday, 6 July 2022 3:17 am
To:
cellml-discussion AT lists.cellml.org<mailto:cellml-discussion AT lists.cellml.org>

<cellml-discussion AT lists.cellml.org<mailto:cellml-discussion AT lists.cellml.org>>
Subject: [cellml-discussion] CellML model not rendered in OpenCOR

Hi all,
I am trying to create the repressilator in CellML as part of a project via
the python binding.
Unfortunately, the created models (cellml v2.0) are not rendered in OpenCOR.
I.e. normally I see nice CellML Text in the editor, but for the attached
model nothing is displayed.

```

<?xml version="1.0" encoding="UTF-8"?>
<model
xmlns="http://www.cellml.org/cellml/2.0#<http://www.cellml.org/cellml/2.0#>"
name="repressilator">
<component name="parameters">
<variable name="n" units="dimensionless" initial_value="2"/>
</component>
</model>

```
Model was created using libcellml via

```

import libcellml
from cellml_utilities import print_model


def create_model(cellml_path: Path) -> libcellml.Model:
"""Create CellML repressilator and save to Path."""
model = libcellml.Model()
model.setName("repressilator")

comp_parameters = libcellml.Component()
comp_parameters.setName("parameters")
model.addComponent(comp_parameters)

# var n: dimensionless {init: 2, pub: out};
var_n = libcellml.Variable()
var_n.setName("n")
var_n.setInitialValue(2.0)
var_n.setUnits("dimensionless")
# var_n.setInterfaceType()
comp_parameters.addVariable(var_n)

# Checking that it worked
print_model(model)

# Save model
printer = libcellml.Printer()
serialised_model: str = printer.printModel(model)

with open(cellml_path, "w") as f_cellml:
f_cellml.write(serialised_model)

return model

```

How can I create models with python libcellml which I can use/edit/view in
OpenCOR?
Best Matthias

--
Matthias König, PhD.
Junior Group Leader Systems Medicine of the Liver Lab
Humboldt-Universität zu Berlin,
Institute of Biology, Institute for Theoretical Biology
Philippstraße 13, Haus 20, 10115 Berlin
Tel: +49 30 2093 98435
https://livermetabolism.com<https://livermetabolism.com>
konigmatt AT googlemail.com<mailto:konigmatt AT googlemail.com>
https://twitter.com/konigmatt<https://twitter.com/konigmatt>
https://github.com/matthiaskoenig<https://github.com/matthiaskoenig>


--
Matthias König, PhD.
Junior Group Leader Systems Medicine of the Liver Lab
Humboldt-Universität zu Berlin,
Institute of Biology, Institute for Theoretical Biology
Philippstraße 13, Haus 20, 10115 Berlin
Tel: +49 30 2093 98435
https://livermetabolism.com<https://livermetabolism.com>
konigmatt AT googlemail.com<mailto:konigmatt AT googlemail.com>
https://twitter.com/konigmatt<https://twitter.com/konigmatt>
https://github.com/matthiaskoenig<https://github.com/matthiaskoenig>


--
Matthias König, PhD.
Junior Group Leader Systems Medicine of the Liver Lab
Humboldt-Universität zu Berlin,
Institute of Biology, Institute for Theoretical Biology
Philippstraße 13, Haus 20, 10115 Berlin
Tel: +49 30 2093 98435
https://livermetabolism.com<https://livermetabolism.com>
konigmatt AT googlemail.com<mailto:konigmatt AT googlemail.com>
https://twitter.com/konigmatt<https://twitter.com/konigmatt>
https://github.com/matthiaskoenig<https://github.com/matthiaskoenig>



Archive powered by MHonArc 2.6.18.

Top of page