Real-Time Computer Simulations of Excitable Media: JAVA As a Scientific Language and As a Wrapper for C and FORTRAN Programs
Total Page:16
File Type:pdf, Size:1020Kb
BioSystems 64 (2002) 73–96 www.elsevier.com/locate/biosystems Real-time computer simulations of excitable media: JAVA as a scientific language and as a wrapper for C and FORTRAN programs Flavio H. Fenton a,b,*, Elizabeth M. Cherry a, Harold M. Hastings a, Steven J. Evans b a Department of Physics, Hofstra Uni6ersity, Hempstead, NY 11549, USA b The Heart Institute, Beth Israel Medical Center, New York, NY 10003, USA Received 4 August 2001; accepted 1 September 2001 Abstract We describe a useful setting for interactive, real-time study of mathematical models of cardiac electrical activity, using implicit and explicit integration schemes implemented in JAVA. These programs are intended as a teaching aid for the study and understanding of general excitable media. Particularly for cardiac cell models and the ionic currents underlying their basic electrical dynamics. Within the programs, excitable media properties such as thresholds and refractoriness and their dependence on parameter values can be analyzed. In addition, the cardiac model applets allow the study of reentrant tachyarrhythmias using premature stimuli and conduction blocks to induce or to terminate reentrant waves of electrical activation in one and two dimensions. The role of some physiological parameters in the transition from tachycardia to fibrillation also can be analyzed by varying the maximum conductances of ion channels associated with a given model in real time during the simulations. These applets are available for download at http://arrhythmia.hofstra.edu or its mirror site http://stardec.ascc.neu.edu/fenton. © 2002 Elsevier Science B.V. All rights reserved. Keywords: Computer simulations; JAVA; Programs 1. Introduction in nature. In particular, models of cardiac electri- cal activity in cells can be used to illustrate some Mathematical models of biological and com- of the mechanisms underlying cardiac arrhyth- plex systems demonstrate many phenomena found mias. The continuous increase in computer power over the years has made it possible to solve many of these models using desktop computers. How- ever, systematic study of these models is greatly * Corresponding author. Tel.: +1-516-463-5586; fax: +1- 516-463-3059. enhanced by using a graphical user interface E-mail addresses: [email protected] (F.H. Fen- (GUI) for variation of parameters, visualization, ton), [email protected] (H.M. Hastings). and the analysis of results. 0303-2647/02/$ - see front matter © 2002 Elsevier Science B.V. All rights reserved. PII: S0303-2647(01)00177-0 74 F.H. Fenton et al. / BioSystems 64 (2002) 73–96 The JAVA language is a natural choice for inter- free for non-commercial purposes. EASIWAV from face programming for several reasons. First, it is Henriquez’s group simulates cardiac wave propa- straightforward to register on-screen user interac- gation over a 2D domain and features nonuni- tions, such as mouse events, alphanumeric inputs, form anisotropy, irregular geometries, multiple and click-choice events (e.g. buttons and check- membrane models and simulation modules, all boxes). In addition, it is easy to change parame- with an intuitive GUI interface that runs under ters in real time and to plot in one, two and three UNIX. Li provides a program for modeling the dimensions, allowing easy visualization of results. action potential (AP) of a canine ventricular cell. Furthermore, since executables are platform-inde- Li’s software runs on the net under X-WINDOWS. pendent, programs can be run in different ma- Joe provides a web-based simulation (using JAVA chines and operating systems as well as through and JAVASCRIPT) of the heart’s specialized con- the internet. However, using JAVA as a program- duction system. CELLML is an XML-based lan- ming language can have some drawbacks. In some guage intended to store and exchange cases, unless substantial optimization is per- computer-based biological models. NRCAM of- formed on a specific algorithm, computational fers a similar approach in their ‘virtual cell’,a speed can increase unacceptably. In other cases, a general computational framework for modeling well-optimized program may already exist in biological processes, at the cellular level. other language, or the program may use standard In contrast, the present programs, and related subroutines that cannot easily be imported into material on our web site supplementary to this JAVA. In addition, the program may need to paper, are designed especially for educational use perform external system commands, which JAVA and exploratory research. The advantage of these does not allow for security reasons. However, programs is that they cover a wide range of these problems can be overcome by using the models and geometries with an easy-to-use inter- JAVA Native Interface (JNI) options, which allows face for simulating complex cardiac electrical dy- JAVA to interact with applications and libraries namics. They are also readily available on the written in other (native) languages. Internet and run under any operating system. In We present in this paper a set of JAVA applets this manuscript we provide a description of both intended for the study of excitable media—in the use of JAVA together with traditional scientific particular, models that describe cardiac electrical languages and the models themselves. activity in single cells, 1- and 2-D tissues. In This paper is dedicated to the memory of Section 2, we briefly describe methods and al- Michael Conrad. Professor Conrad worked at the gorithms used in writing the JAVA applets. Section interface between biology and computation, and 3 gives an overview of excitable media and pro- was in many ways well ahead of the recent thrust vides the basic equations the applets are designed in computational biology. His work on computa- to solve. In Section 4, we discuss several represen- tional models of the brain led to many more tative applets for single cells, 1-D cables, and 2-D recent developments. The journal BioSystems also tissues. In Section 5, we present conclusions and reflects his philosophy and guidance as Editor, discuss future work. In addition, we provide an with its emphasis on theory well grounded in appendix (Appendix A) with a general example experiment. Finally, Professor Conrad considered showing how to call C and FORTRAN subroutines teaching an essential part of his career and left a from JAVA, which is useful when JAVA is used legacy of Ph.D. students. One of us (H.M. Hast- only as a GUI wrapper. ings) had the pleasure of knowing Professor Con- Other groups have developed computational rad as a colleague and writing two papers with systems for cardiac modeling and made them him (Hastings and Conrad, 1979; Conrad and available publicly (Barry, 1998; Henriquez et al., Hastings, 1985). Our present paper on computa- 2000; Li, 2000; Joe, 1997; CellML, 2000; NR- tional models of cardiac dynamics and other ex- CAM, 2001). Barry’s software requires a fee; citable media, and its goal of promoting the other software and our software are available for computer as an experimental and educational F.H. Fenton et al. / BioSystems 64 (2002) 73–96 75 tool, follows his tradition. More generally, the lar boundary conditions combined with an ex- continued growth of computational approaches to plicit Euler scheme. biology recognizes Professor Conrad’s vision and All the programs presented in this article were leadership. written in JAVA (version 1.1.7B-2) on a Compaq Alpha workstation. The programs have been com- piled and run successfully on PCs under WIN- 2. Systems, methods, and algorithms DOWS using Sun-JAVA 1.3.0 and on PCs under LINUX using IBM-JAVA 1.1.8 and/or kaffe 1.0.6. The implementation of the programs consists of two major parts, the graphical interface that in- 3. Models puts and outputs data; and the integration of the differential equations of a given mathematical cell The mathematical models we implement in our model. In the graphical interface, the input of JAVA applets all represent excitable media, a class events is handled using the standard methods of nonlinear complex systems of which cardiac from the java.awt.*, java.awt.event.* and electrical dynamics is an example. Excitable media Java.lang.* classes (SUN, 1997). Basic plotting of can be defined as systems composed of elementary graphs and images is relatively simple and many segments or cells, each of which possesses the useful examples can be found at (SUN, 1997). following properties: However, when a large number of pixels need to 1. a well-defined rest state, be frequently drawn, there are some advanced 2. a threshold for excitation, and procedures that are worth mentioning. The sim- 3. a diffusive-type coupling to its nearest plest way to draw graphs and small images is to neighbors. use the fillLine(x1,y1,x2,y2) method, which can By a threshold for excitation, we mean that any create pixels when given identical starting and external stimulus applied to a cell that keeps that ending coordinates (x1=x2andy1=y2) and in cell below this threshold produces a qualitatively general is faster than fillRect(). When generating different result than a stimulus that raises the cell large images that require a significant set of pixels, above threshold. Stimuli below the threshold are this method becomes extremely slow, and the damped out and produce no persistent change in java.awt.image.MemoryImageSource class is a the system, which simply returns to the rest state. better choice. This class is an implementation of However, stimuli above the threshold induce the the ImageProducer interface, which uses an array cell to change from its rest state to an excited to produce pixel values and can generate images state. This change produces a pulse in time whose at high speeds, so little time is spent in the plot- shape and nature are determined by the nonlinear ting procedures.