ModellingWebLab / weblab-fc

Functional Curation backend for the Modelling Web Lab
Other
1 stars 0 forks source link

Build Status codecov

Functional Curation backend for the Modelling Web Lab

This is a Python implementation of the Functional Curation (FC) language, intended for use with the Cardiac Electrophysiology Web Lab.

Documentation on FC can be found here, while the syntax of FC protocols is described here.

An ongoing attempt to document the Web Lab and all its interconnected technologies can be viewed in the weblab docs repository.

No Windows support

FC is tested/developed on Linux and OS/X. There are no plans to run it work on Windows.

It might run on Windows, if you have installed CVODE with the shared libraries, and an MSVC compiler that matches your Python installation (see here).

Transition!

This package is currently in transition, migrating the functional curation code from being a Chaste extension project to a standalone Python package. In particular, we're replacing the CellML and code-generation tool PyCml with cellmlmanip to read and manipulate CellML code and a new module within weblab-fc to generate Model code.

The code from before this transition started can be seen at the tag pycml-version, but crucial parts of PyCml weblab code are also temporarily stored in the pycml directory. Most of the code from pycml_protocol.py will have to be replaced by (1) changes to fc so that it extracts and stores all the protocol information, and (2) a new code generation module in fc that can use information provides by weblab protocols to generate simulation code. (At the moment both fc and pycml read the protocol, but in the new code fc should gather all the information and then pass it to the code generation component of fc.)

Installation

In order to build the package you need Cython and numpy. These can be installed with:

pip install -r requirements/setup.txt

The ontologies used are in a separate module, to install this run

git submodule init
git submodule update

You also need to have CVODE (from Sundials) installed. If you do this with your system package manager no further setup is (probably) needed. Alternatively you can install it using conda:

conda install sundials -c conda-forge

In this case, or if it is installed in another non-standard location on your machine, you'll need to set environment variables to tell Cython where to find it, e.g.:

export CFLAGS="-I$HOME/anaconda3/envs/weblab/include"
export LDFLAGS="-L$HOME/anaconda3/envs/weblab/lib"

Because the weblab_fc module has Cython components, it needs to be compiled before you can use it. Compilation is performed using Python's distutils and setuptools, and happens automatically when you install the package using setup.py. For developers, this can be done using:

pip install -e .[dev,test]

Note that you'll need to repeat this step after any changes to Cython files (e.g. .pyx or .pxd files), because these don't automatically get recompiled.

Full installation steps on Jonathan's Macbook (slightly out of date)

export CONDA_ENV=weblab-fc-py36
conda create -n $CONDA_ENV python=3.6
conda activate $CONDA_ENV
conda install -c conda-forge sundials=4 pytables scipy numpy numexpr
pip install -r requirements/setup.txt
./requirements/weblab_cg.sh
export CFLAGS="-I/anaconda3/envs/$CONDA_ENV/include"
export LDFLAGS="-L/anaconda3/envs/$CONDA_ENV/lib"
pip install -e .[dev,test]