3-D Simulation of Multi Cells and Growth Model - A Case Study In CompuCell3D

A thesis submitted to the

Graduate School

of the University of Cincinnati

in partial fulfillment of the

requirements for the degree of

Master of Science

in the School of Information Technology

of the College of Education, Criminal Justice, and Human Services

by

Bhanu Sai Kishore Puvvala

Bachelor of Engineering – Computer Science & Engineering

Osmania University, India.

November 2018

Committee Chair: Bilal Gonen, Ph.D. Abstract

Computer simulation and modeling have become vital in the field of biology to study the growth and behavior of / multi cells. Simulations of multi cell growth are mathematically complex and lack software that allows creating and running biological experiments without the knowledge of programming. Developers often build scientific applications in programming languages like C,

Fortran to gain performance but reducing flexibility. To address this problem, we present a flexible, scalable problem solving environment for cell simulations called CompuCell3D that is based on object oriented programming. This paper studies the simulation framework

CompuCell3D 3.7.6 and Python code base within CompuCell3D that allows users to build, test and run simulations. We also discuss the limitations of CompuCell3D and develop a python based application to address some of the limitations and evaluate their impact on application performance and usability.

Keywords: CompuCell3D, Python, C++, cell growth, multi-cell modeling, tissue-level, modeling

2

3 Table of Contents

Abstract...... 2

CHAPTER1: INTRODUCTION...... 7

1.1 Object Oriented Programming...... 8

1.2 Research Objective...... 9

1.3 Contributions of Research...... 10

1.4 Organization of Research...... 10

CHAPTER2: DESIGN OF COMPUCELL3D...... 12

2.1 CompuCell3D Architecture...... 12

2.2 Limitations of CompuCell3D...... 17

2.3 Python Scripting in CompuCell3D...... 18

2.4 Adding New Cells...... 26

CHAPTER3: COMPUCELL3D ENHANCEMENTS...... 29

3.1 Building New Simulation in CompuCell3D...... 29

3.2 Updating CC3DML Parameters Dynamically...... 29

3.3 Steppables...... 33

3.4 Plots for Tracking...... 40

3.5 Saving Data Files...... 42

3.6 Literature Review...... 42

3.7 Conclusion...... 47

4 References...... 48

List of Figures

Figure 1. CompuCell3D’s architecture...... 13

Figure 2. CompuCellPlayer Interface...... 17

Figure 3. CompuCell3D Simulation Wizard from Twedit++...... 19

Figure 4. Structure of CC3D Simulation Code...... 20

Figure 5. Template of Main Python Script...... 21

Figure 6. Specification of basic cell-sorting properties in Simulation Wizard...... 23

Figure 7. Printing cell ids using Python script...... 24

Figure 8. Specification of cell-sorting cell types in Simulation Wizard...... 24

Figure 9. Selection of cell-sorting cell behaviors in Simulation Wizard...... 25

Figure 10. Xml Code of Cell Sort Simulation...... 27

Figure 11. Inserting code snippet in Twedit++ to create cells...... 28

Figure 12. Sample Simulation in CompuCell3D Player...... 29

Figure 13. ScriptAdder Application Interface...... 30

Figure 14. Dynamic Steering Panel in CompuCell3D Player...... 31

Figure 15. Logs Showing the Initial Set Parameters...... 32

Figure 16. New Temperature and Interval in Steering Panel...... 32

Figure 17. Logs Showing the Updated Temperature and Interval...... 33

Figure 18. Existing PottsSteering Class with Temperature...... 34

Figure 19. Xml code for Setting Initial Parameters...... 34

Figure 20. Xml code for Setting Contact Properties...... 35

Figure 21. New Temperature Steppable...... 36

5

Figure 22. Simulations of Cells with New Temperature...... 37

Figure 23. New Steppable for Adding Steps to Steering Panel...... 38

Figure 24. New Steppable for Adding Volume to Steering Panel...... 39

Figure 25. Flip2DimRatio and NeighborOrder Steppables for Steering Panel...... 40

Figure 26. Plot window in CC3D Player...... 41

Figure 27. Code to Add File Path for Saving Data Files...... 42

Figure 28. Flowchart of GGH algorithm in CompuCell3D...... 43

6 CHAPTER 1

INTRODUCTION

A key challenge in modern biology is to understand how molecular-scale machinery leads to complex functional structures at the scale of tissues, organs, and organisms [2]. Experiments provide verification of biological hypotheses and models and simulations are useful in suggesting experiments to validate them. Conducting experiments is often time consuming and require material and equipment that is not very cost effective unlike building models. Biological models are fast to develop and are easy to modify at low cost. However, the complexity lies in implementing cells and tissues and their interactions into a mathematical model. Cell interactions can be modeled by using cell-density fields and partial differential equations (PDEs) without explicit representations of cells called as Continuum model. Another approach is Agent-based modeling which represent individual cells and interactions explicitly allow control of the level of detail with which individual cells are represented [19].

The Glazier-Graner-Hogeweg (GGH) model is a mathematical based tool that aids in mapping cell behaviors and interactions onto a small set of model parameters, that is helpful for biologists and in labs. GGH technique like all other models has an application domain for modeling tissues with motile cells at single-cell resolution. The GGH has been continuously applied to model biological and biomedical processes, including Tumor growth [2] and for many other medical purposes.

7 1.1 Object Oriented Programming

Object Oriented Programming (OOP) is a computer programming model that improve the following factors of a software [20].

• Compatibility: the method promotes a common design style and standard

• Reusability: Involves building index to store and retrieve reusable components. However,

the difficulty of reuse is the need to combine reuse with adaptation. OOP makes it possible

to retain some aspects of a reused module and adapt others.

• Encapsulation: Users cannot modify the internal state of the object directly. Functions of

an object can only access and modify its state. Interactions of how objects interface with

other objects are defined within an object. Packages provide a better encapsulation

technique than routines, as they gather a data structure and the associated operations.

• Inheritance- Facilitates polymorphism of objects to be defined that are specialized types of

existing objects that can share behavior without having to re-implement them. Inheritance

can be implemented as Single inheritance or Multiple inheritance. When objects inherit

properties from another object it is called as single inheritance. Multiple inheritance when

it is possible for an object to inherit properties from as many objects as necessary.

Class based model is the most popular and developed model of OOP when compared to the object based model [21]. A class comprises of a collection of encapsulated variables and methods that describes the rules of the object behaviors. Object-oriented design [22] is the construction of software systems as structured collection of classes. Classes are designed to be independent of the systems to which they belong and may be reused by many different systems.

8 Object-oriented software design is challenging, defining objects into classes with the granularity, interfaces and inheritance hierarchies, and establish key relationships among them.

There can be recurring patterns of classes and objects in many OOP but these patterns solve specific design problems and make object oriented designs more flexible and reusable.

Most common problems in software design can be addressed using design patterns as mentioned in [14]. Design patters focus on interaction patterns instead of focusing on functioning of individual components. Design patterns consists of four elements:

. Pattern name: consists of a design problem, its solution and consequences

. Problem: explains the problem and its context and when to apply the pattern.

. Solution: describes elements that make up the design and relationships. Solution

component provides a description of a design problem and how elements solve it.

. Consequences: are the outcomes and trade-offs of applying a pattern.

1.2 Research Objective

Vast number of surgical procedures are being performed on patients affected by tissue loss due to organ failure, injuries etc. However, treatment using these procedures is limited to few patients due to limited number of donors. Three-dimensional growth of cell and tissue development is the primary focus of tissue engineering to develop bio artificial tissue substitutes or to induce tissue remodeling to repair, replace, or enhance tissue functions [6,11]. This research is to understand the functionality of previously developed three-dimensional cellular based models and extend the functionality for the study of cell dynamics. This can be achieved by enhancing the functionality of the tool generating simulations like CompuCell3D for providing flexibility to biologists or researchers when working with CompuCell3D. Altering various parameters

9 dynamically during the simulation to compute the tissue growth rate or to predict the time to reach volume coverage can have the potential to be a predictive tool.

1.3 Contribution of Research

Contribution of this research include description of the simulation tool CompuCell3D using technology and models to address some of the existing challenges. A new model has been proposed and developed that provides an application interface for managing the cell parameters such as temperature, volume area, steps etc. that can be manipulated dynamically during runtime by user, instead of waiting for the whole simulation to complete for altering the simulation parameters. Dynamic steering panel functionality that we added as part of this research paper gives control and flexibility to the user to modify the simulation at run time.

1.4 Organization of Research

Chapter 1 provides an introduction to the simulation tool CompuCell3D and its importance in the field of biology. This chapter talks about Object Oriented Programming concepts and how it ties to the simulation tool CompuCell3D. The main objective of this research has been explained in this section.

Chapter 2 describes the design and architecture of CompuCell3D. This includes a detailed explanation of the components of CompuCell3D and its interface. This section explains the Python code base in the software and how scripting languages like Python and C++ have been used to develop this software. This chapter also walks through the specification of basic cell-sorting properties and cell-sorting types in the simulation wizard. An in-depth literature review has been conducted to understand the existing work that helped us in identifying the problem areas, in this

10 section. This chapter talks about cell manipulations in CompuCell3D and code snippets that can be used for creating and deleting cells.

Chapter 3 provides evaluation of CompuCell3D (CC3D) for design and analysis by updating CompuCell3D XML (CC3DML) parameters. This chapter talks about the extensions to

CompuCell3D software and enhancement features added to the tool. This chapter details the python modules used to create the new application called ScriptAdder and displaying the updates made to parameters using logs. This chapter also describes how plots can be added to a simulation for analysis and study of the output. We also talk about saving files of the simulations and the various steps involved in it. We conclude by summarizing the problem and the enhancements made to the simulation tool and future work.

11 CHAPTER 2

DESIGN OF COMPUCELL3D

CompuCell3D (CCD3) is an open-source environment for multi-cell and single-cell-based modeling of tissues, organs and organisms. Cell behaviors are modeled using Cellular in CompuCell3D. Simulations written in CompuCell3D XML model are fixed and not dynamically changed. The initial cellular behaviors that are specified are carried throughout the simulation and the behaviors descriptions are unchanged. CompuCell3D generates multi cell simulations using static values that are initially defined at the beginning of the simulation. Generating multi-cell simulations dynamically using CompuCell3D based on user parameters over a defined time frame may lead to broadening our understanding of the simulation and growth patterns of cells, diseases and draw meaningful and insightful conclusions and contributing to methods of treatment in the long term.

2.1 CompuCell3D Architecture

CompuCell3D architecture consists of three tiers as shown in Figure 1. Tier 1 is the core of CompuCell3D’s simulation engine that contains simulation lattice and mathematical models of . Problem-solving environments (PSEs) capabilities can be enhanced by developers in this layer. Tier 2 or the User-level abstraction consists of the domain specific language called

Biologo that lets users to model problems with a compiler that converts the syntax to simulation- engine source code. Tier 3 is called the Presentation layer that includes a visualization toolkit with a GUI that lets users to run and configure simulations used in cell imaging. Interaction among each tier occurs through an API.

12

Figure 1. CompuCell3D’s architecture [17]

Tier 1: Developer Layer (Simulation Engine)

Cellular Potts Model (CPM) is the core of CompuCell3D’s framework and is designed to simulate cell interactions and movement [17]. Cells are described using lattice and each site is associated with an index called voxel to identify cells spatial extent and the location at any given time. The collection of lattice site having same index are called domains and they represent discrete cells that can reorganize themselves to produce motion. CPM aggregates the forces that causes cells to reorganize into effective energy E. Effective energy is the gradient at which the forces are acting at a given time. Cell interactions, motion fluctuations and responses to external stimuli are described within the effective energy whose parameters change during cell growth and differentiation. The term effective energy is used because it contains terms that mimic energies.

Equation 1 shows a typical energy E [17]:

E = EContact + EVolume + ESurface + EChemical

13 Monte Carlo algorithm implements cell membrane fluctuations where each term describes a different biological mechanism. Net adhesion and repulsion between cell membranes are described by contact energy which is the product of the binding energy per unit area and the total area.

Tier 2: User-level Abstraction (Biologo)

The domain specific language Biologo extends XML in such a way that it can model various morphogenesis sub processes like cell differentiation, volume constraints, intercellular adhesion, , haptotaxis, and reaction-diffusion. Biologo inherits syntax and semantics from XML using available extended parsing libraries. Extensions of this language for

CompuCell3D are implemented as XML modules that use dynamically loaded C++ plug-ins.

Biologo program can be translated into source code for a CompuCell3D plug-in using two stage process. The front-end compiler parses and analyzes the program and then executes error- checking routines and generates an intermediate file containing simpler syntax, which then passes through the code generator that processes and translates the intermediate file into C++ [24]. The intermediate code eliminates the overhead of changing front end code generator to suit the platform on which CompuCell3D is deployed.

Tier 3: Presentation Layer

Major task of this layer is to provide GUIs and visualization tools but developers often neglect this area of software development. Older versions of CompuCell3D lacked a GUI and visualization was outsourced to third-party tools, however a PSE requires an easy and understandable interface for user interaction. To address these issues, [17] have developed a tool called CompuCellPlayer that provides GUI to CompuCell3D. The GUI displays the current state

14 of simulations in real time and saves the state in the form of a graphical .png file on the hard drive for processing further if needed. CompuCellPlayer allows users not only to render simulations in

2D and 3D but display chemical concentrations and cell velocity fields, zoom, and toggle cell border display. CompuCellPlayer is customizable and allows users to define and configure cell colors and borders along with concentration and vector-field plots. CompuCellPlayer enables and chooses appropriate plots for simulations based on the XML description. CompuCellPlayer has the ability to save multiple views of simulations and can save screenshots of chemical, and velocity fields during a run without any overhead.

The CompuCellPlayer can also be configured to run in a non-interactive mode which is useful when users run CompuCell3D on clusters accessed through queuing systems. When in a non-interactive mode, CompuCell3D should be inputted with a screenshot description text file that tells which views to save so it can prepare the screenshot description file. To do this, user need to switch views and use the Camera button on the views that need to be saved. At the end of this step,

CompuCellPlayer stores a screenshot description file that controls non-interactive mode. Lastly, a simulation can be serialized to restart at a later time with different parameters by users making it possible to equilibrate cellular patterns before running a simulation, from a more physically relevant initial state.

PDEs are primarily used to model the reactions of diffusible and non-diffusible molecules

[26] in Biologo. Convergence and stability of the finite difference methods have been demonstrated by Nian Li and his colleagues [27] to address reaction diffusion equations. Any user will be able to write PDEs in Biologo for generating a 2-Dimensional a plugin for finite difference solver that the CompuCell3D can load and populate the associated chemical field dynamically that can be leveraged by other Compucell3D plugins.

15 The experiments conducted in [23] used vitro capillary development, by duplicating the results of another model [25] and Gamba-Serini PDE model [27] simulating chemoattractant reaction-diffusion in below equation [23]:

 indicates the rate at which the cells secrete chemoattractant, E is the rate of chemoattractant resorption in ECM, D shows the diffusion constant of the chemoattractant in the cells and ECM,

δσx,0 has the value 1 for cells and 0 for medium. Therefore, c diffuses and decays in extracellular matrix. The equation models a chemo attractant’s diffusion and breakdown and therefore doesn’t independently drive cell patterning.

CompuCell3D provides Python scripting interface that allows users to build complex simulations without the use of low-level code. This approach has been successful as it allows non- programmers to use mathematical modeling. Python scripting in CompuCell3D offers developers the flexibility to build models where the behavior of individual cells change according to user specification as the simulation progresses. This allows the user to dynamically generate simulations by altering the area or volume over time in our case. CompuCell3D has a flexible control with an interactive graphical user interface and is easily extendable. Play, pause, rotation, zoom, color setting functionalities are available in the player as shown below in Figure 2. Figure

2 displays 2-Dimensional view (xy axis) of the simulation. The simulation can be viewed in another axis (xz, yz) or in 3D using CompuCell3D Player. However, execution speed of the simulation and cost of generating graphics could be negatively affected by producing the outcome in 3D.

16

Figure 2. CompuCellPlayer Interface

To alter the speed of execution of a simulation, CompuCell3D models often reduce 3D simulations to 2D analogs. Moving from 3D to 2D or vice versa is much easier in CC3D than in an adaptive mesh finite element simulation [2].

2.2 Limitations of CompuCell3D:

Model descriptions in CompuCell3D XML (CC3DML) model specification format are static in the sense that the parameters and cellular behaviors cannot be changed during simulation

[33]. Users can specify cellular behaviors initially and those behaviors remain unchanged throughout the simulation. Simple cell-sorting simulations can be generated using CC3DML.

However, to build complex biological models we need to look beyond markup-languages and

CompuCell3D provides an easy to use interface with Python scripting which facilitates users to build complex simulations without having to write low-level code. Another limitation in

17 CompuCell3D is with Cellular Potts Model when lattice contains many cells in a simulation and some of them will stick to the lattice boundaries due to contact energies being positive numbers

[32]. The contact energy equals to 0 when a cell touches the lattice boundary. Hence, when contact energies of cells are positive it is probable of the cell touching the boundaries and will remain along the lattice boundary.

2.3 Python Scripting in CompuCell3D

Python scripting in CompuCell3D offers flexibility to build models whose individual cells behavior can change as per user specifications as the simulation progresses. Performance evaluation shows that using Python does not show any noticeable degrade in the performance of the simulation 90% of the time [32]. However, certain tasks need to be handled by C++ because

Python will be way to slow to handle them. Using Python scripting will dramatically increase productivity and prior knowledge of scripting languages is not necessary. Python does not require code to be compiled, users can just write the script and run. Any update to CompuCell3D can be easily made by editing the source code and running the script again. Using Python has eliminated the need of spending time dealing with installation and compilation of C/C++ modules. Python is compatible with many operating systems (Mac, Windows, Linux). Users can still develop high performance C++ modules using CompuCell3D and Twedit++ that have necessary tools to make it possible. Twedit++ has CC3D Python Menu that can invoke CompuCell3D simulation wizard as shown in Figure 3 below, which simplifies Python coding in CC3D.

18

Figure 3. CompuCell3D Simulation Wizard from Twedit++

Python is an object-oriented scripting language that supports flow-control statements such as if-elseif-else conditional instructions and for and while loops. Python relies on indentation to define code blocks such as if statements, for and while loops and its subsections that can be defined using ':' and increasing the level of indentation. A block can be ended by decreasing the level of indentation. A single data structure can store objects of multiple types. Since Python provides automatic memory management, users do not have to deallocate memory for objects that are no longer used manually. The structure of generated CC3D simulation code is stored in .cc3d file that looks like below.

19

Figure 4. Structure of CC3D Simulation Code

Every CC3D simulation that uses Python consists of a main Python script. The structure of this script is templated, which means changes to the script should be made specific to the need, leaving the rest of the template untouched. The goal of main Python script is to setup a CC3D simulation and ensuring all the modules are initialized in the correct order. Typically, user modifications to the Python script is towards the end of the script where extension modules can be registered called as steppables and plugins.

20

Figure 5. Template of Main Python Script

1. import sys - provides access to the standard functions and variables to manipulate the

Python runtime environment.

2. from os import environ from os import getcwd

The above two lines import environ and getcwd functions into the current script and are

included in all Python programs.

3. import string

sys.path.append(environ["PYTHON_MODULE_PATH"]) import CompuCellSetup

21 Using above 3 lines, we import the string module that contains functions for performing

strings operations of characters, setting search for Python modules and importing the

CompuCellSetup module - which provides functions that simplify CompuCell3D

simulations initialization.

4. sim, simthread = CompuCellSetup.getCoreSimulationObjects()

CompuCellSetup.initializeSimulationObjects(sim,simthread)

Above lines create and initialize the core CompuCell3D modules.

5. steppableRegistry=CompuCellSetup.getSteppableRegistry()

from cellsortingSteppables import cellsortingSteppable

steppableInstance=cellsortingSteppable(sim,_frequency=1)

steppableRegistry.registerSteppable(steppableInstance)

CompuCellSetup.mainLoop(sim,simthread,steppableRegistry)

Steppables registry is created that stores steppables, i.e., a list of all steppables that the Python code can access and pass it to the function that runs the simulation. cellsortingSteppable is also created to sort the steppables.

The main Python script loads CC3DML file that has initial description of cell behaviors.

CC3DML provides the description of INITIAL cell behaviors and user can modify these behaviors as the simulation progresses using Python. To invoke the simulation wizard to create a simulation,

CC3DProject -> New CC3D Project in the menu bar. In the initial screen, user can specify the name of the model (cell sorting), its storage directory - C:\CC3DProjects and how the model should be stored as CC3DML, Python and CC3DML or only Python. On the next page of the

22 Wizard we specify GGH global parameters, including cell-lattice dimensions, the cell fluctuation amplitude, the duration of the simulation in and the initial cell lattice configuration shown in Figure

4.

Figure 6. Specification of basic cell-sorting properties in Simulation Wizard

Opening .cc3d file in CompuCell3D triggers the simulation to run. Console output from this simulation will look something like below. Python script will print each cell id until the max Cells defined in reached.

23

Figure 7. Printing cell ids using Python script

Cell Types in the model can be named in the next Wizard page. There are two types of Cell

Type Specification such as Condensing (more cohesive) and Noncondensing (less cohesive).

CC3D comes with a generalized-cell type called Medium by default, and has unconstrained volume that fills the unspecified space in the cell-lattice. Any number of cell types can be created and configured in the Simulation wizard as shown in Figure 5.

Figure 8. Specification of cell-sorting cell types in Simulation Wizard

24 Cell Behaviors and Properties of the model can be defined in the wizard. Objects in CC3D will not have any behaviors or properties unless specified by the user. Cell sorting depends on differential adhesion between cells and define volume using the Volume Constraint feature.

Figure 9. Selection of cell-sorting cell behaviors in Simulation Wizard

After setting all the properties mentioned above shown in Figure 6 CC3D generates the draft simulation code. Opening cellsorting.cc3d triggers CC3DML (cellsorting.xml) and the

Python scripts for the model. The structure of generated CC3D simulation code is stored in .cc3d file under the project folder. .cc3d file is used to link Python simulation files together in ambiguous way. Additional Structure and contents of xml and python scripts will be explained in detail as the project advances.

Code reusability in multicellular models based on other code languages like C/C++ code involves exploring large code bases and understanding the functionality behind it, extraction of relevant code and using the relevant code in the context. To overcome these limitation of existing

25 models CC3D is being adapted by many biologist to create their own models. Main advantages of using CC3D for multi cell growth and simulation are listed below.

1. CC3D is an open source software eliminating the cost of acquiring model building tools

2. CC3D models are executable across different platforms and do not require code

compilation

3. Models built in CC3D are compact and shareable. As CC3D models are based on Python,

they require minimal effort to develop or extend the functionality of existing model when

compared to other custom code programming.

4. Simulations in CC3D are fast and easy to refine.

2.4 Adding New Cells

The simulations generated in Twedit++ contain an initial cell layout. Users can either create new cells or delete existing cells while a simulation is in progress using Twedit++. It can easily be done by updating the BlobInitializer section in the CC3DML code present in cell sorting simulation. Cell sorting simulation code can be found in the below location after installing

CompuCell3D.

File: C:\CC3DProjects\cellsorting\Simulation\cellsorting.xml

26

Figure 10. Xml Code of Cell Sort Simulation

A cell can be created on Twedit++ using the CC3D Python option available on the interface. Cell

Manipulation section displays a list of various options available in it to create, delete, move, fetch cells etc. A single cell can be created by inserting the code snippet below in Twedit++ shown in

Figure 7.

27

Figure 11. Inserting code snippet in Twedit++ to create cells

Below python code is generated after selecting to Create Cell.

Type of the cell can be initialized using self.CONDENSING variable corresponding to an integer assigned to a type Condensing. Cell type takes values from 1 to 255 and variables corresponding to each type will be automatically be created by CompuCell3D. Definition of

CellType plugin in CC3DML infers 1 as Condensing cells and 2 as Non-Condensing cells.

SteppableBasePy provides an easy denotation of cell type numbers for member variables. The name of variables is obtained by denoting the name of cell type in capitals. Example, we have three such variables self.MEDIUM, self.CONDENSING, and self.NONCONDENSING with values 0,1,2. Spaces should be avoided in between cell type name to ensure proper translation into

Python variables. In Python, cell.type = self.CONDENSING is equivalent to cell.type=1.

Similarly, unwanted cells can be deleted using the ‘Cell Manipulation’ option from the

CC3DPython menu and selecting ‘Delete A Cell’. Users can also delete cells by specifying constraints. Example all the cells of type Condensing can be erased.

28 CHAPTER 3

COMPUCELL3D ENHANCEMENTS

3.1 Building New Simulation in CompuCell3D

Building a new simulation is easy by selecting the desired properties and defining the parameters like initial temperature, volume, scale of X and Y axis etc. All the properties and settings used for building a simulation has been detailed earlier in Chapter 2. Figure 12 is an example of what a basic simulation looks like in the Player.

Figure 12. Sample Simulation in CompuCell3D Player

3.2 Updating CC3DML Parameters Dynamically

One of the limitations of CompuCell3D we have discussed earlier is the inability to update the simulation parameters while the simulation is in progress. Altering parameters can be achieved by changing CC3DML parameters in the XML code before starting the simulation. Updating

29 parameters of simulation using the XML code may not be a flexible option for users without programming knowledge. To address this problem, we developed a Python based application called ScriptAdder as shown in Figure 13 to enable updating parameters like temperature, volume,

Steps etc. while the simulation is still in progress.

Figure 13. ScriptAdder Application Interface

The ScriptAdder application interface is built using Visual Studio and needs to be initiated to add the desired parameters to the simulation player. The application interface is as shown in

Figure 8. Users can open any simulation to which they want to add the dynamic steering panel.

After the desired simulation is selected, user can select parameters from the GUI to be added to the simulation. Any of the steering parameters may be added to any existing simulation or a new simulation by specifying the location of cc3d file you want to add to. After selecting the parameters

30 in the interface, user has to close the application and open the .cc3d file from the Player to start the simulation and view the steering panel pop up. The dynamic steering panel will pop up when the simulation starts running as shown in Figure 14.

Figure 14. Dynamic Steering Panel in CompuCell3D Player

Temperature Panel – provides flexibility to overwrite the initial set temperature before the start of simulation and specify an interval at which the temperature should be increased for the number of steps entered by the user. This panel provides great flexibility to manage the parameters of the simulation without having to update them at the Python or XML level. Logs for the initial set temperature of 10 with an interval of 0.001can be viewed using logs as shown in Figure 15.

31

Figure 15. Logs Showing the Initial Set Parameters

The new temperature is set to 24 with an interval of 2.0 in the steering panel, the logs will reflect the updates in temperature and the interval as shown in the Player interface in Figure 16 and Figure

17.

Figure 16. New Temperature and Interval in Steering Panel

32

Figure 17. Logs Showing the Updated Temperature and Interval

3.3 Steppables

Temperature Steppable: The existing temperature steppable first fetch Potts element

(pottsXMLData) using function from the simulator object. After the fetching is successful, the first

Temperature child element of the Potts element is collected.

33 Figure 18. Existing PottsSteering Class with Temperature

Once the temperature is collected, it converts value of the temperature to a floating-point number and increase the value of this number by one and then update value of the temperatureElement as defined below. A call is made to simulator member function by ending the steppable, that informs

CC3D that CC3DML was updated and simulation needs to get new parameters.

Below code snippet is from the CC3DML Potts section to set the parameters before starting a simulation. Potts section XML code element has four sub elements called Temperature,

Dimensions, Steps and NeighborOrder. Each XML element of the Potts section can be called using

Python temperatureElement has a set of functions that access functions to read and modify element values and attributes.

Figure 19. Xml code for Setting Initial Parameters

Modifying the contact energy of Condensing and NonCondensing cells before the start of simulation can be achieved by modifying the below plugin code. We first fetch the XML element and then the Python object for the element for two types of cells – Condensing and

NonCondensing.

34

Figure 20. Xml code for Setting Contact Properties

The new temperature steppable we created for updating the temperature values during a simulation is as shown in Figure 21. The steppable compares if the default temperature is same as the initial temperature value entered in the steering panel. If both values are different, it assigns the value entered in initial temperature as the new updated temperature. Similarly, the mechanism is executed for comparing temperature interval. Along with temperature, we have also added a temperature interval that the user can define at runtime. The temperature interval determines the value by which the initial temperature will increase for every Monte Carlo Step (MCS). After evaluating the new temperature and interval values specified by the user, fluctuation amplitude is updated.

35

Figure 21. New Temperature Steppable

To modify the temperature while the simulation is in progress, new temperature value can be specified in the steering panel interface. We do not have to update the CC3DML at the Python level often. CC3D contains modules that need parameter initialization in Python but has simple programming interface. Sample simulation has been updated with new temperature and simulation looks like as shown in Figure 22.

36

Figure 22. Simulations of Cells with New Temperature

Steps Steppable: Steppables are by default called after each completed MCS when created using

Twedit++. Frequency argument can be modified to any value to have the steppable called every

MCS specified. The frequency can also be updated in such a way that the steppable is called only certain number of times and can vary throughout the simulation using a step function.

37

Figure 23. New Steppable for Adding Steps to Steering Panel

The step function runs the steppable for every MCS until the simulation reaches the user specified

MCS in the interface. MCS are defaulted to 1000. A simulation can also be stopped by defining the max MCS in the Simulation properties using self.setMaxMCS(10000) to stop the simulation after certain MCS.

Volume Steppable: The updated Volume steppable can be added the dynamic steering capability with default value of 25 for targetVolume and lamdaVolume as 2. These values can be updated at any time during the simulation. When the values are updated, the steppable prints relevant message that the Volume parameter has been updated and prints the updated target volume and lamda volume for every MCS. The new volume steppable is as shown in Figure 24.

38

Figure 24. New Steppable for Adding Volume to Steering Panel

Other Steppables: We have also updated steppables for modifying FlipDimRatio and

NeighborOrder values of the simulation to be updated dynamically if needed. Any of these updated steppables can be easily added to any simulation using the ScriptAdder application.

39

Figure 25. Flip2DimRatio and NeighborOrder Steppables for Steering Panel

3.4 Plots for Tracking

We can monitor the status of CC3D simulations by displaying real time plots that show the current state of a simulation. It is relatively simple to add to Player windows via Twedit++ CC3D

Python -> Scientific Plots Menu. Below python code refers to addition of plots in CC3D. A plot window self.pW is created in the start() function. Type of plots, style, color and size are defined using the self.pW.addPlot() function. In the below code, we are plotting two-time series data, one is showing average volume of all cells denoted as dots and the other showing volume of cell id 1 denoted as steps.

40 Step() function in the code is used to calculate the average volume of all cells and exact volume of cell with id. Once the calculations are completed the results are added to the time series. For that we use data series identifiers AverageVol and CellVol, then Monte Carlo Step (mcs) step is called and cell.volume is the actual quantity we plot on the Y axis.

The results of the above code will look like below with 2 time-series data. Plots in CC3D are mainly used to monitor the current state of the simulation shown in Figure 26.

Figure 26. Plot window in CC3D Player

41 Histograms can also be added to CC3D player but is more complicated than adding simple plots, because the data needs to be processed first to produce histogram data.

3.5 Saving Data

Users can write output data files when running CC3D simulations to store information about the simulation. CC3D by default saves snapshots of simulations in a directory that is automatically created on the same of the simulation and timestamp. The output location can be manually overwritten in the Player. Below python code can be used to open the file in simulation output directory.

Figure 27. Code to Add File Path for Saving Data Files

3.6 Literature Review

Until recent times, the state of how cells interact with each other to produce a tissue or diseases was purely experimental. Multi-cell computer simulation methods are now emerging from simple cellular automata to complex immersed-boundary and finite-element models and interactions such as growth, death, secretion, movement, adhesion of chemicals etc.

[2] has introduced the lattice-based Glazier–Graner–Hogeweg (GGH) Monte Carlo multi-

42 cell modeling and talks about GGH-based CompuCell3D simulation environment that allows modeling and simulation of cellular and multi-cellular behaviors in the context of tissue formation and subsequent dynamics. Researchers walkthrough four biological models such as Cell-Sorting

Model, Angiogenesis Model, Python Module and Three-Dimensional vascular tumor growth model and its associated simulations to demonstrate GGH and CompuCell3D capabilities. The

GGH model provides mathematical formulae to map observed cell behaviors and interactions onto a small set of model parameters. The GGH has been continuously applied to model biological processes, including Tumor growth successfully as demonstrated in [5] and [7].

Figure 28. Flowchart of GGH algorithm in CompuCell3D

The GGH technique developed as part of this study has significant advantages when compared to other methods from a modeler’s standpoint. GGH simulations are often faster than other equivalent element simulations operating at the same level of modeling because a single processor can run GGH simulation of 10 -100,000’s of cells on lattices of up to 10243 sites [2].

For smaller simulations, GGH allows to explore conditions, parameters and other model details.

The formulation of GGH is derived from statistical physics and to connect experimental results to parameters of simulation, a series of experiments and analysis has been performed to derive the

43 parameter values. GGH motility is then adjusted to match the diffusion constants. In the same manner, the form and strength of cells behavior can be determined from experimental response curves of cell migration. Authors conclude by saying that CC3D makes the development of Multi- cell models in combination with sub cells much easier with basic level of editing the software.

Furthermore, they stated that CC3D addresses difficulty faced by researchers in reusing, testing and adapting to published models. Most existing published multicellular models are based on

Fortran or C/C++ code, which is of minimal use to other potential users [12]. As a future work researchers are developing a cell-behavior model language that will compile into executable

Python eliminating the last need for model builders to learn programming language.

[6] has developed a computational growth model of multi cells based on cellular automata for study of growth and population of migrating cells. They have modeled cell migration using

Markov chain approach. The model used in their study contains various parameters for analysis of cell population dynamics allowing to study their effects on tissue growth rate and frequency of interaction between cells. Researchers have developed an algorithm and implemented it on

Beowulf Cluster using the Message Passing Interface. Performance of the algorithm has been analyzed in terms of efficiency and speed by generating sequential and parallel simulations.

The model discussed in this work is based on an existing model implemented in Fortran.

Their extended model discussed in this work was implemented using the Python scripting language. A parallel algorithm that runs on a Beowulf Cluster was implemented in addition to the sequential algorithm and the performance of the parallel algorithm was analyzed for speedup and efficiency. Predictive capability of models is a prerequisite for developing control strategies for biotechnological processes involving the growth of multicellular tissues. Authors stated that this

44 three-dimensional model would have implications in speeding up progress in tissue development where artificial tissue growth involves experimentation that is often time-consuming.

[13] has discussed about another lattice based modeling technique called The Cellular Potts

Model (CPM) or Glazier–Graner–Hogeweg model developed by Glazier and Graner [14–16] which is widely used for simulating cellular patterns. The CPM describes cellular models assuming the cells are spatially extended but internally structure less objects, cells and associated fields are discretized onto a lattice and describes cell behaviors and interactions in terms of an effective energy and the implementation of CPM employs a modified version of Monte-Carlo algorithm

(that chooses update sites randomly). Authors talk about the evolution of the model based on the standard Monte Carlo algorithm that preserves connectivity of cells on a limited range of simulation temperature only. In this work, authors present a new algorithm called Connectivity

Algorithm (CA) that tests the connectivity between two cells, the candidate cell and the target cell that are possibly affected by the modification of a site value: defined as the cell whom the candidate cell and the target lattice site belong to. For every couple of lattice sites that belong to the cell they have inspected that there is a path that links both the cells. To test the efficiency of CA algorithm, cell sorting simulations presented in [14,15] have been performed. Authors state that CA algorithm has numerous advantages as listed below.

1. Prevents cell fragmentation for all simulation temperatures instead of a specific range

allowing to enhance realism of the simulated patterns.

2. Increase computational efficiency when compared to CPM algorithm at same simulation

temperature.

45 3. Restoring the balance equation ensuring that the long-term stage is independent of the

acceptance rate and the path chosen at the temperature range, it works for all simulation

temperatures.

4. The implementation of this algorithm is much easier than those of parallel algorithms.

[17] has outlined the advantages of adapting CompuCell3D for study of simulations and morphogenesis of multicellular organisms. Authors state that 3D development of multicellular organisms arises from a single-celled fertilized zygote with a 1D genome is still a challenge in postgenomic biology. By treating cells with a phenomenological approach multiple complex biochemical interactions to a small set of behaviors such as movement, division, death, differentiation, shape changes, and cell–cell communication can be reduced [17]. Researchers often use problem-solving environments (PSEs) to address these problems, because PSEs let users focus on specific domains of expertise without requiring in depth knowledge of modules.

Authors have developed a 3D multiscale PSE for modeling morphogenesis that combines discrete cellular automata and continuum methods for flexibility and scalability. It is implemented using James Glazier and François Graner’s Cellular Potts Model (CPM) to govern cell interactions along with partial differential equation (PDE) to establish external chemical gradients. This study states that CompuCell3D takes a cell centered approach to morphogenesis modeling by simulating cells where a user can define PSE features like behavioral rules and biophysical properties by coding those features in C++ or by writing programs in Biologo, a high-level domain-specific language (DSL). To facilitate experiments with these models, authors have developed an interactive GUI called CompuCellPlayer. This paper discusses the core of CompuCell3D, its

46 architecture and types of cell-sorting simulation in detail.

Authors have examined how CompuCell3D performance scales with cell density and lattice size for a cell-sorting simulation run for 500 Monte Carlo steps (MCSs) and proved that execution time scales linearly with lattice size at constant density. As a future work, authors hope to improve scaling with cell density by recognizing sparse areas of the lattice by implementing data structures or random-walk algorithm [18], which restricts flip attempts to boundary lattice locations.

3.7 Conclusion

The paper provides an overview of CompuCell3D and its architecture for simulation and visualizing models for multi-cell growth and its advantages in the field of biology. An extensive study has been performed on CompuCell3D and Python code base within CompuCell3D to understand the design, functionality and its role in the field of biology. Study of literature provides verification of hypotheses, models, computer simulations and are useful in suggesting hypotheses.

Identifying and quantifying cell-level interactions playing vital role in pattern formation that will help to develop treatments for diseases like cancer and techniques to develop cellular structures.

After studying existing work, we have identified the limitations of Compucell3D and proposed enhancements to the code that may address the limitations. We have developed a new application to enable adding of dynamic parameters to any simulation without having to update the code at python level. Making updates to Python in such a way that CompuCell3D will be able to generate multi-cell simulations dynamically based on user parameters that can vary automatically over a defined time frame that can be an extension to the existing model.

47 References:

1. Lutz M. Learning Python. O'Reilly & Associates, Inc.; Sebastopol, CA: 1999

2. M. Swat, Gilberto L. Thomas, Julio M. Belmonte, A. Shirinifard, D.Hmeljak, J. A. Glazier

(2012). Multi-Scale Modeling of Tissues Using CompuCell3D, Computational Methods in

Cell Biology, Methods in Cell Biology 110: 325-366 (2012)

3. Visualizing Cells and their Connectivity Graphs for CompuCell3D – R. Heiland, M. Swat,

J. Sluka, B. Zaitlen, A. Shirinifard, G. Thomas, A. Lumsdaine, J. Glazier, 2nd IEEE

Symposium on Biological Data Visualization (2012)

4. M. Swat, Christopher Mueller, J. Glazier, J. Belmonte, Alexander Dementsov, Benjamin

Zaitlen. Scripting CompuCell3D extension modules in Python Tutorial V3.4.2.

5. Simulated evolution (Groenenboom and Hogeweg, 2002; Groenenboom et al., 2005;

Hogeweg, 2000; Johnston, 1998; Kesmir et al., 2003;Pagie and Mochizuki, 2002),

6. Lenny C. K. Tang. (2007). Three-Dimensional Computational Model for the growth of

multicellular tissues and its parallel implementation on a cluster, ISBN: 978-0-494-40769-

1

7. R. Langer and J. P. Vacanti. Tissue engineering. Science, 260:920-926, 1993.

8. A. M. Law. Simulation modelling & analysis. McGraw-Hill, Inc., ISBN-

10: 9780070366961.

9. C. Leopold. Parallel and distributed computing: A survey of models, paradigms, and

approaches. John Wiley & Sons, Inc., New York, 2001.

10. J. H. F. Lim and G. A. Davies. A stochastic model to simulate the growth of anchor• age

dependent cells on flat surfaces. Biotechnology and Bioengineering, 36:547-562,

September 1990.

48 11. X. Liu and P. X. Ma. Polymeric scaffolds for bone tissue engineering. Annals of

Biomedical Engineering, 32(3):477-486, March 2004.

12. Computational Methods in Cell Biology, Methods in Cell Biology, Volume 110, (2012),

ISBN: 978-0-12-388403-9

13. Marc Durand, Etienne Guesnet. An efficient Cellular Potts Model algorithm that forbids

cell fragmentation, Elsevier B.V, 2016

14. F. Graner, J.A. Glazier, Phys. Rev. Lett. 69 (13) (1992) 2013–2016.

15. J. Glazier, F. Graner, Phys. Rev. E 47 (3) (1993) 2128–2154.

16. J.A.Glazier,A.Balter,N.J.Popawski,D.A.R.A.Anderson,P.M.A.J.Chaplain,D.K.A. Rejniak

(Eds.), Single-Cell-Based Models in Biology and Medicine, Mathematics and Biosciences

in Interaction, Birkhäuser Basel, 2007, pp. 78–105.

17. Cickovski, T., K. Aras, M. S. Alber, J. A. Izaguirre, M. Swat, J. A. Glazier, R. M. Merks,

T. Glimm, H. G. E. Hentschel, and S. A. Newman. 2007. “From Genes to Organisms Via

the Cell: A Problem-Solving Environment for Multicellular Development”. Computing in

Science & Engineering 9 (4): 50–60.

18. E.Gusattoetal.,“AnEfficientParallelAlgorithmtoEvolveSimulations of the Cellular Potts

Model,” Parallel Processing Letters, vol. 15, no. 1, 2005, pp. 199–208.

19. Swat, M. H., Thomas, G. L., Belmonte, J. M., Shirinifard, A., Hmeljak, D., and Glazier,

J. A. (2012). “Multi-scale modeling of tissues using CompuCell3D,” in Computational

Methods in Cell Biology, Methods in Cell Biology, Vol. 110, Chap. 13, eds A. R. Asthagiri

and A. P. Arkin (London: Academic Press), 325–366.

20. B. Meyer. Object Oriented Software Construction. Prentice Hall, Inc, New Jersey, 1997.

21. Class based programming. https://en.wikipedia.org/wiki/Class-based_programming

49 22. B. Meyer. Eiffel: The Language. Prentice Hall, Inc, New Jersey, 1992.

23. TREVOR CICKOVSKI, KEDAR ARAS, MARK S. ALBER, AND JESUS A.

IZAGUIRRE, From Genes to Organisms Via the Cell A Problem-Solving Environment

for Multicellular Development, IEEE CS and the AIP 1521-9615/07/

24. T.Cickovskietal.,“A Framework for Three-Dimensional Simulation of Morphogenesis,”

IEEE/ACM Trans. Computational Biology and Bioinformatics, vol. 2, no. 4, 2005, pp.

273–288.

25. R.M.H.Merksetal.,“Cell Elongation Is Key to Insilco Replication of Invitro Vasculo

genesis and Subsequent Remodeling,” Developmental Biology, vol. 289, no. 1, 2006, pp.

44–54.

26. H.G.E.Hentscheletal.,“Dynamical Mechanisms for Skeletal Pattern Formation in the

Vertebrate Limb,” Proc. Royal Soc. London B, vol. 271, no. 1549, 2004, pp. 1713–1722.

27. A.Gambaetal.,“Percolation Morphogenesis and Burgers Dynamics in Blood Vessel

Formation,” Physical Rev. Letters, vol. 90, no. 11, 2003, p. 118101.

28. Glazier, J. A. (1993). Cellular Patterns. Bussei Kenkyu 58, 608-612.

29. Glazier, J. A. (1996). Thermodynamics of Cell Sorting. Bussei Kenkyu 65, 691-700.

30. Glazier, J. A. and Graner, F. (1992). Simulation of biological cell sorting using a two-

dimensional extended Potts model. Phys. Rev. Lett. 69, 2013-2016.

31. Glazier, J. A. and Graner, F. (1993). Simulation of the differential adhesion driven

rearrangement of biological cells. Phys. Rev. E 47, 2128-2154.

32. http://www.compucell3d.org/Manuals. Python Scripting Manual for CompuCell3D 3.7.6 and CompuCell3D Reference Manual - 3.7.8

50 33. David Gilbert, Monika Heiner, Koichi Takahashi, Adelinde M. Uhrmacher4. (2014)

Multiscale Spatial Computational Systems Biology, Report from Dagstuhl Seminar 14481

51