Location: cellLib @ 701e8cebe4ae / Scripts / readme.txt

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2022-05-17 17:36:49+12:00
Desc:
Make a correction
Permanent Source URI:
https://models.cellml.org/workspace/6bc/rawfile/701e8cebe4ae7dde52fcefc1ea27c2fb6b39fdee/Scripts/readme.txt

This folder includes the scripts to build cellML models, validate the models using libcellml, run OpenCOR simulation using a Python script, plot the simulation results.
The software tools or language needed are Matlab, OpenCOR and Python. This document does not provide instructions for each script execution but only some examples, source of relevant documentation, or the software environment settings.

1. Set up virtual environment and packages for Python to process CellML modelling tasks:
   python -m venv venvCellML
   pip install matplotlib 
   pip install numpy
   pip install setuptools   
   pip install libcellml
   pip install pandas

2. preModels.psl can be used to activate the Python virtual environment provided the Python virtual environment folder has to be changed to match the one on your machine.

3. The documentation of Python support for OpenCOR: https://opencor.github.io/user/pythonSupport.html#pythonsupport

4. Install a Python package (e.g, pandas) for OpenCOR in PowerShell:
(1) Navigate to the OpenCOR installation folder, e.g., cd C:\Users\wai484\Documents\OpenCOR
(2) Type "./jupyterconsole.bat"
(3) !pip install pandas 
(4) Here is an example of command history:
    (venvCellML) PS C:\Users\wai484\Documents\OpenCOR> ./jupyterconsole.bat
    Jupyter console 6.0.0
    Jupyter kernel for OpenCOR
    !pip install pandas

5. The procedure of converting .txt file to .cellml using OpenCOR in PowerShell:
(1) # The OpenCOR installation folder path
    $dpath= 'C:/Users/wai484/Documents/OpenCOR'
(2) # The model directory where .txt and .cellml are saved
    $mpath='C:/Users/wai484/Documents/SinglePASMC/Experiments'
(3) # Execute the command to do the conversion
    .$dpath/OpenCOR -c CellMLTextView::export $mpath/PASMC_test.txt | out-file $mpath/PASMC_test.cellml -encoding utf8
	
6. Validate the cellML models using libcellml:
(1) In the Simulation view in OpenCOR, export the model as COMBINE Archive
(2) Upload the .omex file to https://libcellml.org/translate, where provides the service that will accept CellML 1.0/1.1 compliant files and transform them into CellML 2.0 compliant files.
(3) Download and unzip the model file.
(4) modelValidation.py can be reused to write the validation script for specific models.

7. Run OpenCOR simulation using Python shell in PowerShell:
(1) # The OpenCOR installation folder path
    $dpath= 'C:/Users/wai484/Documents/OpenCOR'
(2) # The simulation Python script directory where the script is present
    $mpath='C:/Users/wai484/Documents/SinglePASMC/Simulation/src'
(3) # The simulation Python script
    $mfile='simFig4.py'
(4) # Run the simulation script using Python shell
    .$dpath/pythonshell.bat $mpath/$mfile

8. simExp.py and plotExp.py can be reused to write Python scripts to run OpenCOR simulation and plot the simulation results.
	
9. Prepare the documentation for the model publication in PMR using reStructuredText
(1) In the Python virtual environment install the package Sphinx if haven't: pip install -U Sphinx
(2) Navigate to the folder where you want to place the documentation files, e.g., cd to C:\Users\wai484\Documents\EC_uterineSMC\Doc
(3) Activate the Python virtual environment, and type "sphinx-quickstart" in the terminal
(4) Create .rst files in the folder and edit them in VS code.

10. The Matlab scripts are for building cellML models without OpenCOR editor but not ready for public use yet.