Abstract Chaste — Cancer, Heart And Soft Tissue Environment — is an open source C++ library for the computational simulation of mathematical models developed for physiology and biology. Code development has been driven by two initial applications: cardiac electrophysiology and cancer development. A large number of cardiac electrophysiology studies have been enabled and performed, including high-performance computational investigations of defibrillation on realistic human cardiac geometries. New models for the initiation and growth of tumours have been developed. In particular, cell-based simulations have provided novel insight into the role of stem cells in the colorectal crypt. Chaste is constantly evolving and is now being applied to a far wider range of problems. The code provides modules for handling common scientific computing components, such as meshes and solvers for ordinary and partial differential equations (ODEs/PDEs). Re-use of these components avoids the need for researchers to ‘re-invent the wheel’ with each new project, accelerating the rate of progress in new applications. Chaste is developed using industrially-derived techniques, in particular test-driven development, to ensure code quality, re-use and reliability. In this article we provide examples that illustrate the types of problems Chaste can be used to solve, which can be run on a desktop computer. We highlight some scientific studies that have used or are using Chaste, and the insights they have provided. The source code, both for specific releases and the development version, is available to download under an open source Berkeley Software Distribution (BSD) licence at http://www.cs.ox.ac.uk/chaste, together with details of a mailing list and links to documentation and tutorials.

Citation: Mirams GR, Arthurs CJ, Bernabeu MO, Bordas R, Cooper J, Corrias A, et al. (2013) Chaste: An Open Source C++ Library for Computational Physiology and Biology. PLoS Comput Biol 9(3): e1002970. https://doi.org/10.1371/journal.pcbi.1002970 Editor: Andreas Prlic, UCSD, United States of America Received: August 22, 2012; Accepted: January 20, 2013; Published: March 14, 2013 Copyright: © 2013 Mirams et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. Funding: This work was funded by: GlaxoSmithKline Grants and Affiliates Award to GRM and DJG; EPSRC e-Science pilot project in Integrative Biology (GR/S72023/01); EPSRC, Software for High Performance Computing project (EP/F011628/1); European Commission, Prediction of Drug Impact in Cardiac Toxicity (preDiCT), Framework 7 grant (DG-INFSO 224381); European Commission, Virtual Physiological Network of Excellence (VPH-NoE), Framework 7 grant (DG-INFSO 223920); 2020 Science: EPSRC and Microsoft Research, Cambridge through grant EP/I017909/1 (www.2020science.net); BBSRC grant to Oxford Centre for Integrative Systems Biology (BB/D020190/1); The Life Sciences Interface and Systems Biology Doctoral Training Centres, and the Systems Approaches to Biomedical Science Industrial Doctorate Centre (EP/E501605/1, EP/G50029/1 and EP/G037280/1). This publication was also based on work supported in part by Award No. KUK-C1-013-04, made by King Abdullah University of Science and Technology (KAUST). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. Competing interests: I have read the journal's policy and have the following conflicts: GRM and DJG have received research support from GlaxoSmithKline Plc.

This is a PLOS Computational Biology Software Article

Introduction Cancer, Heart And Soft Tissue Environment (Chaste) has been developed to enable the study of novel problems in computational physiology and biology. The following quotation from a recent article by Wilson highlights two problems that Chaste has been designed to overcome: “Increasingly, the real limit on what computational scientists can accomplish is how quickly and reliably they can translate their ideas into working code.” [1] First, the speed at which progress can be made by researchers in our field is typically limited because previously developed models and methods are often not re-used effectively. At the most practical level, model equations and algorithms should be encoded as software (or, more usefully, as mark-up languages for generating software [2]), describing unambiguously the computations required for simulations. In computational physiology and biology, many problems share a need for the same underlying components and numerical schemes. It is still common for each new PhD student or post-doctoral researcher to ‘re-invent the wheel’ and develop, for example, their own mesh structures, ordinary/partial differential equation (ODE/PDE) solvers and input/output (IO) interfaces. This not only slows progress, but a lack of formal software training in structuring and documenting code can lead to code that is difficult to follow and untangle (known as ‘spaghetti code’) [3]. Such code rapidly becomes unusable by anyone else, and is typically discarded at the end of a project, requiring the next person to work on the research topic to start the process again. Second, the reliability of code, and subsequent results, is often uncertain and unprovable. As discussed by Baxter et al. in a perspective on software development in this journal [4], there is generally no rigorous software testing approach taken, and testing comes down to whether results ‘look about right’ [3]. This may soon become safety-critical, as clinical interventions become guided by the results of computational biology simulations. The problems discussed above lead to it being very difficult, if not impossible, to guarantee the reproducibility of computational results. Minimum information standards have been suggested for models (MIRIAM [5]) and simulations (MIASE [6]), defining vital requirements underpinning reuse and reproducibility. Mark-up languages such as SBML [7], CellML [8], FieldML [9] and SED-ML [10] help to satisfy these requirements in a machine-readable format. Given the complexity of modern mathematical models and numerical algorithms, we believe the use of such standards in open source software is a pre-requisite for rapid progress, reliability and reproducibility. To date, our primary applications have been in computational physiology and biophysics. In these fields, a wide array of models are represented as continuum ODE/PDE problems, individual or agent-based discrete models, or a hybrid of these two. Examples of problems falling into these categories include cardiac electrophysiology and electromechanics, tumour growth, and developmental biology. In 2005, we began to build Chaste as a software environment that could be used for simulation of these types of problem, which would overcome many of the pitfalls discussed above. Most commercial software is closed source and difficult to extend to study novel models, as these may include a different class of equation or completely different modelling paradigm. In the limited cases where free open source software was available for our applications, we frequently found it difficult to test and extend. We wanted to create a software library that could rapidly evolve, to keep pace with our scientific investigations. To achieve this, Chaste comprises a library of fully-tested modules for the common elements of our application areas , which can be easily utilised and readily extended to the simulation of novel models, and to the use of novel numerical algorithms. We believe Chaste is a good example of software that follows the ten simple rules for open development of scientific software [11]. Other notable open source codes have been developed, including OpenCMISS and Continuity for continuum modelling [12], [13], CompuCell3D for cellular Potts modelling [14] and MultiCellXML for agent-based modelling and simulation data [15]. However, Chaste is the only open source software available for many of its application areas, and is exceptional in that industrial software engineering standards have been used for its development. Chaste is also unique in being well suited for both continuum and discrete modelling approaches, and is well-positioned for the investigation of hybrid approaches [16]. Release 1.0 of Chaste occurred in 2009 and has been described previously [17], [18]. Through the use of examples, we will describe the capabilities of the newly-released version 3.1, novel scientific applications, and future directions. It is our intention that all of the examples in this article can be reproduced on a desktop PC; they are therefore less computationally intensive than many of the simulations performed in scientific research. The example simulations can be run, and figures recreated, by downloading the associated Chaste project from http://www.cs.ox.ac.uk/chaste/download, as described in Text S1.

Design and Implementation In this section, we discuss the Chaste development strategy, as this is fundamental to its properties, capabilities and extensibility for novel problems. We then introduce the code layout and the available model types and algorithms. Chaste is written in C++, a compiled language that allows object-oriented class definitions. This makes the code suitable for applications where efficient memory management and performance are key, but also allows simple extension and inheritance of existing functionality. At present Chaste can only be used with Linux, although it works well via a Linux virtual machine (using software such as VirtualBox) on a host running Microsoft Windows or Mac OS X. The code needs to be compiled after downloading and setting up dependencies. For users (rather than developers modifying Chaste itself) this is a one-off event. Due to the volume of source and test code, compilation can take considerable time, particularly for an optimised build, on the order of hours using a single processor, or around 30 minutes on an 8-core server. Development Strategy As far as we are aware, Chaste is the only code of its kind that has been developed using agile and test-driven development. We believe that our experience of this development style has valuable insights for other research groups, highlighted in this section. We have found the following practices invaluable in terms of rapid development, delivering high performance, and ensuring reliable results. An independent analysis of Chaste development activity and code composition can be found at Ohloh (http://www.ohloh.net/p/Chaste) . Test-driven development. Test-driven development is fundamental to our efforts. In this style of development, ‘test code’ is written before the ‘source code’ which will actually perform the function we require. Once a test is in place, the source code is then written to make the test pass. This has the advantage of forcing developers to consider the best interface for their new code, and to consider how to test that the source code performs its function correctly. There are then two discrete collections of code in each module of Chaste. The ‘test’ code makes use of the ‘source’, as if the source code were any other C++ library, and checks that it performs as intended. The ‘source’ never makes use of ‘test’, and only ‘source’ is compiled into a library for use in other modules (and third party programs). The test code is uploaded (‘committed’) to the central version control repository along with the source code that it tests. Upon each commit, all the tests are run in order to check that no functionality has been inadvertently broken (‘continuous integration’). This ensures the code always performs as intended, and developers ‘protect’ their code from any future changes to either the code itself, or any code it relies on. This approach does not guarantee bug-free code, but in practice makes bugs very rare. When bugs do occur, this is typically because functionality is expected that has not been fully tested, and the first step in the solution is to write more tests. Additional tests are run each night, which: check all of the standard tests for memory leaks; profile the speed of different parts of the code ; check for documentation on all source code; and check that every line of the source code is executed by at least one of the tests (‘coverage’). Among all the coding practices we use, test-driven development is never abandoned, and is the feature most highly regarded by the development team, who commonly apply it to their other projects. Agile programming. Chaste is developed using an ‘agile’ development methodology, using many features of eXtreme Programming (XP) [19]. One aspect of this approach is to avoid planning too far ahead at any stage. This limits the scope of coding work at any time to a goal that is achievable in a reasonable time frame (typically one month). This approach allows the fast development of working prototypes, and removes ‘paralysis through planning’, which can occur when trying to accommodate a myriad of possible future requirements. However, significant time is spent re-working existing code: class structures and interfaces are reorganised for efficiency, readability and ease of re-use. Overall, this approach generates effective code over time and flexibility is added as required. We have also adopted some other characteristics of XP, notably ‘pair programming’. Ideally, all contributed code is written by a pair of developers, sitting side by side, with one writing code, and the other checking and suggesting improvements. In an academic setting, we have found that this need not be insisted upon, but we use it in regular coding sessions. A particular benefit in an academic setting, where people may move on to new projects frequently, is that no single person takes sole responsibility for any part of the code. Simple rules are adhered to for the naming of variables, methods and classes, which enables developers , and new users, to navigate their way through the code efficiently, and makes mistakes less likely. For further details please refer to our developers' wiki: https://chaste.cs.ox.ac.uk/trac/wiki/GettingStarted. Code Layout and Design Chaste provides libraries for code which is common to many computational biology problems. Here we briefly describe the components of the code and their capabilities. We will present and discuss example simulations, and the new scientific insight Chaste has enabled, in the Results section. global — contains code for basic mathematics (including a random number generator), time stepping, checkpointing (saving and loading simulations) using the Boost serialization library [20], parallel vector classes, and code to handle warnings and errors.

io (input/output) — code for reading, writing and conversion of various file formats, including modules to handle the HDF5 scientific file format [21], which enables distributed data to be collated and stored in a single file.

mesh — code for linear or quadratic tetrahedral meshes and vertex meshes; nodes, elements, boundary properties; mesh generation; mesh distribution using METIS/parMETIS [22]; readers and writers for Triangle/TetGen [23], [24], Meshalyzer, Cmgui (http://www.cmiss.org/cmgui) and VTK (Paraview) [25] formats.

linalg (linear algebra) — code which uses Boost uBLAS [20] and PETSc [26] for vector and matrix operations.

ode — code for defining ODEs; solvers, basic finite difference schemes, the Sundials CVODE solver [27]; termination on root-finding capabilities.

pde — code for defining elliptic and parabolic second-order PDEs; parallel finite element solvers of generic coupled systems of PDEs (using mesh and linalg).

continuum mechanics — code for solving compressible and incompressible general non-linear elasticity problems. These core components are used by two main application components that have driven Chaste development to date — cell based and heart, discussed in the Results section. Projects. ‘Bolt-on’ projects for individual studies using Chaste are supported via an interface to the build infrastructure. This also provides a link to our framework for test-driven development of code. Continuous testing can be utilised to ensure that your code maintains the capability to reproduce old results as it evolves. If common code occurs in more than one project, we encourage developers to migrate this code to the central Chaste repository, thus making it publicly available. Access to a project subversion repository hosted at Oxford, and integration into the Chaste wiki, is available for academic researchers upon request. This enables all users to release a project with each publication, allowing all of the results and figures in an article to be reproduced with a given version of Chaste. The following references are to papers associated with bolt-on projects that are freely available to download, reproduce, adapt and extend [17], [28]–[31]. Key scientific findings arising from these papers are discussed in the Results section below. See Text S1 for instructions on downloading the project associated with this article.

Availability and Future Directions Chaste is freely available to download from the website at http://www.cs.ox.ac.uk/chaste. Releases 1.0–3.0 were under the LGPL v2.0 licence, while v3.1 and future releases are under the more flexible 3-clause BSD licence, to facilitate use of the code by industrial partners. Currently, we are adding support for the following types of simulation: parallel cardiac electro-mechanics; His-Purkinje system in cardiac electrophysiology; lung mechanics; import of SBML models for signalling pathway and cell-cycle models; fluid flow for haemodynamics and airflow. We are investigating ways to make it easier for users to contribute code, and aim to support a Microsoft Windows environment in the next year. How to Become an Active Developer From the main Chaste website you can sign up to the users' mailing list to receive announcements of new versions, and support from users and developers. You can also register to create a login for the Chaste wiki to view and comment on work tickets, and submit patches for inclusion in Chaste. In addition to the examples associated with this article, we have a large number of tutorials that are easy to adapt to perform many types of simulation. There is a guide for people who would like to work with the latest development version of Chaste at: https://chaste.cs.ox.ac.uk/trac/wiki/ChasteGuides/ExternalDeveloperGuide.

Supporting Information Software S1. A Zip file containing the Chaste project that forms the supplementary material, it can be used to recreate the figures in this article. This project is compatible with Chaste 3.1 only. https://doi.org/10.1371/journal.pcbi.1002970.s001 (ZIP) Text S1. Further details on installation of Chaste and dependencies. https://doi.org/10.1371/journal.pcbi.1002970.s002 (PDF) Video S1. 3D off-lattice simulation coupled to PDE: 3D simulation of a tumour spheroid. A cross-section of a tumour spheroid is presented. Cell centres, nodes of a mesh, are represented by spherical shells and coloured according to the local oxygen concentration. Proliferation is dependent on oxygen, which diffuses and is taken up by cells in the spheroid, such that only cells near the outer rim divide. Cell death occurs under low oxygen conditions near the centre of the spheroid. Shown from to hours. https://doi.org/10.1371/journal.pcbi.1002970.s003 (MP4) Video S2. 3D off-lattice simulation confined to a 2D surface: small intestinal crypts and villus. Left: cells are labelled according to their ancestor cell; each crypt gives rise to a monoclonal population, with a multiclonal villus comprised of cells from each crypt. Right: the same simulation, here with cells labelled according to Delta levels (non-dimensionalised); Delta-Notch patterning occurs due to a signalling model inside each cell, which depends on the activity of neighbouring cells, and is thought to lead to differentiation into secretory and absorbative cell types. The simulation runs from to hours. https://doi.org/10.1371/journal.pcbi.1002970.s004 (MP4) Video S3. Cardiac electrophysiology: a re-entrant spiral wave. This figure displays the membrane voltage in a 2-D monodomain simulation using the Luo-Rudy 1991 action-potential model [50] with the modifications and protocol suggested in [49]. The simulation runs from to milliseconds. https://doi.org/10.1371/journal.pcbi.1002970.s005 (MP4) Video S4. Cardiac electromechanics in a ventricular wedge: simulation of electrical propagation and deformation. A stimulus is applied to the face at and the simulation runs until milliseconds. https://doi.org/10.1371/journal.pcbi.1002970.s006 (MP4)

Acknowledgments The authors would like to thank David Kay and Jonathan Whiteley who have contributed to many of the numerical algorithms used in Chaste. We would also like to thank the rest of the members of the Computational Biology Group, University of Oxford for their support and encouragement, together with all those who have contributed to Chaste over the last seven years.

Author Contributions Designed and wrote the software: GRM CJA MOB RB JC AC YD SJD AGF DGH MEM JMO PP JPF JS NZ DJG. Conceived and designed the experiments: GRM YD AGF JMO DGH PP JPF. Performed the experiments: GRM AGF DGH JMO PP. Analyzed the data: GRM RB AGF JMO PP. Wrote the paper: GRM MOB RB JC YD SJD AGF PP JPF DJG.