ALL Metrics
-
Views
-
Downloads
Get PDF
Get XML
Cite
Export
Track
Software Tool Article

Semi-automated Modular Program Constructor for physiological modeling: Building cell and organ models

[version 1; peer review: 1 approved with reservations]
PUBLISHED 16 Dec 2015
Author details Author details
OPEN PEER REVIEW
REVIEWER STATUS

Abstract

The Modular Program Constructor (MPC) is an open-source Java based utility, built upon JSim's Mathematical Modeling Language (MML) (http://www.physiome.org/jsim/) that uses directives embedded in model code to construct larger, more complicated models quickly and with less error than manually combining models. A major obstacle in writing complex programs for modeling physiological processes is the large amount of time it takes to code the myriad processes taking place simultaneously in cells, tissues, and organs. MPC replaces this task by code-generating algorithms that take the code from several different modules and produce model code for a new JSim model. This is particularly useful during multi-scale model development where many variants are to be configured and tested against data. MPC is implemented in Java and requires JSim to use its output. MPC source code and documentation are available at http://www.physiome.org/software/MPC/.

Keywords

multi-scale modeling, JSim, systems biology, physiological modeling, reproducibility, uncertainty quantification

Introduction

Many attempts have been made to provide modular programming systems for physiological applications (Erson et al., 2012; Krause et al., 2010; Mirschel et al., 2009; Smith et al., 2009). We describe our system as a semi-automated modular programming construction. It is simple and not conceptually novel, but is easy to learn and use. For developing a series of models of increasing complexity, Modular Program Constructor (MPC) can serve well as the basis of the modeling code. The perspective is to take a modular approach; this means that for multi-scale modeling one builds from simple elements initially and then uses multi-modular constructs as modules in higher level systems.

In MPC, a module can be any set of variable declarations, parameter declarations and mathematical equations that represent a process. This broad definition of a module has a broad variety of applications: from a simple first order enzyme reaction, to a complete model of coronary blood flow through heart muscle, which can then be incorporated into a yet larger systemic model.

Based on ModelBuilder, which used FORTRAN to parse code and define directives (Raymond, 2008), we designed the current version in Java and renamed it MPC. It is now refined, simplified, robust, and used to develop several new applications (Raymond et al., 2011; Raymond et al., 2012). The models include time-dependent two-dimensional models in both Cartesian and cylindrical coordinates (Raymond et al., 2011; Raymond et al., 2012), as well as whole organ models with heterogeneous flow re-implementing earlier complex whole organ models of substrate metabolism (Bassingthwaighte et al., 1989).

Methods

MPC implementation

MPC is a pre-compiler written in Java. It reads a text input file, parses the file for directives, and generates a text output file based on those directives. MPC is built upon the Mathematical Modeling Language (MML) of JSim (http://www.physiome.org/jsim/) (Butterworth et al., 2014). It has been designed to work with JSim's MML and currently requires JSim to run the model output file that MPC produces. Through JSim, the final constructed model can be exported into Systems Biology Markup Language (SBML, http://sbml.org/Main_Page), CellML (https://www.cellml.org/), and downloaded from these sources to other simulation platforms (Smith et al., 2014). MPC currently is executed as command line utility and requires the Java runtime environment (https://java.com/).

MPC has three components:

  • 1. MML, the mathematical modeling language of JSim, is a declarative language designed for solving all the equations simultaneously; it is not procedural. MML is used for declaring parameters and variables, for defining algebraic equations, ordinary differential equations, and partial differential equations with their associated constraints, and initial and boundary conditions.

  • 2. Modules, are sets of MML code libraries which are variable declarations, parameter declarations, or mathematical equations for a particular process, for example, flow along a capillary, diffusion within a region, a chemical reaction, transport across a membrane, or even a whole organ. These are archived, forming libraries of operational code. This allows the user to generate multi-scale models with different sub-models to use in testing a hypothesis against data, i.e. validity testing. For example, there have been a variety of models developed to describe the transmembrane sodium pump, NaKATPase which uses ATP to pump sodium out of, and potassium into, the cell. All of these models have the same essential external influences: the Na and K ion concentrations and the transmembrane electrical potential. Having a library of the MML code for the variant modules allows one to insert one's choice quickly into the template for the cell model. Changing combination(s) rapidly to match solutions with experimental results is invaluable for the early phases of developing alternative hypotheses.

  • 3. Directives, the third component, comprises the set of instructions used by the MPC program to select processes and gather the code from existing modules, renaming parameters and variables to reflect the new purposes for which they will function, and automatically combining the mathematical structures into new structures. The directives control the identification, fetching and relabeling of variables and parameters, and the assembly and recombination of code into new equations. All MPC directives start with '//%'.

Selecting and arranging components using directives – A simple example

The MPC input file guides the construction of a model made of previously existing modules. It combines MML with “directives” embedded as comments. It uses code from other JSim model files that have been annotated so that they can be read by MPC, yet without interfering with their operability. MPC may also combine models with other models or with modules of preconstructed code from libraries. These modules are specified within a library with the START and END directive. A library with a few elementary operators from which we will build a model in out next step is illustrated below:

CodeLibrary.mod:

//------------------------- ODE DOMAINS
//%START     odeDomains     // START...END directives used to specify a module.
realDomain t s; t.min=0; t.max=16; t.delta = 0.1;
//%END     odeDomains
//------------------------- flowCalc
//%START      flowCalc
C:t = (F/V)*(Cin-C);
//%END       flowCalc
//------------------------- EXCHANGE CACULATIONS
//%START      exchangeCalc
C1:t = PS/V1*(C2-C1);    // Exchange between two compartments
C2:t = PS/V2*(C1-C2);
//%END           exchangeCalc
//------------------------- REACTION A->B
//%START     reactionCalc
real G = 5 ml/(g*min);   // Const reaction rate.
A:t = -G/V*A;
B:t = G/V*A;
//%END           reactionCalc
//------------------------- MM REACTION A->B
//%START    MMreactionCalc
real KmA =1.0 mM, VmaxA =2 umol/(g*min); // MM constant and max velocity of rxn
real G(t) ml/(g*min);    // MM reaction rate
G = (VmaxA/(KmA+A));
A:t = -G*(A)/V;
B:t =  G*(A)/V;
//%END       MmreactionCalc

In JSim's MML, the colon signifies the derivative: C:t means dC/dt. Within MPC we can write MML code directly or import code from operational JSim models that have been annotated to identify components. An example is a three species (A, B, C), two compartment model with two reactions in compartment two (Figure 1) with species concentrations described by ordinary differential equations (ODE). Species A enters, with flow F, a compartment with volume V1 and passive exchange between a second compartment with volume V2, where A reacts at rate GA2B to form B and B reacts with C at rate GB2C, a Michaelis-Menten reaction.

688619c7-1f04-4993-83ba-2c64db029c36_figure1.gif

Figure 1. Two compartment, three species model (A, B, C) with volumes V1, V2, respectively.

Ain is A entering compartment 1 with flow F (No flow in for species B, C). Passive exchange between compartments for all three species and reactions only occur in compartment 2.

The MPC file defines the domain, parameters, variables, and initial conditions first. Using directives listed in ‘Example.mpc’, model code is extracted from the file ‘CodeLibrary.mod’ shown above. Values and variable names needing replacement throughout the final model are specified by the REPLACE directive along with the '%symbol%' placeholder. The use of the REPLACE, GET, COLLECT, INSERTSTART and INSERTEND directives are used in Example.mpc shown below:

Example.mpc:

//%REPLACE %CL% =("CodeLibrary.mod") // Library to get code from, replace all
                 // occurrences of %CL% with CodeLibrary.mod
//%REPLACE (%N%=(“1”,”2”), %vol%=("0.05","0.05")) // Two compartments with volumes, replace
    	      // all occurrences of %N% with 1,2 and %vol% with 0.05, 0.15
//%REPLACE (%AB%=("A","B","C") %PS3%=("6","5","4")) // 3 species, PS init values.
import nsrunit; unit conversion on; // Use SI units for this model.
math example {         // model declaration
// INDEPENDENT VARIABLES
//%GET %CL% odeDomains()   // Get odeDomains section from CodeLibrary.mod
//%INSERTSTART a2bParmsVars  // Specify params and vars section
// PARAMETERS
real Flow = 1 ml/(g*min);    // Flow rate
real PS%AB%12 = %PS3% ml/(g*min); // Conductances: PSA12,PSB12,PSC12
real V%N% = %vol% ml/g;	 // Volume of V1, V2
extern real %AB%in(t) mM; // Inflowing concentrations
// DEPENDENT VARIABLES
real %AB%%N%(t) mM;       // A1,A2,B1,B2,C1,C2
// INITIAL CONDITIONS (IC's)
when(t=t.min)  %AB%%N%=0;      // Defines IC's for the ODEs
//%INSERTEND a2bParmsVars      // End params and var sec
//%INSERTSTART a2bCalc      // Specify calc section
// ODE CALCULATIONS
//%GET %CL% reactionCalc ("A=A2","B=B2","V=V2","G=Ga2b") // A->B reaction
//%GET %CL% MMreactionCalc ("A=B2","B=C2","V=V2","G=Gb2c", // B ->C MM reaction
//% "KmA=KmB2",“VmaxA = VmaxB2", "KmA = KmB2")        // B ->C MM reaction continued
//%GET %CL% flowCalc ("Cin=%AB%in","C=%AB%1","V=V1","F=Flow","D=D%AB%1")
//%GET %CL% exchangeCalc ("C1=%AB%1","PS=PS%AB%12","C2=%AB%2")
//%COLLECT("%AB%%N%:t")     //Group all ODE calculations for a species together
//%INSERTEND a2bCalc
} // curly bracket ends model

The GET directive warrants further explanation: it identifies a code library file and module name within the library to insert into the model, and changes old names (names of parameters and variables in the module) to new model names. From the example above, //%GET %CL% reactionCalc ("A=A2","B=B2","V=V2","G=Ga2b") will get the module named 'reactionCalc' in file 'CodeLibrary.mod' and replace the variable names with the new model names ("A=A2", etc).

The MPC directives control the identification, fetching, relabeling of variables and parameters, and assembling and recombining code into new equations. The directives extract equations from files, changing the names of the module variables to application specific names and assemble the code into combined equations. The code resulting from these instructions provides a complete program (Example.mod), with no further intervention on the part of the user except to adjust parameters, solution time step length and set up graphics in JSim to display solutions, as shown in Figure 2.

688619c7-1f04-4993-83ba-2c64db029c36_figure2.gif

Figure 2. Solution to two compartment model generated from MPC.

Species concentrations plotted as a function of time. Species A (red), B (green), C (blue). Compartment 1: solid line, Compartment 2: dashed line. External input for species A is Ain, the black solid line.

MPC Output - Example.mod:

import nsrunit; unit conversion on;   // Use cgs units
math example {           // model declaration
// INDEPENDENT VARIABLES
realDomain t s; t.min=0; t.max=16; t.delta = 0.1;
//%START a2bParmsVars        // Specify parameters and variables sect.
// PARAMETERS
real Flow = 1 ml/(g*min);   // Flow rate
real PSA12 = 6 ml/(g*min);  // Conductance
real PSB12 = 5 ml/(g*min);  // Conductance
real PSC12 = 4 ml/(g*min);  // Conductance
real V1 = 0.05 ml/g;        // Volume
real V2 = 0.05 ml/g;        // Volume
extern real Ain(t) mM;      // Inflowing concentration
extern real Bin(t) mM;      // Inflowing concentration, set to zero
extern real Cin(t) mM;      // Inflowing concentration, set to zero
// DEPENDENT VARIABLES
real A1(t) mM; real A2(t) mM; real B1(t) mM;
real B2(t) mM; real C1(t) mM; real C2(t) mM;
// INITIAL CONDITIONS (IC's)
when(t=t.min)  A1=0;
when(t=t.min)  A2=0;
when(t=t.min)  B1=0;
when(t=t.min)  B2=0;
when(t=t.min)  C1=0;
when(t=t.min)  C2=0;
//%END a2bParmsVars    // End parameters and variables section
//%START a2bCalc    // Specify calculations section
real Ga2b = 5 ml/(g*min);   // A ->B Const reaction rate.
real KmB2 =1.0 mM, VmaxB2 =2 umol/(g*min);// MM constant and max velocity of rxn
real Gb2c(t) ml/(g*min);      // B ->C MM reaction rate
Gb2c = (VmaxB2/(KmB2+B2));
// ODE CALCULATIONS
A2:t = -Ga2b/V2*A2 +PSA12/V2*(A1-A2);
B2:t = Ga2b/V2*A2 -Gb2c*(B2)/V2 +PSB12/V2*(B1-B2);
C2:t = Gb2c*(B2)/V2 +PSC12/V2*(C1-C2);
A1:t = (Flow/V1)*(Ain-A1) +PSA12/V1*(A2-A1);
B1:t = (Flow/V1)*(Bin-B1) +PSB12/V1*(B2-B1);
C1:t = (Flow/V1)*(Cin-C1) +PSC12/V1*(C2-C1);
//%END a2bCalc
} // curly bracket ends model

The process above is hardly worthwhile for small models but is highly efficient for larger models where flexibility in structure is desired. In the example above, converting the Ordinary Differential Equations (ODEs) to Partial Differential Equations (PDEs) requires a three line change. Addition of a new PDE e.g. for red blood cells in a capillary, takes four lines. For a five species, three region model, a three line change generates a 15 PDE model.

The small set of directives builds complex models from simple processes. MPC allows one to reliably reuse existing models in larger, multi-scale models. MPC encodes and preserves information about how a complex model is built from its modules allowing quick substitution of modules. The amount of actual code a user needs to write is reduced, especially for more complicated models. In MPC we have generated a full organ model with heterogeneity of flow, competitive transporters on the cell membranes, and reactions for multiple species (Bassingthwaighte et al., 2012) e.g. for adenosine processing in the heart. It is a 7-path, three region model that involves five species (adenosine, inosine, hypoxanthine, xanthine, and uric acid) in a sequential reaction chain. The model contains over 100 PDEs for convection, diffusion, and reactions.

Discussion

MPC and Uncertainty Quantification (UQ)

Though a MPC-generated model is checked for syntax and unit balance through JSim, verification is required: analytical solutions can be written into the code to match specific limiting cases, but otherwise one depends on testing for mass, charge, or energy balances. Validation requires testing against data, independent of the construction method. These are key steps toward reproducibility and the VVUQ process. (VVUQ = verify, validate, uncertainty quantification; the latter defining predictive accuracy.) MPC as is, depends on semantic consistency throughout the libraries and models used. Automated systems using ontologies will help craft models (Gennari et al., 2011), but the great efficiency of MPC for construction begins to show when there are many modules in series/parallel arrangements as in biochemical networks or circulatory or airway mechanical modeling. UQ includes uncertainty in inputs and parameters, readily handled by JSim's Monte Carlo analysis, and in model structure. Structural uncertainty, a major challenge, defines a major role for MPC: inserting different choices from amongst similar but differently functioning modules, into a large, multi-modular model, and solving the system many times with the variant constituents illustrating uncertainty in the projected outcomes.

Summary

A limited set of directives in MPC, our Modular Program Constructor, allows us to build complex models using small models for simple processes. MPC encodes and preserves information about how a complex model is built from its modules allowing the researcher to quickly substitute or update modules to validate a hypothesis. The amount of actual code a user needs to write is reduced, especially for more complicated models.

Future updates will improve collection and insertion of model code, better identify external module 'connections' for easier incorporation into larger models, and more intelligent reconciliation of similar code between modules. The long-term strategy is to integrate MPC within JSim allowing the user to take advantage of JSim's MML compiler and graphical user interface to quickly merge code with less user intervention.

Software availability

Software access

The Java code for MPC, the examples presented here, some more detailed examples, and instructions are available at http://www.physiome.org/software/MPC/.

Source code as at the time of publication

https://github.com/F1000Research/MPC/releases/tag/v1.0

Archived source code as at the time of publication

http://dx.doi.org/10.5281/zenodo.34208

Software license

MPC is released under a 3-clause ‘revised’ BSD license:

Copyright (C) 1999–2015 University of Washington

Developed by the National Simulation Resource

Department of Bioengineering, Box 355061

University of Washington, Seattle, WA 98195-5061.

Dr. J. B. Bassingthwaighte, Director

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • * Neither the name of the University of Washington nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

Data availability

MPC generated models for review at www.physiome.org are:

Comments on this article Comments (0)

Version 3
VERSION 3 PUBLISHED 16 Dec 2015
Comment
Author details Author details
Competing interests
Grant information
Copyright
Download
 
Export To
metrics
Views Downloads
F1000Research - -
PubMed Central
Data from PMC are received and updated monthly.
- -
Citations
CITE
how to cite this article
Jardine B, Raymond GM and Bassingthwaighte JB. Semi-automated Modular Program Constructor for physiological modeling: Building cell and organ models [version 1; peer review: 1 approved with reservations]. F1000Research 2015, 4:1461 (https://doi.org/10.12688/f1000research.7476.1)
NOTE: If applicable, it is important to ensure the information in square brackets after the title is included in all citations of this article.
track
receive updates on this article
Track an article to receive email alerts on any updates to this article.

Open Peer Review

Current Reviewer Status: ?
Key to Reviewer Statuses VIEW
ApprovedThe paper is scientifically sound in its current form and only minor, if any, improvements are suggested
Approved with reservations A number of small changes, sometimes more significant revisions are required to address specific details and improve the papers academic merit.
Not approvedFundamental flaws in the paper seriously undermine the findings and conclusions
Version 1
VERSION 1
PUBLISHED 16 Dec 2015
Views
11
Cite
Reviewer Report 05 Jan 2016
Dagmar Waltemath, Department of Systems Biology and Bioinformatics, University of Rostock, Rostock, Germany 
Approved with Reservations
VIEWS 11
The manuscript at hand describes MPC, a tool that supports modelers in constructing  complex models from smaller ones. MPC also keeps information about the single modules, making their exchange and further coupling even easier.

The manuscript provides several examples (on code ... Continue reading
CITE
CITE
HOW TO CITE THIS REPORT
Waltemath D. Reviewer Report For: Semi-automated Modular Program Constructor for physiological modeling: Building cell and organ models [version 1; peer review: 1 approved with reservations]. F1000Research 2015, 4:1461 (https://doi.org/10.5256/f1000research.8055.r11594)
NOTE: it is important to ensure the information in square brackets after the title is included in all citations of this article.
  • Author Response 07 Apr 2016
    Bartholomew Jardine, Department of Bioengineering, University of Washington, Seattle, 98195, USA
    07 Apr 2016
    Author Response
    Our responses to Referee Dagmar Waltemath's review:
    1. My suggestions for improvements are mainly on the terminology used throughout the manuscript, and on the discussion of related work. Unifying terms: In the
    ... Continue reading
COMMENTS ON THIS REPORT
  • Author Response 07 Apr 2016
    Bartholomew Jardine, Department of Bioengineering, University of Washington, Seattle, 98195, USA
    07 Apr 2016
    Author Response
    Our responses to Referee Dagmar Waltemath's review:
    1. My suggestions for improvements are mainly on the terminology used throughout the manuscript, and on the discussion of related work. Unifying terms: In the
    ... Continue reading

Comments on this article Comments (0)

Version 3
VERSION 3 PUBLISHED 16 Dec 2015
Comment
Alongside their report, reviewers assign a status to the article:
Approved - the paper is scientifically sound in its current form and only minor, if any, improvements are suggested
Approved with reservations - A number of small changes, sometimes more significant revisions are required to address specific details and improve the papers academic merit.
Not approved - fundamental flaws in the paper seriously undermine the findings and conclusions
Sign In
If you've forgotten your password, please enter your email address below and we'll send you instructions on how to reset your password.

The email address should be the one you originally registered with F1000.

Email address not valid, please try again

You registered with F1000 via Google, so we cannot reset your password.

To sign in, please click here.

If you still need help with your Google account password, please click here.

You registered with F1000 via Facebook, so we cannot reset your password.

To sign in, please click here.

If you still need help with your Facebook account password, please click here.

Code not correct, please try again
Email us for further assistance.
Server error, please try again.